Reference

Contents

Index

Core Documentation

TethysChlorisCore.ODEOptions — Type
ODEOptions <: AbstractODEOptions

Fields

  • abstol::AbstractFloat: Absolute tolerance for the ODE solver (default: 1e-6)
  • reltol::AbstractFloat: Relative tolerance for the ODE solver (default: 1e-3)

Notes

The default values for the absolute and relative tolerances are chosen to replicate the behavior of the MATLAB odeset defaults.

source
TethysChlorisCore.StreamTask — Type
StreamTask

Precomputed per-variable save task for a manager's flat hot loop: the source instance, the extractor, the slot buffer and the NetCDF variable handle are all captured at task-creation time. The per-timestep loop then does one call per task — no reflection, no dict lookups, no string allocation.

A task set is stepped as for t in tasks; x = t.extract(t.source); isnothing(x) || store_task!(t, x, slot); end and flushed with flush_tasks!. make_task builds tasks from variable handles.

Fields

  • source: component-set instance supplying the values
  • extract: x -> value for the source instance
  • buf: slot buffer, shaped by the variable layout
  • var: target NetCDF variable
  • timelast::Bool: true when the time-like dimension of the variable is trailing
source
TethysChlorisCore.TimeBuffers — Type
TimeBuffers(; buffer_len = 32)

In-memory per-variable step buffers for streamed NetCDF writing. Writing hundreds of small NetCDF variables at every timestep is prohibitive with the HDF5 backend, so values are buffered for at most buffer_len timesteps and written chunk-wise. Entries are allocated lazily on first store_buffer! (or in advance with init_buffers!).

Fields

  • buffers::Dict{Tuple{String,Symbol},TimeEntry}: buffer entry per variable
  • buffer_len::Int: number of buffered timesteps per flush
  • fill::Int: slots filled since the last flush
source
TethysChlorisCore.TimeEntry — Type
TimeEntry{V}

Single slot buffer for one streamed variable: the in-RAM buffer plus its layout.

Fields

  • buf::V: slot buffer; variables whose time-like dimension comes first are shaped (buffer_len, dims...), variables with a trailing time/naver dimension are shaped (dims..., buffer_len)
  • timelast::Bool: true when the time-like dimension of the variable is trailing
source
TethysChlorisCore.VariableSpec — Type
VariableSpec

Specification of a single output variable streamed by the writers built on this module.

Fields

  • name::Symbol: NetCDF variable name
  • group::Symbol: component/subsystem of the source (e.g. :hydrologic, :meteorological)
  • source::Symbol: top-level source set (e.g. :state, :auxiliary, :forcing, :parameters, :derived)
  • dims::Vector{Symbol}: trailing dimensions of the saved values, left empty by the spec enumeration and filled from the extracted shapes
  • acc_op::Symbol: :mean | :sum accumulation of time-average-style groups
  • extractor::Function: x -> raw field value for a component-set instance x
source
TethysChlorisCore.ZeroFindingStrategies — Type
ZeroFindingStrategies{M} <: AbstractZeroFindingStrategies

Fields

  • method::M: Method for root finding
  • kwargs::NamedTuple: Keyword arguments for the root finding method

Example

strategy = SimpleBrentStrategy(Float64; abstol=1e-8, reltol=1e-6, maxiters=500)
source
TethysChlorisCore.SimpleBrentStrategy — Method
function SimpleBrentStrategy(
    ::Type{FT};
    abstol::Union{FT,Missing}=missing,
    reltol::Union{FT,Missing}=missing,
    maxiters::Union{Signed,Missing}=missing,
) where {FT<:AbstractFloat}

Creates a ZeroFindingStrategies object using the Simple Brent method from the BracketingNonlinearSolve.jl package.

Arguments

  • ::Type{FT}: Floating point type for the root finding method (e.g., Float32 or Float64)
  • abstol::Union{FT,Missing}: Absolute tolerance for the root finding. If missing, the default value for the method is used.
  • reltol::Union{FT,Missing}: Relative tolerance for the root finding. If missing, the default value for the method is used.
  • maxiters::Union{Signed,Missing}: Maximum number of iterations. If missing, the default value for the method is used.
source
TethysChlorisCore._default_tolerances_simple — Method
default_tolerances(
    method::M,
    ::Type{FT},
) where {FT<:AbstractFloat}

Get default tolerances for SimpleNonlinearSolve.jl and BracketingNonlinearSolve.jl methods. The default tolerances are hard-coded based on the documentation of NonlinearSolve.jl.

