Skip to content

Create central registry for state variable definitions #35

@bgroenks96

Description

@bgroenks96

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions