-
Notifications
You must be signed in to change notification settings - Fork 186
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
"Dimension-aware" behavior of set!
and interior
with Flat
directions?
#1655
Comments
Great idea and I needless to say I'm in favour. |
@navidcy @ali-ramadhan any comments? This would change examples and API, because if |
I think this makes absolute sense. If one sets up a 2D grid then they can't be imposing 3D initial conditions/forcing functions. :) This change will allow this if I understood correctly, right? |
Correct. |
@simone-silvestri thoughts about this? Major API change so maybe we want to do it sooner rather than later. I'm not sure if this will affect ensemble models. I don't think it will but I'm not sure. We probably want to wait until after #2246 . |
Hmmm, will the underlying data of a field be 2D and/or 1D in that case? I think that will be extremely intrusive in the code. In conclusion... if you want to make it an API change (i.e. a change only in the location which will require an extension in |
All data is always 3D, even when a field has Oceananigans.jl/src/Grids/new_data.jl Lines 58 to 65 in b3ddbc8
and Oceananigans.jl/src/Grids/grid_utils.jl Line 110 in b3ddbc8
In other words, fields with This change therefore likely affects There is an exception for Oceananigans.jl/src/Grids/grid_utils.jl Lines 111 to 113 in b3ddbc8
My main concern in fact for this change is how it might affect ensemble models. It shouldn't matter but we may have used a few cheats here and there regarding field location in An alternative strategy, which might actually be better (now that I think about it), is to predicate alternative behavior for functions like |
I guess the way this goes down is via these functions:
Oceananigans.jl/src/Fields/function_field.jl Lines 57 to 59 in b3ddbc8
that's why Oceananigans.jl/examples/geostrophic_adjustment.jl Lines 73 to 77 in b3ddbc8
is 2D for the free surface. This'll affect #2246 . |
Ok, now I realize that we actually can't do this because it will probably prevent GPU compilation. I'll change this issue to a discussion of behavior changes for |
AbstractField
locations in Flat
dimensions to Nothing
?set!
and interior
with Flat
directions?
We changed |
EDIT: We can't set the locations of all
Field
toNothing
. So I'm changing this issue topic to a discussion of whether we should support 1- and 2-argument functions forset!
(when 2 or 1 directions areFlat
), and alsodropdims
theFlat
dimensions ininterior
.Previously:
This would allow us to use two- or one-argument function specification in
set!
, as well as two- and two-dimensional indexing.It might also make sense to
dropdims
Nothing
locations when outputting raw field data... (it makes broadcasting with reduced fields, etc more difficult, but probably makes most activities easier, like plotting)... ?This would automagically solve @francispoulin's pain provided that
Flat
vertical topologies are enforced in the constructor forShallowWaterModel
.The text was updated successfully, but these errors were encountered: