-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Begins the implementation of Oceananigans.HydrostaticFreeSurfaceModel for general circulation modeling #1349
Conversation
function HydrostaticFreeSurfaceModel(; grid, | ||
architecture::AbstractArchitecture = CPU(), | ||
clock = Clock{eltype(grid)}(0, 0, 1), | ||
advection = (momentum=VectorInvariant(), tracers=CenteredSecondOrder()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪
Out of curiousity I thought VectorInvariant
changes the form of the equations being solved, but can we think of it as a different advection scheme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm generalizing the kwarg advection
to mean something like "advection term" (both continuous equation aspects and numerical aspects).
We could try to distinguish between continuous aspects (whether we use a vector invariance form, an "interior" form, or a conservation form) and numerical aspects (numerical approximations / stencils used to implement that form).
We could also have a more hierarchical interface; something like
advection = (momentum=VectorInvariantForm(), tracers=ConservationForm(scheme=CenteredSecondOrder()))
I'm open to suggestion; I just did something lazy and simple here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah no I think what you did is great. Just wanted to understand. Makes sense that it encapsulates both the continuous and numerical aspects.
src/Models/HydrostaticFreeSurfaceModels/show_hydrostatic_free_surface_model.jl
Outdated
Show resolved
Hide resolved
function hydrostatic_free_surface_model_tracers_and_forcings_work(arch) | ||
grid = RegularCartesianGrid(size=(1, 1, 1), extent=(2π, 2π, 2π)) | ||
model = HydrostaticFreeSurfaceModel(grid=grid, architecture=arch, tracers=(:T, :S, :c, :d)) | ||
set!(model, η=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I guess we'll have to do this for a lot of tests, similar to ShallowWaterModel
, to avoid blowup when timestepping due to division by zero?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean setting the displacement to some constant value?
Since we're modeling displacement rather than the total thickness of the layer, I think we should get away with an initial value of 0. I can remove the call to set!
since it's tested in another routine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right it's testing set!
.
…surface_model.jl Co-authored-by: Ali Ramadhan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not tried to run it but things look good to me.
One thing that I noticed is that advection seemed to be commented out for tracers. Did I read that right?
Also, time stepping is done differently, and not exactly sure why that is but any time stepping that works is good time stepping!
Yes --- because we are still finalizing the user interface that controls the advection term + advection scheme for momentum and tracers. I think ideally we want to preserve the ability to use high-order advection schemes for momentum when we are on a |
@ali-ramadhan @francispoulin I propose that for the time being we use an abstraction where The value of this field controls the implementation of the When we have curvilinear grids we will need a function |
I also wonder if we really need to have two kwargs ( |
I think a single I agree it's a bit messier to parse and validate but the parsing and validation can be done by small functions in a separate file. |
Hmm, as a user I think there are reasons why you might wnat to have the choice to use different advection schemes for momentum and tracers (and buoyancy). But could there be a default where if there is only momentum advection specified, then tracers are the same? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look reasonable to me.
It seems that nonlinear advection was added into the tendencies, but were the Coriolis terms also removed?
No they are there. |
clock) | ||
|
||
return ( - U_dot_∇v(i, j, k, grid, advection, velocities) | ||
- y_f_cross_U(i, j, k, grid, coriolis, velocities) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@francispoulin here's a Coriolis term
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I clearly misread something.
This PR adds a new
AbstractModel
calledHydrostaticFreeSurfaceModel
toIncompressibleModel
andShallowWaterModel
in the Oceananigans model suite.HydrostaticFreeSurfaceModel
is intended to solve the hydrostatic Boussinesq equations beneath a free surface. This PR adds the basic infrastructure needed to time step models on aRegularCartesianGrid
with explicit free surface dynamics.I think we should save dynamics tests and an example for a future PR, and just work on getting some of the basic ingredients into this model. The time-stepping tests are currently in place, but most of
time_step!(model::HydrostaticFreeSurface, dt)
needs to be fleshed out.Todo for this PR: