glwagner / OceanTurb.jl

Models and parameterizations for the turbulent ocean surface boundary layer in Julia
https://glwagner.github.io/OceanTurb.jl/latest/
MIT License
25 stars 7 forks source link

Discontinuous Galerkin implementation of parameterizations #78

Closed sandreza closed 4 years ago

sandreza commented 4 years ago

Given that the CliMa code is written with a Discontinuous Galerkin approximation, the sooner things are implemented with this discretization the easier it will be to test the viability of a parameterization. We want to move away from finite volume thinking with regards to how to implement a parameterization as soon as possible!

ali-ramadhan commented 4 years ago

Out of curiousity, given that there exists an efficient finite-volume implementation of KPP, could it make sense to use different discretizations for the global model and for the parameterization.

Extra work would have to be done to interpolate the finite volume KPP output to the DG grid, but maybe even with this interpolation the finite volume KPP could be more efficient than a DG KPP? Maybe a DG KPP would be more numerically accurate, but maybe it doesn't matter if the other assumptions baked into KPP are the leading source of uncertainty.

Or maybe the interpolation cannot be done properly and we need certain properties to be conserved exactly, so a DG KPP is the only way.

I'm just curious if it has to be all-or-nothing (certainly it's nice if everything in the model is DG) or if certain parameterizations can be discretized differently.

glwagner commented 4 years ago

Hmm, interesting. I think that method would be complex and may cost you the accuracy of DG. KPP predicts a diffusivity profile, but it’s the effect of the diffusion operator with KPP diffusivity that actually affects the tracer and momentum distributions. I’m not sure how you add flux divergences predicted by a finite volume method to DG elements... ?

That said, a hybrid approach may be possible in which the mixing depth prediction (the complicated part of KPP) is performed via interpolation with a finite volume method, and then that depth is then used in a DG implementation of the vertical diffusion operator. That could be promising. You would pay the price of having two 3D grids, plus interpolation costs, however.

sandreza commented 4 years ago

That is indeed an interesting point. Currently, I don't know if any decisions have been made to consider different numerical methods within the CliMa code. From a code design perspective, I would imagine that it would be tricky to have different discretizations. From a mathematical level, I am not sure if that introduces some strange stability/accuracy considerations.

The broader sentiment is a difference in philosophy I think. Even if a parameterization is wrong, once the mathematical representation is written down, I believe that it is worthwhile to do the best possible job that one can to faithfully discretize the equations. This lets us separate two issues: representation of the physics from the discrete representation.

rafferrari commented 4 years ago

I think the first step ought to be to sit down and discuss what a DG implementation of KPP would look like. It may be less of a departure from OceanTurb than we fear. In that case there would not be a clear advantage in using different discretizations. However the idea of different discretizations may be appealing, if we stumble in unexpected DG complications.

glwagner commented 4 years ago

@sandreza do you have any code that solves a 1D diffusion equation with a DG method? Can you share?

sandreza commented 4 years ago

The 1D heat equation is at

https://github.com/sandreza/NodalDiscontinuousGalerkin/blob/master/DG1D/solveHeat.jl

It is a slightly restructured version of what is the Nodal Discontinuous Galerkin book. It is a bit obtuse since there is a lot of structure underneath the hood.

glwagner commented 4 years ago

Thanks. We have a starting point. That's the hardest part.

glwagner commented 4 years ago

This is out of scope for OceanTurb --- DG implementations of parameterizations are for another package.