-
Notifications
You must be signed in to change notification settings - Fork 4
Description
One of the drawbacks of the CryoGrid.jl interface for modular specification of state variables, i.e:
variables(::SoilEnergyBalance) = (
prognostic(:temperature, XYZ(), units=u"°C", desc="Temperature of the grid cell in °C"),
...
)is that it relies on the developer "just knowing" the state variable naming conventions and results in possible redundant or conflicting metadata (i.e. units, description, bounds, etc.) when implementing multiple processes across different models or components.
We could ameliorate this by creating a kind of state variable "registry" where the abstract variables are defined, and then only specify them as prognostic, auxiliary, etc. in the variables method for each component. I think SINDBAD does something like this, although there the variable registry seems to be primarily a UX feature and is not used in the actual model/process definitions...? @dr-ko can maybe clarify.
Anyway, we would add something like:
const SoilVars = map(to_namedtuple, (
statevar(:temperature, units=u"°C", desc="Temperature of the grid cell in °C"),
statevar(:saturation_water_ice, bounds=0..1, desc="Saturation level of water/ice in the soil pore space"),
...
))and then implement variables as:
variables(process::SoilEnergyBalance) = (
prognostic(SoilVars.temperature)
)@maximilian-gelbrecht and @mahabadri what do you think?