Arguments

  • method::M: The root-finding method
  • ::Type{FT}: Floating point type

Returns

  • (abstol, reltol, maxiters): Tuple containing the default absolute tolerance, relative tolerance, and maximum iterations
source
TethysChlorisCore.add_variable! — Method
add_variable!(parent, name, FT, dims; chunksizes, compress, attrib, fillvalue)

Add a NetCDF variable with NaN fill value. Variable-dependent dimensions must exist beforehand; an unlimited time or naver dimension switches storage to chunked with the given chunksizes, and compress enables deflate level 4.

source
TethysChlorisCore.assign_average_slice! — Method
assign_average_slice!(var, acc, idx, reshape_dims...)

Reshape the accumulator acc to reshape_dims and assign it into variable var at index idx of its trailing (naver-like) dimension.

source
TethysChlorisCore.assign_slice! — Method
assign_slice!(v, x, tidx)

Assign one value or slice of x into variable v at index tidx, dispatching on the rank of x for variables whose time dimension comes first.

source
TethysChlorisCore.axis_names — Method
axis_names(shape; known = (;)) -> Vector{Symbol}

Trailing axis symbols for a value of shape shape. known is an ordered name-length named tuple; each axis takes the first unused name whose length matches, otherwise axisL. Names never repeat within one variable. The axes are supplied by the caller (e.g. model attributes such as layer and crown-area counts), so no axis naming is hardcoded here.

source
TethysChlorisCore.check_extraneous_fields — Method
check_extraneous_fields(::Type{T}, data::Dict{String,Any}) where {T<:AbstractModelComponent}

Check if the input dictionary contains any keys that are not part of the required fields for type T.

Arguments

  • T: Type of model component to check fields against
  • data: Dictionary containing fields to validate
  • required_fields: List of required fields for the model component. This is typically obtained from get_required_fields(T) or fieldnames(T)

Throws

  • ArgumentError: If any extraneous keys are found in the data dictionary
source
TethysChlorisCore.chunksizes — Method
chunksizes(dimspecs; time_chunk = 32, naver_chunk = 1) -> Tuple

Chunk sizes for a NetCDF variable whose dimensions are given as ordered (name, size) pairs. Dimensions named :time or :days (unlimited) get time_chunk; dimensions named :naver get naver_chunk.

source
TethysChlorisCore.domain_stats — Method
domain_stats(values, ::Type{FT}) -> (means, stds)

NaN-aware means and standard deviations (N−1) of an array reduced over its first (instance) axis. Scalar inputs return a single pair.

source
TethysChlorisCore.find_root — Method
find_root(
    f,
    x0,
    strategy::ZeroFindingStrategies{M};
    search_range = 10.0,
) where {M}

