agate-model / Agate.jl

A Julia library to build flexible and composable aquatic ecosystems.
MIT License
5 stars 0 forks source link

Decide how to best allow user to specify auxiliary fields #53

Open radka-j opened 6 days ago

radka-j commented 6 days ago

Note that a BGC model needs to have a biogeochemical_auxiliary_fields method that returns a NamedTuple of the form (field_name = Oceananigans Field object,...).

Currently, in Agate the user can add auxiliary field names (e.g., PAR) when creating a model but they don't actually pass the field specification anywhere. Instead, we create the PAR field within the run_box_model function and the biogeochemical_auxiliary_fields method is defined within the OceanBioME.Biogeochemistry object instantiated within that function.

This is clearly suboptimal. Either, the user should actually define auxiliary fields in the model specification or we should not let them append aux field variable names to the model and instead handle everything inside a wrapper like run_box_model.

radka-j commented 6 days ago

Really the user should be specifying an Oceananigans grid (0D, 1D, 2D or 3D) and then define a function for each field which is also defined on that grid.

radka-j commented 5 days ago

We could implement an additional add_auxiliary_fields method that adds things like PAR and we could rename add_bgc_methods to add_tracers.

An issue with this is that the tracer methods have to include auxiliary fields as inputs so the variables have to defined beforehand. But maybe we can redefine the functions within the add_auxiliary_fields call?