CliMA / Oceananigans.jl

🌊 Julia software for fast, friendly, flexible, ocean-flavored fluid dynamics on CPUs and GPUs
https://clima.github.io/OceananigansDocumentation/stable
MIT License
987 stars 193 forks source link

'Orlanski' open boundary condition #833

Closed glwagner closed 1 year ago

glwagner commented 4 years ago

It'd be nice to implement the 'Orlanski' boundary condition for open boundaries:

https://www.sciencedirect.com/science/article/pii/0021999183901274

For this to work properly, we need to modify the pressure solver to work for time-dependent inflows. We may also need to implement a correction that ensures mass conservation, as described just before section 5 here:

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.70.3860&rep=rep1&type=pdf

This would allow us to simulate the spatial development of a boundary layer, a la

https://iopscience.iop.org/article/10.1088/1742-6596/318/2/022023/meta

tomchor commented 3 years ago

So, Ken and I were discussing some set of simulations that would greatly benefit from this. How hard would it be to implement this given the current state of Oceananigans?

We may also need to implement a correction that ensures mass conservation, as described just before section 5 here: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.70.3860&rep=rep1&type=pdf

Unless I'm missing something this seems trivial (some good news!)

For this to work properly, we need to modify the pressure solver to work for time-dependent inflows

This seems far from trivial. But I'm assuming this was implemented when you guys implemented cubed sphere capabilities, no?

CC @zhazorken

glwagner commented 3 years ago

So, Ken and I were discussing some set of simulations that would greatly benefit from this. How hard would it be to implement this given the current state of Oceananigans?

I think it will take at least a few weeks of dedicated work by someone familiar with Oceananigans and Julia. The algorithms are more or less known, so the challenges are mainly in software development. A significant chunk of the work is developing and running validation experiments.

We may also need to implement a correction that ensures mass conservation, as described just before section 5 here: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.70.3860&rep=rep1&type=pdf

Unless I'm missing something this seems trivial (some good news!)

I believe we'll need to insert a mass correction step into our algorithm (perhaps after fill halo regions in update state?) and how to decide when we need it. I think we'll need it both for non-zero inflow conditions (so Open boundaries with conditions other than nothing / 0`) and outflow conditions like Orlanski.

For this to work properly, we need to modify the pressure solver to work for time-dependent inflows

This seems far from trivial. But I'm assuming this was implemented when you guys implemented cubed sphere capabilities, no?

We only support hydrostatic cubed sphere simulations, so we did not implement an algorithm for accurate non-hydrostatic pressure solves with time-dependent boundary conditions when implementing the cubed sphere.

The algorithm is known (I have a sketch, though some effort should be devoted to writing it up in the documentation); we only need to design a useful software abstraction. The main issue is that the right hand side of the pressure Poisson equation depends on the time-derivative of the wall-normal velocity. This means that we need to store the wall-normal velocity at a prior time-step. We can probably redesign the implementation of the Open boundary condition for this purpose, and add code to solve_for_pressure! that adds these contributions when necessary: https://github.com/CliMA/Oceananigans.jl/blob/73be08d708131a66402eb8fc0086c47ef80a2d0e/src/Models/NonhydrostaticModels/solve_for_pressure.jl#L23-L39

CC @zhazorken

One possible route forward is to first implement the Orlanski boundary condition and setup a few validation experiments before deciding whether the pressure solver modifications are needed.

francispoulin commented 3 years ago

This sounds great and am glad we are discussing it.

This is something we could also do in ShallowWaterModel and wouldn't require any changes to the pressure solver, because there is none.

Might this be a simpler first step? Or maybe just very different?

glwagner commented 3 years ago

That's a good point! We can test / validate OrlanskiBoundaryCondition using ShallowWaterModel (or HydrostaticFreeSurfaceModel) with confidence knowing that there's no pressure solver to mess things up.

francispoulin commented 3 years ago

I am teaching this term so my Oceananigans are at a minimal but would be happy to help with this if I can.

tomchor commented 3 years ago

This is something we could also do in ShallowWaterModel and wouldn't require any changes to the pressure solver, because there is none.

Good point! Probably way to go

glwagner commented 3 years ago

I'd recommend HydrostaticFreeSurfaceModel over ShallowWaterModel as I think it's being exercised a lot more at the present moment... but if there's a specific reason to use ShallowWaterModel instead, that's ok too.

glwagner commented 1 year ago

I'm closing this issue because I'm judging that it's not of current, timely relevance to Oceananigans development. If you would like to make it a higher priority or if you think the issue was closed in error please feel free to re-open.