Wrapper function to find a root of the function f using the specified strategy, given an initial guess x0. Current implementation uses bracketing-based SimpleNonlinearSolve.jl` strategies.

Arguments

  • f: Function for which to find a root
  • x0: Initial guess for the root
  • strategy::ZeroFindingStrategies{M}: Strategy for root finding
  • search_range: Optional search range for bracketing methods (default: nothing)
source
TethysChlorisCore.flush_buffers! — Method
flush_buffers!(tb, getvar, window) -> Bool

Write all buffered values into their NetCDF variables. getvar(group, name) returns the variable handle; window is the timestep range covered by the buffered slots. The entries are kept allocated and reused across flushes; every store overwrites the full slot, so stale slots are never flushed. Returns whether anything was flushed.

source
TethysChlorisCore.flush_tasks! — Method
flush_tasks!(tasks, window) -> Bool

Write every task's buffered slots into its NetCDF variable; window is the timestep range covered by the buffered slots. Returns whether anything was flushed.

source
TethysChlorisCore.get_calculated_fields — Method
get_calculated_fields(::Type{T}) where {T<:AbstractModelComponent}

Get a list of calculated fields for a given model component type. Calculated fields are those that are computed based on other fields and should not be provided when creating a model component. By default, returns an empty list. Components should override this method if they have calculated fields.

Arguments

  • T: Type of model component to get calculated fields for

Returns

  • Vector{Symbol}: List of calculated field names
source
TethysChlorisCore.get_dimensions — Method
get_dimensions(::Type{T}, data) where {T<:AbstractModelComponent}

Return a dictionary of dimension specifications for a given model component type. By default returns an empty dictionary. This method should be overridden by concrete types to specify their required dimensions.

Arguments

  • T: Type of the model component
  • data: Data source containing dimension information

Returns

  • Dict: Dictionary mapping variable names to their dimension specifications
source
TethysChlorisCore.get_optional_fields — Method
get_optional_fields(::Type{T}) where {T<:AbstractModelComponent}

Get a list of optional fields for a given model component type. Optional fields are those that can be omitted when creating a model component. By default, returns an empty list. Components should override this method if they have optional fields.

Arguments

  • T: Type of model component to get optional fields for

Returns

  • Vector{Symbol}: List of optional field names
source
TethysChlorisCore.get_required_fields — Method
get_required_fields(::Type{T}) where {T<:AbstractModelComponent}

Returns an empty array of symbols representing required fields for a given AbstractModelComponent type. This is a default method that can be specialized for specific subtypes that need to define their own required fields.

Returns

  • Vector{Symbol}: A vector of symbols with the fields required to initialize the AbstractModelComponent type
source
TethysChlorisCore.initialize — Method
initialize(
    ::Type{FT}, ::Type{T}, data, params::Tuple=(FT,), args...
) where {FT<:AbstractFloat, T<:AbstractModelComponent}

Initialize model components with optional fields. The model component requires a keyword constructor.

Arguments

  • ::Type{FT}: Floating point precision type (e.g., Float32 or Float64)
  • ::Type{T}: Component type constructor that subclasses AbstractModelComponent
  • data: Data source (e.g., Dict for Parameters, NCDataset for State/Auxiliary variables)
  • params: Tuple of parameters for the model component
  • args...: Additional arguments passed to preprocess_fields

Returns

  • T{FT}: Initialized component struct of type T with floating point precision FT
source
TethysChlorisCore.initialize_field — Method
initialize_field(
    ::Type{FT},
    data::NCDataset,
    name::String,
    dims::Tuple;
    default::Union{Nothing,Number} = nothing
) where {FT<:AbstractFloat}

Initialize a field array with specified dimensions and optionally set initial conditions.

Arguments

  • FT: Float type to use for the field array (e.g., Float32, Float64)
  • data: NCDataset containing source data
  • name: Name of the variable in the dataset
  • dims: Tuple specifying the dimensions of the field array
  • default: Optional default value to use if no initial condition is found

Returns

  • Array{FT}: Initialized array with the specified dimensions, filled with initial conditions if available
source
TethysChlorisCore.make_task — Method
make_task(getvar, group, name, source, extract, buffer_len, ::Type{FT}) -> StreamTask

Build a StreamTask for variable (group, name), allocating its slot buffer eagerly from the variable's shape.

source
TethysChlorisCore.output_specs — Method
output_specs(::Type{T}, ::Type{OL}; source = :state) -> Vector{VariableSpec}

Enumerate the VariableSpecs that the outputs_to_save traits select for the component set type T at output level OL (pass the level instance type, e.g. AllOutputs, NoBiogeochemistryOutputs).

The traversal is generic over any user-defined set: define outputs_to_save for the set type and its nested components to select which fields to save. Fields of components with both a high and a low field receive the _H/_L suffixes. Components with no outputs_to_save defined for the level are skipped (strict mode). On name collisions between output levels, the less restrictive level wins (decreasing recursion order).

The returned extractors take a component-set instance and return the raw field value; the trailing dims are left empty for the writer to fill from the shapes. Boolean, string and other non-numeric leaves are left to the writer to drop.

source
TethysChlorisCore.outputs_to_save — Method
outputs_to_save(::Type{T}, ::Type{O}) where {T, O <: AbstractOutputsToSave}

Get the outputs to save for type T corresponding to the outputs level O.

This function is called recursively at each level of the type hierarchy to enable fine-grained control over which fields to save. For types with height-dependent structure (containing both :high and :low fields), this function is called at multiple levels:

  1. At the parent level: returns which components to include (e.g., (:scalar_field, :high, :low))
  2. At the height-dependent level: returns which fields from the nested type (e.g., (:field1,))

The accessor system uses these specifications to create accessor functions with appropriate suffixes for height-dependent fields (_H for high, _L for low).

Arguments

  • T::Type{T}: The model component type
  • O::Type{O}: The outputs to save type (subtype of AbstractOutputsToSave)

Returns

  • Tuple{Vararg{Symbol}}: Tuple of field names to save from type T
  • Empty tuple () means no fields from this type (strict mode: no accessors created)

Strict Mode

If outputs_to_save returns () for a type that has been selected at a parent level, no accessors will be created for that component. This requires explicit specification of which fields to save at each level of the hierarchy.

Examples

# Example type hierarchy
struct HeightDependentHydrologicStateVariables{FT}
    field1::Vector{FT}
    field2::Vector{FT}
    field3::Vector{FT}
end

struct HydrologicStateVariables{FT}
    scalar_field::Vector{FT}
    high::HeightDependentHydrologicStateVariables{FT}
    low::HeightDependentHydrologicStateVariables{FT}
end

struct StateVariableSet{FT}
    hydrologic::HydrologicStateVariables{FT}
end

# Define output levels
struct SimpleOutputs <: AbstractOutputsToSave end
struct ExtendedOutputs <: AbstractOutputsToSave end

# Level 1: Select which top-level components
outputs_to_save(::Type{StateVariableSet}, ::Type{SimpleOutputs}) = (:hydrologic,)

# Level 2: Select which fields from the component (including :high, :low)
outputs_to_save(::Type{HydrologicStateVariables}, ::Type{SimpleOutputs}) =
    (:scalar_field, :high, :low)

# Level 3: Select which fields from height-dependent component
outputs_to_save(::Type{HeightDependentHydrologicStateVariables}, ::Type{SimpleOutputs}) =
    (:field1,)

# For ExtendedOutputs, include more fields at level 3
outputs_to_save(::Type{HeightDependentHydrologicStateVariables}, ::Type{ExtendedOutputs}) =
    (:field1, :field2)

# Result for SimpleOutputs:
# Dict(:hydrologic => Dict(:scalar_field => fn, :field1_H => fn, :field1_L => fn))

# Result for ExtendedOutputs:
# Dict(:hydrologic => Dict(:scalar_field => fn, :field1_H => fn, :field1_L => fn,
#                          :field2_H => fn, :field2_L => fn))

Independent Control

Direct fields (not in :high/:low) and height-dependent fields can be controlled independently:

# Include only direct fields, no height layers
outputs_to_save(::Type{HydrologicStateVariables}, ::Type{DirectOnly}) = (:scalar_field,)

# Include only height layers, no direct fields
outputs_to_save(::Type{HydrologicStateVariables}, ::Type{HeightOnly}) = (:high, :low)
outputs_to_save(::Type{HeightDependentHydrologicStateVariables}, ::Type{HeightOnly}) = (:field1,)

# Include only high layer, not low
outputs_to_save(::Type{HydrologicStateVariables}, ::Type{HighOnly}) = (:scalar_field, :high)
outputs_to_save(::Type{HeightDependentHydrologicStateVariables}, ::Type{HighOnly}) = (:field1,)

Note

This function is expected to be overloaded for specific types and output levels. The default implementation returns an empty tuple ().

source
TethysChlorisCore.preprocess_fields — Method
preprocess_fields(::Type{FT}, ::Type{T}, data, args...) where {FT<:AbstractFloat,T<:AbstractModelComponent}

Preprocess fields before the initialization of a given AbstractModelComponent type.

Arguments

  • FT: Type parameter for floating point precision
  • T: Type parameter for model components
  • data: Input data to be preprocessed
  • params: Tuple of parameters for the model component
  • args...: Additional arguments

Returns

  • Returns the input data without modifications

This is a default implementation that passes through the input data unchanged. Custom preprocessing can be implemented by defining methods for specific types.

source
TethysChlorisCore.preprocess_fields — Method
preprocess_fields(
    ::Type{FT},
    ::Type{T},
    data::NCDataset
) where {FT<:AbstractFloat,T<:AbstractAuxiliaryVariables}

Initialize fields for auxiliary variables based on their dimension specifications.

Arguments

  • FT: Float type to use for the fields
  • T: Type of auxiliary variables
  • data: NCDataset containing the source data

Returns

  • Dict{String,Any}: Dictionary of initialized fields
source
TethysChlorisCore.storage_frequency — Method
storage_frequency(::Type{T}) where {T <: AbstractModelComponent}

Return the storage frequency for component type T.

This trait function determines how often component outputs should be stored during simulation. Components can be stored at different temporal frequencies:

  • HourlyStorage(): Store values every timestep (hourly data)
  • DailyStorage(): Store values once per day (daily aggregates)
  • NoStorage(): Do not store this component (default)

Default Behavior

By default, components return NoStorage(), implementing an opt-in approach where only components with explicitly defined storage frequencies will be saved.

Examples

# Define storage frequency for specific component types
storage_frequency(::Type{HydrologicState}) = hourly_storage
storage_frequency(::Type{VegetationState}) = daily_storage
storage_frequency(::Type{AuxiliaryVariables}) = no_storage  # Not stored

# Components without explicit definitions default to no_storage
storage_frequency(::Type{SomeOtherComponent})  # Returns no_storage
source
TethysChlorisCore.storage_size — Method
storage_size(frequency::AbstractStorageFrequency, n_timesteps::Int) -> Int

Calculate the required array size based on storage frequency and total timesteps.

Arguments

  • frequency::AbstractStorageFrequency: The storage frequency (Hourly, Daily, or NoStorage)
  • n_timesteps::Int: Total number of hourly timesteps in the simulation

Returns

  • Int: The required array size for the given frequency

Sizing Logic

  • HourlyStorage: n_timesteps (one entry per hourly timestep)
  • DailyStorage: div(n_timesteps, 24, RoundUp) + 2 (one entry per day plus buffer)
  • NoStorage: 0 (no storage needed)

Daily Storage Buffer

The +2 buffer in daily storage provides extra space for:

  • Index 1: Initialization values
  • Index N+1: Boundary/final day handling

This matches the pattern used in TethysChloris.jl for consistency.

Examples

# Hourly storage for 720 timesteps (30 days)
storage_size(HourlyStorage(), 720)  # Returns 720

# Daily storage for 720 timesteps (30 days)
storage_size(DailyStorage(), 720)   # Returns 32 (30 days + 2 buffer)

# Daily storage for 721 timesteps (30 days + 1 hour)
storage_size(DailyStorage(), 721)   # Returns 33 (31 days + 2 buffer, rounded up)

# No storage
storage_size(NoStorage(), 1000)     # Returns 0
source
TethysChlorisCore.store_buffer! — Method
store_buffer!(tb, getvar, group, name, x, slot, ::Type{FT})

Store one value for variable (group, name) in the buffer at slot slot. The entry is fetched through a single dictionary lookup; the variable handle is only used through getvar(group, name) on lazily-init (shape and layout).

source
TethysChlorisCore.validate_fields — Method
validate_fields(::Type{T}, data) where {T<:AbstractModelComponent}
validate_fields(::Type{T}, data::Dict{String,Any}) where {T<:AbstractModelComponent}

Performs some checks on the fields passed to initialize the AbstractModelComponent type.

Returns

  • nothing: If all fields are valid, the function returns nothing
source

Model Components

TethysChlorisCore.ModelComponents.AbstractIndividualModelComponent — Type
AbstractIndividualModelComponent{FT<:AbstractFloat} <: AbstractModelComponent{FT}

Abstract type for individual model components that represent discrete entities in the model. These components operate on single points or objects without height-dependency.

Subtypes include parameters, state variables, forcing inputs, and auxiliary variables for individual model elements.

source
TethysChlorisCore.ModelComponents.AbstractHeightDependentModelComponent — Type
AbstractHeightDependentModelComponent{FT<:AbstractFloat} <: AbstractIndividualModelComponent{FT}

Abstract type for model components that vary with height or depth in a vertical profile. These components represent quantities that change along a vertical dimension and typically contain values at different height/depth levels.

source
TethysChlorisCore.ModelComponents.AbstractModelComponentSet — Type
AbstractModelComponentSet{FT<:AbstractFloat} <: AbstractModelComponent{FT}

Abstract type for collections of related model components. Component sets group multiple individual components of the same category together, providing organization and encapsulation of related model elements.

source

Auxiliary variables

TethysChlorisCore.ModelComponents.AbstractAuxiliaryVariableSet — Type
AbstractAuxiliaryVariableSet{FT<:AbstractFloat} <: AbstractModelComponentSet{FT}

Abstract type for collections of auxiliary variables. Auxiliary variable groups multiple auxiliary variables together, providing organization and encapsulation of related model elements.

Examples

Base.@kwdef struct HeightDependentHydrologicStateVariables{FT<:AbstractFloat} <:
                   AbstractHeightDependentModelComponent{FT}
    An::Matrix{FT} # Net CO₂ assimilation [μmol m⁻² s⁻¹]
    Dr::Matrix{FT} # Root distribution [-]
end

Base.@kwdef struct HydrologicAuxiliaryVariables{FT<:AbstractFloat} <:
                   AbstractAuxiliaryVariables{FT}
    high::HeightDependentHydrologicStateVariables{FT}
    low::HeightDependentHydrologicStateVariables{FT}

    alp_soil::Vector{FT} # Soil albedo [-]
    b_soil::Vector{FT} # Soil retention curve parameter [-]
end

Base.@kwdef struct BiogeochemistryAuxiliaryVariables{FT<:AbstractFloat} <:
                   AbstractAuxiliaryVariables{FT}
    BLit::Matrix{FT}
    NavlI::Matrix{FT}
end

Base.@kwdef struct AuxiliaryVariableSet{FT<:AbstractFloat} <:
                   AbstractAuxiliaryVariableSet{FT}
    hydrologic::HydrologicAuxiliaryVariables{FT}
    biogeochemistry::BiogeochemistryAuxiliaryVariables{FT}
end
source

Forcing inputs

TethysChlorisCore.ModelComponents.AbstractForcingInputSet — Type
AbstractForcingInputSet{FT<:AbstractFloat} <: AbstractModelComponentSet{FT}

Abstract type for collections of forcing inputs. Forcing input sets group multiple forcing inputs together, providing organization and encapsulation of related model elements.

Examples

Base.@kwdef struct AnthropogenicInputs{FT<:AbstractFloat} <: AbstractForcingInputs{FT}
    Salt::Vector{FT} # Salt concentration
    IrD::Vector{FT} # Drip irrigation
end

Base.@kwdef struct MeteorologicalInputs{FT<:AbstractFloat} <: AbstractForcingInputs{FT}
    Pr::Vector{FT} # Precipitation
    Ta::Vector{FT} # Air temperature at reference height
    Ws::Vector{FT} # Wind speed at reference height
end

Base.@kwdef struct ForcingInputSet{FT<:AbstractFloat} <: AbstractForcingInputSet{FT}
    anthropogenic::AnthropogenicInputs{FT}
    meteorological::MeteorologicalInputs{FT}
end
source

Parameters

TethysChlorisCore.ModelComponents.AbstractParameterSet — Type
AbstractParameterSet{FT<:AbstractFloat} <: AbstractModelComponentSet{FT}

Abstract type for collections of model parameters. Parameter sets group multiple parameters together, providing organization and encapsulation of related model elements.

Examples


Base.@kwdef struct SoilParameters{FT<:AbstractFloat} <: AbstractParameters{FT}
    Osat::FT # Saturation moisture 0 kPa
    Ohy::FT # Hygroscopic Moisture Evaporation cessation 10000 kPa
end

Base.@kwdef struct HeightDependentVegetationParameters{FT<:AbstractFloat} <:
                   AbstractHeightDependentParameters{FT}
    Knit::FT # Canopy nitrogen decay coefficient
    FI::FT # Intrinsic quantum efficiency
end

Base.@kwdef struct VegetationParameters{FT<:AbstractFloat} <: AbstractParameters{FT}
    high::HeightDependentParameters{FT}
    low::HeightDependentParameters{FT}

    KcI::FT # Interception drainage rate coefficient.
    Sllit::FT # Specific leaf area of litter

end

Base.@kwdef struct ParameterSet{FT<:AbstractFloat} <: AbstractParameterSet{FT}
    soil::SoilParameters{FT}
    vegetation::VegetationParameters{FT}
end
source

State variables

TethysChlorisCore.ModelComponents.AbstractStateVariableSet — Type
AbstractStateVariableSet{FT<:AbstractFloat} <: AbstractModelComponentSet{FT}

Abstract type for collections of model state variables. State variable sets group multiple state variables together, providing organization and encapsulation of related model elements.

Examples

Base.@kwdef struct HydrologicStateVariables{FT<:AbstractFloat} <:
                   AbstractStateVariables{FT}

    V::Matrix{FT} # Liquid water volume [mm]
    Tdp::Matrix{FT} # Soil temperature [°C]
end

Base.@kwdef struct HeightDependentVegetationStateVariables{FT<:AbstractFloat} <:
                   AbstractHeightDependentModelComponent{FT}
    AgeDL::Matrix{FT} # Average age of dead leaves
    B::Matrix{FT} # Biomass/carbon pools
end

Base.@kwdef struct VegetationStateVariables{FT<:AbstractFloat} <:
                   AbstractStateVariables{FT}
    high::HeightDependentVegetationStateVariables{FT}
    low::HeightDependentVegetationStateVariables{FT}
end

Base.@kwdef struct StateVariableSet{FT<:AbstractFloat} <:
                   AbstractStateVariableSet{FT}
    hydrologic::HydrologicStateVariables{FT}
    vegetation::VegetationStateVariables{FT}
end
source