-
Notifications
You must be signed in to change notification settings - Fork 206
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
(0.95.7) Correctly account for field names in ContinuousBoundaryFunctions
#4008
base: main
Are you sure you want to change the base?
Changes from 11 commits
193efb7
1c20a5b
d1b83b4
ad802d9
7b7639d
999b195
a861a37
0e7dc4a
1d02b9b
d61187e
44fdd9f
1b90451
13d6d57
fd90c83
6ae4a6d
5a26ecf
6f28d5f
b591b45
6ab2279
6861ae5
b511529
39bcdca
c2da5ee
19ad053
f975fc0
d9c3177
7644409
52c248a
ddfdab0
e4d3867
d9fd965
4853626
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,9 +75,19 @@ Return a flattened `NamedTuple` of the fields in `model.velocities`, `model.free | |
`model.tracers`, and any auxiliary fields for a `HydrostaticFreeSurfaceModel` model. | ||
""" | ||
@inline fields(model::HydrostaticFreeSurfaceModel) = | ||
merge(hydrostatic_fields(model.velocities, model.free_surface, model.tracers), | ||
model.auxiliary_fields, | ||
biogeochemical_auxiliary_fields(model.biogeochemistry)) | ||
merge(hydrostatic_fields(model.velocities, model.free_surface, model.tracers), model.auxiliary_fields) | ||
|
||
""" | ||
field_names(model) | ||
|
||
Return a tuple of the field names associated with `HydrostaticFreeSurfaceModel`. | ||
Equivalent to doing `keys(fields(model))`. | ||
""" | ||
@inline field_names(model::HydrostaticFreeSurfaceModel) = field_names(model.free_surface, tracernames(model.tracers), model.auxiliary_fields) | ||
|
||
@inline field_names(free_surface, tracernames, auxiliary_fields) = (:u, :v, :w, tracernames..., :η, keys(auxiliary_fields)...) | ||
@inline field_names(::Nothing, tracernames, auxiliary_fields) = (:u, :v, :w, tracernames..., keys(auxiliary_fields)...) | ||
@inline field_names(::SplitExplicitFreeSurface, tracernames, auxiliary_fields) = (:u, :v, :w, tracernames..., :η, :U, :V, keys(auxiliary_fields)...) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is a bad idea. I think that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need something to regularize the boundary conditions, so we need some names that correspond to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have changed the design for the |
||
|
||
""" | ||
prognostic_fields(model::HydrostaticFreeSurfaceModel) | ||
|
@@ -111,11 +121,11 @@ Return a flattened `NamedTuple` of the prognostic fields associated with `Hydros | |
|
||
@inline hydrostatic_fields(velocities, free_surface::SplitExplicitFreeSurface, tracers) = merge((u = velocities.u, | ||
v = velocities.v, | ||
w = velocities.w, | ||
η = free_surface.η, | ||
U = free_surface.barotropic_velocities.U, | ||
V = free_surface.barotropic_velocities.V), | ||
tracers) | ||
w = velocities.w), | ||
tracers, | ||
(; η = free_surface.η, | ||
U = free_surface.barotropic_velocities.U, | ||
V = free_surface.barotropic_velocities.V)) | ||
|
||
@inline hydrostatic_fields(velocities, ::Nothing, tracers) = merge((u = velocities.u, | ||
v = velocities.v, | ||
|
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 am a bit confused about this function. I think that the biogeochemical auxiliary fields have been added to the
auxiliary_fields
during model construction, so we shouldn't need an extrabiogeochemical_auxiliary_fields(model.biogeochemistry)
here right? @jagoosw is it true?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.
no, the biogeochemistry struct is allowed to have extra auxiliary fields that are not attached to the model. Basically
model.auxiliary_fields
are purely for the user, whereasbiogeochemistry
can have its own auxiliary fields, much like the closure has auxiliary fields that are stored indiffusivity_fields
(which could be calledclosure_auxiliary_fields
).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.
Then I guess the implementation is bugged because It actually looks like the fields are added to the
auxiliary_fields
, and, thus they are accounted for twice in thefields
functionOceananigans.jl/src/Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surface_model.jl
Lines 131 to 133 in d8273e7