Closed tomchor closed 1 month ago
this is on #main
?
hydrostatic and nonhydrostatic models use the same code for enforcing boundary conditions.
w
is not a prognostic field for the hydrostatic free surface model so it cannot be used as a dependency in continuous boundary functions.
We could think to change the dependencies to all fields instead of only the prognostic ones
w
is not a prognostic field for the hydrostatic free surface model so it cannot be used as a dependency in continuous boundary functions.We could think to change the dependencies to all fields instead of only the prognostic ones
I wasn't aware of that. Is there a way to use w
as a dependency here? In the MWE w
is superfluous, but on complex bottom topography the drag on the sides should physically depend on w
, among other things.
w
is not prognostic in a hydrostatic model because the vertical momentum equation is replaced by hydrostatic balance. w
is then determined by integrating the continuity equation.
but on complex bottom topography the drag on the sides should physically depend on w, among other things.
It might make sense to follow @simone-silvestri's suggestion and include all fields in field_dependencies
. That would open up more options for forcing in general, esp using auxiliary_fields
.
Here though, the thinking may not be correct. The hydrostatic approximation is an asymptotic approximation predicated on w / u ~ H / L << 1
; w
is negligible compared to the horizontal components. This has important implications: because w
is not prognostic, kinetic energy is (u^2 + v^2) / 2
; one cannot derive a conservation equation from the governing equations for a kinetic energy that includes w
. It may also make sense to omit w
from the drag law, so that it dissipates hydrostatic kinetic energy. But I guess the most important thing is that there should be no measurable difference between sqrt(u^2 + v^2 + w^2)
and sqrt(u^2 + v^2)
in a hydrostatic model, so w
shouldn't be needed to impose drag, right?
It might make sense to follow @simone-silvestri's suggestion and include all fields in
field_dependencies
. That would open up more options for forcing in general, esp usingauxiliary_fields
.
Just to make sure I understand correctly: you're talking about expanding the use of the already-existing keyword argument field_dependencies
to include not only prognostic fields (which apparently is the current status), but all fields.
If that's correct, I don't see why not. It'd make the code more flexible.
I believe we used to include "all fields" (meaning, prognostic fields and some diagnostic fields like pressures, diffusivities, and perhaps vertical velocity). However, diffusivities associated with tuples of closures created issues. Perhaps if we include "velocities, tracers, and auxiliary fields", we will be in a good place. I think we should provide the same list of fields to forcing functions as well as boundary conditions so that API behavior is easier to remember.
The reason not to include more fields is #2700.
Velocities, tracers, and auxiliary fields seems pretty good already. I completely agree with this.
In light of #2700, let's make sure we have a good reason / sustainable strategy for adding this potentially expensive feature.
@tomchor is this still an issue?
Just tested it and it runs fine:
julia> run!(simulation)
[ Info: Initializing simulation...
[ Info: ... simulation initialization complete (11.290 seconds)
[ Info: Executing initial time step...
[ Info: ... initial time step complete (26.266 seconds).
[ Info: Simulation is stopping after running for 41.963 seconds.
[ Info: Model iteration 10 equals or exceeds stop iteration 10.
When I run the following MWE:
I get the following error:
I'm not very familiar with hydrostatic models. Is this a bug or am I missing something?