- 
                Notifications
    You must be signed in to change notification settings 
- Fork 250
Move AbstractModel interface to top level and add docstrings #4798
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
base: main
Are you sure you want to change the base?
Conversation
| @glwagner Are you OK with moving the model interface methods out of the  | 
| TODO | ||
| """ | ||
| total_velocities(model::AbstractModel) = nothing | 
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.
Not really well defined at the moment. It returns the sum of background + prognostic velocities for the non hydrostatic model and the prognostic velocities in the hydrostatic model
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.
Updated in be79014
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 don't think "velocities" should be intrinsic to the concept of a model.
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 agree, but I didn't want to rock the boat too much.
        
          
                src/Oceananigans.jl
              
                Outdated
          
        
      | Models are required to have the following fields: | ||
| - `model.clock::Clock` | ||
| - `model.architecture` | ||
| - `model.timestepper` with `timestepper.G⁻` and `timestepper.Gⁿ` | 
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 don't think we want to assume a timestepper: the OceanSeaIceModel does not have a timestepper
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.
and timestepper.G⁻ is an AB2-specific field
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.
Removed in be79014
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.
What about the timestepper method?
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 don't think we need it. It is used only in the reset!(::AbstractModel) method, which should know wether we have a timestepper or not.
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, actually it is currently used in the initialize!(simulation) step... But this should call initialize!(model) and not reset!(timestepper(model))
Co-authored-by: Simone Silvestri <[email protected]>
| I think there needs to be some thought / intentionality about what functions belong to a "generic model" interface, versus what functions are only associated with  
 To develop the scope of models I would consider the following cases: 
 The big danger is that we go in the opposite direction that we have been generally striving for --- a simple, useful interface which is disentangled from the "finite volume" (grids, fields) part of the code. | 
| 
 Does this move us in the direction of being able to disentangle finite volume stuff (grids, fields, etc) from model implementation? What is your vision? Usually moving things to top-level acts to further entangle... | 
| @@ -1,5 +1,5 @@ | |||
| using Oceananigans: total_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.
I am wary of this. It's a hack to begin with and this sort of cements it. I think we want to go the other way...
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 the method in general, right? Or just the fact that it's at the top-level?
| function initialization_update_state!(model::AbstractModel; kw...) | ||
| initialize!(model) | ||
| update_state!(model; kw...) # fallback | ||
| end | 
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 think we will be able to get rid of initialization_update_state! soon FYI. It was introduced to support work with Reactant but I do not think it is needed anymore.
| Returns the `TimeStepper` used by the given `model`. | ||
| """ | ||
| timestepper(model::AbstractModel) = model.timestepper | 
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 wary of baking in the notion of a time stepper
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.
True. Is this used anywhere?
| I said this in a chat so I'll say it here so we can all discuss --- I think that the "definition" of a model belongs to the  I am not sure about all of the other functions. We have things like  At the top-level, I think we want to move towards an import order that looks somethin like 
 Then someday we may pull out 1 & 2 into another package. We could also have 3 packages (but that's probably overkill. Then, the "models" will basically be the only part of Oceananigans that remains (which makes sense --- ocean specific stuff). | 
Co-authored-by: Navid C. Constantinou <[email protected]>
Co-authored-by: Gregory L. Wagner <[email protected]>
Co-authored-by: Gregory L. Wagner <[email protected]>
Co-authored-by: Navid C. Constantinou <[email protected]>
Co-authored-by: Navid C. Constantinou <[email protected]>
Resolves #4797