API Reference

Adapt.adaptMethod
Adapt.adapt(::NumberFormatAdaptor{NF}, obj) where {NF<:Number}

Adaptor that reconstructs arbitrary data structures with all numeric values converted to the specified number format NF.

source
Base.mergeMethod

Merges all of the given Variables containers into a single container.

source
Oceananigans.BoundaryConditions.getbcMethod
getbc(::Variable{name}, i::Integer, j::Integer, grid::Oceananigans.Grids.AbstractGrid, clock, fields) where {name}

Implementation of Oceananigans.BoundaryConditions.getbc for variable placeholders that retrieves the input Field from fields and returns the value at the given index.

source
Oceananigans.Simulations.run!Method
run!(integrator; steps, period, Δt)

Run the simulation for steps or a given time period with timestep size Δt (in seconds or Dates.Period).

source
Oceananigans.TimeSteppers.update_state!Method
update_state!(state::StateVariables, model::AbstractModel, inputs::InputSources; compute_tendencies = true)

Update the state for the given model and inputs; this includes calling update_inputs! and fill_halo_regions! followed by compute_auxiliary! and compute_tendencies!, if compute_tendencies = true.

source
Terrarium.AmbientCO2Method

Creates a TracerGas for ambient CO2 with concentration prescribed by an input variable with the given name.

source
Terrarium.FreeDrainageMethod

Alias for PrescribedGradient representing a Neumann-type zero pressure gradient at the bottom of the soil column, thereby allowing free drainage of water.

source
Terrarium.GeothermalHeatFluxFunction

Alias for FluxBoundaryCondition on internal_energy with name geothermal_heat_flux representing the geothermal heat flux at the bottom boundary of the soil column.

source
Terrarium.HomogeneousSoilStratigraphyMethod
HomogeneousSoilStratigraphy(
    ::Type{NF};
    texture,
    porosity
) -> SoilStratigraphy{NF, 1, Horizons} where {NF, Horizons<:Tuple{ConstantSoilHorizon{NF, _B, ConstantSoilPorosity{NF}} where _B}}

Convenience constructor that creates a SoilStratigraphy with a single ConstantSoilHorizon.

source
Terrarium.SoilGridsStratigraphyMethod
SoilGridsStratigraphy(
    ::Type{NF};
    porosity,
    horizon1,
    horizon2,
    horizon3,
    horizon4,
    horizon5,
    horizon6
) -> SoilStratigraphy{NF, 6, _B} where {NF, _B<:NTuple{6, Terrarium.AbstractSoilHorizon{NF}}}

Convenience constructor that creates a SoilStratigraphy with six horizons corresponding to the six depth intervals defined by the SoilGridsV2 dataset. The porosity parameterization is applied to all six default horizons; pass explicit horizon* arguments to override individual horizons (in which case porosity does not apply to those).

source
Terrarium.SoilHeatFluxFunction

Alias for FluxBoundaryCondition on internal_energy with name soil_heat_flux representing the net heat flux into the top of the soil column. Without snow this equals the surface energy balance ground_heat_flux; with snow it is the (blended) conductive flux across the snow base.

source
Terrarium._get_fields_exprMethod

Generation-time helper for get_fields. Given the type Vars of a tuple of AbstractVariables and Namespaces, builds an expression that retrieves all matching fields from state_ex (an expression evaluating to the state container) and vars_ex (an expression evaluating to the variable tuple). The recursion over namespaces is performed here, at expansion time, so that the generated body for get_fields contains no self-call. This is what makes the method type stable: a runtime self-recursive get_fields would otherwise trigger inference's recursion limiting and widen the return type of the nested namespace lookups to an abstract NamedTuple.

source
Terrarium.adjust_saturation_profile!Method
adjust_saturation_profile!(
    out,
    i,
    j,
    grid,
    hydrology::SoilHydrology{NF, VerticalFlow, SaturationClosure, SoilHydraulics} where {VerticalFlow<:Terrarium.AbstractVerticalFlow, SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})}
)

Kernel function that adjusts saturation profiles to account for oversaturation and undersaturation arising due to numerical error. This implementation scans over the saturation profiles at each lateral grid cell and redistributes excess water upward layer-by-layer until reaching the topmost layer, where any remaining excess water is added to the surface_excess_water pool.

source
Terrarium.aerodynamic_resistanceMethod
aerodynamic_resistance(i, j, grid, fields, atmos::PrescribedAtmosphere)

Compute the aerodynamic resistance (inverse conductance) at grid cell i, j.

source
Terrarium.aerodynamic_resistanceMethod
aerodynamic_resistance(
    i,
    j,
    grid,
    fields,
    atmos::Terrarium.AbstractAtmosphere,
    evapotranspiration::PALADYNCanopyEvapotranspiration{NF},
    _::Terrarium.AbstractVegetation
) -> Any

Compute the aerodynamic resistance between the ground and canopy as a function of LAI and SAI.

source
Terrarium.air_pressureMethod
air_pressure(i, j, grid, fields, ::PrescribedAtmosphere)

Retrieve or compute the air pressure at the current time step.

source
Terrarium.air_temperatureMethod
air_temperature(i, j, grid, fields, ::PrescribedAtmosphere)

Retrieve or compute the air temperature at the current time step.

source
Terrarium.albedoMethod
albedo(i, j, grid, fields, albedo::ConstantAlbedo) -> Any

Return the surface albedo at grid point i, j.

source
Terrarium.albedoMethod
albedo(i, j, grid, fields, ::AbstractAlbedo)

Return the current albedo at the given indices.

source
Terrarium.ambient_co2Method
ambient_co2(i, j, grid, fields, ::PrescribedAtmosphere)

Return the current prescribed ambient CO2 concentration level.

source
Terrarium.auxiliaryFunction
auxiliary(name, dims; ...)
auxiliary(name, dims, ctor; ...)
auxiliary(name, dims, ctor, params; units, bounds, desc)

Convenience constructor method for AuxiliaryVariable.

source
Terrarium.auxiliary_fieldsMethod
auxiliary_fields(state, components)

Retrieves all Fields from state corresponding to auxiliary variables defined on the given components.

source
Terrarium.canopy_evaporation_conductanceMethod
canopy_evaporation_conductance(
    _::PALADYNCanopyEvapotranspiration,
    f_can,
    rₐ
) -> Any

Compute the canopy evaporation vapor conductance [m/s] from canopy saturation fraction f_can and aerodynamic resistance rₐ. The canopy evaporation flux is this conductance times the humidity gradient.

source
Terrarium.canopy_waterFunction
canopy_water(i, j, grid, fields, ::AbstractCanopyInterception)

Compute or retrieve the current canopy water storage [m].

source
Terrarium.celsius_to_kelvinMethod
celsius_to_kelvin(c::ThermodynamicConstants, T)

Convert the given temperature in °C to Kelvin based on the constant temperature_water_freeze.

source
Terrarium.checkfinite!Function
checkfinite!(field)
checkfinite!(field, name)

Check whether the given field has any NaN or Inf values and raise an error if NaNs are detected.

source
Terrarium.closure!Method
closure!(
    state,
    grid,
    closure::SnowEnergyTemperatureClosure,
    snow::SingleLayerSnow,
    constants::PhysicalConstants,
    args...
)

Forward closure: recover snow_temperature and snow_liquid_fraction from the prognostic snow_energy.

source
Terrarium.closure!Method
closure!(state, grid, closure::AbstractClosureRelation, process, args...)

Apply closure for process on the given grid with additional implementation-specific args.

source
Terrarium.closure!Method
closure!(state, grid, proc::AbstractProcess, args...)

Apply the forward closure mappings for the process proc on the given grid with additional implementation-specific args defined by the coupling interface for the process type. The default implementation calls invclosure! with args for each closure returned by closures.

source
Terrarium.closure!Method
closure!(state, model::AbstractModel)

Apply all closure relations defined for the given model.

source
Terrarium.closure!Method
closure!(
    state,
    grid,
    closure::SoilSaturationPressureClosure,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    soil::Terrarium.AbstractSoil,
    args...
)

Computes pressure_head $Ψ = ψm + ψz + ψh$ from the current saturation_water_ice state.

source
Terrarium.closure_fieldsMethod
closure_fields(state, components)

Retrieves all Fields from state corresponding to closure variables defined on the given components.

source
Terrarium.closuresMethod
closures(proc::AbstractProcess)

Return a tuple of AbstractClosureRelations defined by the given processes type. Note that this is a type-stable, @generated function that is compiled for each argument type.

source
Terrarium.compute_APARMethod
compute_APAR(
    photo::LUEPhotosynthesis{NF},
    traits::PlantTraits{NF},
    swdown,
    LAI
) -> Any

Computes absorbed PAR limited by the fraction of PAR assimilated at ecosystem level APAR [mol/m²/s], [16, Eq. (62)].

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_AgMethod
compute_Ag(
    photo::LUEPhotosynthesis{NF},
    c_1,
    c_2,
    APAR,
    Vc_max,
    β
) -> Any

Computes the gross photosynthesis rate Ag [gC/m²/s], [17, Eq. (2)].

References

  • [17] Haxeltine & Prentice, Global Biogeochemical Cycles (1996)
source
Terrarium.compute_C_veg_tendMethod
compute_C_veg_tend(vegcarbon_dynamics, traits, LAI_b, NPP)

Computes the C_veg tendency based on NPP and the balanced Leaf Area Index LAI_b, [16, Eq. (72)]

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_GPPMethod
compute_GPP(_::LUEPhotosynthesis{NF}, An) -> Any

Compute the Gross Primary Production rate [kgC/m²/s].

source
Terrarium.compute_JE_JCMethod
compute_JE_JC(
    photo::LUEPhotosynthesis{NF},
    c_1,
    c_2,
    APAR,
    Vc_max
) -> Tuple{Any, Any}

Computes the PAR-limited and the rubisco-activity-limited photosynthesis rates JE and JC [gC/m²/s], [17, Eqs. (3, 5)].

References

  • [17] Haxeltine & Prentice, Global Biogeochemical Cycles (1996)
source
Terrarium.compute_NPPMethod
compute_NPP(autoresp, GPP, Ra)

Computes Net Primary Productivity NPP as the difference between Gross Primary Production GPP and autotrophic respiration Ra in [kgC/m²/s].

source
Terrarium.compute_PARMethod
compute_PAR(photo::LUEPhotosynthesis{NF}, swdown) -> Any

Computes NET Photosynthetically Active Radiation PAR [mol/m²/s].

source
Terrarium.compute_RaMethod
compute_Ra(
    autoresp,
    vegcarbon_dynamics,
    traits,
    T_air,
    T_soil,
    Rd,
    phen,
    C_veg,
    GPP
)

Computes autotrophic respiration Ra as the sum of maintenance respiration Rm and growth respiration Rg in [kgC/m²/s].

source
Terrarium.compute_RdMethod
compute_Rd(photo::LUEPhotosynthesis, Vc_max, β) -> Any

Computes the leaf respiration rate Rd [gC/m²/s], [17, Eq. (10)] and [16, Eq. (10)].

References

  • [17] Haxeltine & Prentice, Global Biogeochemical Cycles (1996)
  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_RmMethod
compute_Rm(
    autoresp,
    vegcarbon_dynamics,
    traits,
    T_air,
    T_soil,
    Rd,
    phen,
    C_veg
)

Computes maintenance respiration Rm in [kgC/m²/day].

source
Terrarium.compute_Vc_maxMethod
compute_Vc_max(
    photo::LUEPhotosynthesis{NF},
    c_1,
    PAR,
    Kc,
    Ko,
    Γ_star,
    pres_i,
    pres_O2
) -> Any

Computes the maximum rate of net photosynthesis Vc_max [gC/m²/s], following the coordination hypothesis (acclimation), see [18] Box 2. Note: this is not the same formula as in the [16] paper, this implementaion is taken from the code

References

  • [18] Harrison et al., New Phytologist (2021)
  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_albedo!Method
compute_albedo!(
    out,
    i,
    j,
    grid,
    fields,
    albedo::DiagnosticAlbedo,
    vegetation::Union{Nothing, Terrarium.AbstractVegetation},
    snow::Union{Nothing, Terrarium.AbstractSnow},
    args...
)
source
Terrarium.compute_assimilation_factorsMethod
compute_assimilation_factors(
    photo::LUEPhotosynthesis{NF},
    constants::MaterialConstants{NF},
    Γ_star,
    T_stress,
    Kc,
    Ko,
    pres_i,
    pres_O2
) -> Tuple{Any, Any}

Computes factors for light-limited c_1 [gC/mol] and RuBisCO-limited c_2 [dimensionless] assimilation. Follows [16, Eqs. (C4-C5)] and [17].

  • c1: quantum efficiency × temperature factor × carbon mass / denominator, used in JE = c1 × APAR
  • c2: dimensionless coefficient relating enzyme capacity to assimilation, used in JC = c2 × Vc_max

References

  • [17] Haxeltine & Prentice, Global Biogeochemical Cycles (1996)
  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)H
source
Terrarium.compute_autotrophic_respirationFunction
compute_autotrophic_respiration(
    i, j, grid, fields,
    autoresp::AbstractAutotrophicRespiration,
    vegcarbon::AbstractVegetationCarbonDynamics,
    atmos::AbstractAtmosphere,
    args...
)

Cell-level autotrophic respiration computation. Implementations should compute autotrophic respiration and related diagnostics (e.g. NPP) for the given cell.

source
Terrarium.compute_autotrophic_respirationMethod
compute_autotrophic_respiration(
    i,
    j,
    grid,
    fields,
    autoresp::PALADYNAutotrophicRespiration,
    vegcarbon_dynamics::PALADYNCarbonDynamics,
    phenology::Terrarium.AbstractPhenology,
    traits::PlantTraits,
    atmos::Terrarium.AbstractAtmosphere
) -> Tuple{Any, Any}

Compute autotrophic respiration following the scheme of [16].

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_auxiliary!Function
compute_auxiliary!(
    state,
    grid,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
)
compute_auxiliary!(
    state,
    grid,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology}
)
compute_auxiliary!(
    state,
    grid,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology},
    vegetation::Union{Nothing, Terrarium.AbstractVegetation}
)
compute_auxiliary!(
    state,
    grid,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology},
    vegetation::Union{Nothing, Terrarium.AbstractVegetation},
    snow::Union{Nothing, Terrarium.AbstractSnow},
    args...
)
source
Terrarium.compute_auxiliary!Function
compute_auxiliary!(
    state,
    grid,
    hydrology::SurfaceHydrology,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
)
compute_auxiliary!(
    state,
    grid,
    hydrology::SurfaceHydrology,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Union{Nothing, Terrarium.AbstractSoil}
)
compute_auxiliary!(
    state,
    grid,
    hydrology::SurfaceHydrology,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Union{Nothing, Terrarium.AbstractSoil},
    vegetation::Union{Nothing, Terrarium.AbstractVegetation}
)
compute_auxiliary!(
    state,
    grid,
    hydrology::SurfaceHydrology,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Union{Nothing, Terrarium.AbstractSoil},
    vegetation::Union{Nothing, Terrarium.AbstractVegetation},
    snow::Union{Nothing, Terrarium.AbstractSnow},
    args...
)
source
Terrarium.compute_auxiliary!Function
compute_auxiliary!(
    state,
    grid,
    veg::VegetationCarbonCycle,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
)
compute_auxiliary!(
    state,
    grid,
    veg::VegetationCarbonCycle,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Union{Nothing, Terrarium.AbstractSoil},
    args...
)

Compute auxiliary variables for all vegetation component processes based on the given atmospheric inputs defined by atmos and (optionally) soil state. If soil = nothing, stress factors due to soil temperature and moisture availability will be ignored.

source
Terrarium.compute_auxiliary!Function
compute_auxiliary!(state, grid, albedo::DiagnosticAlbedo)
compute_auxiliary!(
    state,
    grid,
    albedo::DiagnosticAlbedo,
    vegetation::Union{Nothing, Terrarium.AbstractVegetation}
)
compute_auxiliary!(
    state,
    grid,
    albedo::DiagnosticAlbedo,
    vegetation::Union{Nothing, Terrarium.AbstractVegetation},
    snow::Union{Nothing, Terrarium.AbstractSnow},
    args...
)

Diagnose the blended surface albedo and emissivity, weighting the snow-free background and snow values by the snow-covered area fraction of the optional snow component.

source
Terrarium.compute_auxiliary!Function
compute_auxiliary!(state, model::AbstractModel)

Compute updates to all auxiliary variables based on the current prognostic state of the model.

compute_auxiliary!(state, grid, process::AbstractProcess, args...)

Compute all auxiliary state variables for the given process on grid. Implementations of AbstractProcess may define additional args that correspond to different process coupling interfaces.

source
Terrarium.compute_auxiliary!Function
compute_auxiliary!(
    state,
    grid,
    veg::PrescribedVegetation,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
)
compute_auxiliary!(
    state,
    grid,
    veg::PrescribedVegetation,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Union{Nothing, Terrarium.AbstractSoil},
    args...
)

Compute auxiliary variables for all vegetation component processes based on the given atmospheric inputs defined by atmos and (optionally) soil state. If soil = nothing, stress factors due to soil temperature and moisture availability will be ignored.

source
Terrarium.compute_auxiliary!Function
compute_auxiliary!(
    state,
    grid,
    runoff::DirectSurfaceRunoff,
    canopy_interception::Terrarium.AbstractCanopyInterception,
    soil::Terrarium.AbstractSoil
)
compute_auxiliary!(
    state,
    grid,
    runoff::DirectSurfaceRunoff,
    canopy_interception::Terrarium.AbstractCanopyInterception,
    soil::Terrarium.AbstractSoil,
    snow::Union{Nothing, Terrarium.AbstractSnow},
    args...
)
source
Terrarium.compute_auxiliary!Function
compute_auxiliary!(
    state,
    grid,
    evaporation::BareGroundEvaporation,
    ::NoCanopyInterception,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
)
compute_auxiliary!(
    state,
    grid,
    evaporation::BareGroundEvaporation,
    ::NoCanopyInterception,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Union{Nothing, Terrarium.AbstractSoil}
)
compute_auxiliary!(
    state,
    grid,
    evaporation::BareGroundEvaporation,
    ::NoCanopyInterception,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Union{Nothing, Terrarium.AbstractSoil},
    snow::Union{Nothing, Terrarium.AbstractSnow}
)
source
Terrarium.compute_auxiliary!Method
compute_auxiliary!(
    state,
    grid,
    rad::DiagnosedRadiativeFluxes,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    consts::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    args...
)
source
Terrarium.compute_auxiliary!Method
compute_auxiliary!(
    state,
    grid,
    tur::DiagnosedTurbulentFluxes,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    args...
)
source
Terrarium.compute_auxiliary!Method
compute_auxiliary!(
    state,
    grid,
    photo::LUEPhotosynthesis,
    stomcond::Terrarium.AbstractStomatalConductance,
    traits::PlantTraits,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    args...
)
source
Terrarium.compute_auxiliary!Method
compute_auxiliary!(
    state,
    grid,
    stomcond::MedlynStomatalConductance,
    traits::PlantTraits,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    args...
)
source
Terrarium.compute_auxiliary!Method
compute_auxiliary!(
    state,
    grid,
    autoresp::PALADYNAutotrophicRespiration,
    vegcarbon::Terrarium.AbstractVegetationCarbonDynamics,
    phenology::Terrarium.AbstractPhenology,
    traits::PlantTraits,
    atmos::Terrarium.AbstractAtmosphere
)
source
Terrarium.compute_auxiliary!Method
compute_auxiliary!(
    state,
    grid,
    evapotranspiration::PALADYNCanopyEvapotranspiration,
    canopy_interception::Terrarium.AbstractCanopyInterception,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Terrarium.AbstractSoil,
    vegetation::Terrarium.AbstractVegetation,
    args...
)
source
Terrarium.compute_auxiliary!Method
compute_auxiliary!(
    state,
    grid,
    phenol::PALADYNPhenology,
    vegcarbon::PALADYNCarbonDynamics,
    atmos::Terrarium.AbstractAtmosphere
)
source
Terrarium.compute_auxiliary!Method
compute_auxiliary!(
    state,
    grid,
    rad::PrescribedRadiativeFluxes,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    atmos::Terrarium.AbstractAtmosphere,
    args...
)
source
Terrarium.compute_auxiliary!Method
compute_auxiliary!(
    state,
    grid,
    snow::SingleLayerSnow,
    constants::PhysicalConstants,
    args...
)

Diagnose the snow geometric and thermal properties (snow_depth, snow_cover_fraction, snow_thermal_conductivity) from the current snow water equivalent and bulk density. The enthalpy closure (snow_temperature, snow_liquid_fraction) is added in a later phase.

source
Terrarium.compute_auxiliary!Method

Compute auxiliary variables for soil energy, water, and carbon state variables on grid based on the given values in constants.

source
Terrarium.compute_auxiliary!Method
compute_auxiliary!(
    state,
    grid,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    soil::Terrarium.AbstractSoil,
    args...
)
source
Terrarium.compute_balanced_leaf_area_indexMethod
compute_balanced_leaf_area_index(
    vegcarbon_dynamics,
    traits,
    C_veg
)

Computes LAI_b, the balanced Leaf Area Index based on the vegetation carbon pool C_veg (assuming with bwl = 1), [16, Eqs. (76-79)].

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_canopy_interceptionMethod
compute_canopy_interception(
    canopy_interception::PALADYNCanopyInterception{NF},
    precip,
    LAI,
    SAI
) -> Any

Compute I_can, the canopy rain interception, following [16, Eq. (42)].

References

  • [16] Willeit and Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_canopy_water_tendencyMethod
compute_canopy_water_tendency(
    _::PALADYNCanopyInterception{NF},
    I_can,
    E_can,
    R_can
) -> Any

Compute the W_can tendency and removal rate following [16, Eq. (41)].

References

  • [16] Willeit and Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_energy_tendencyMethod
compute_energy_tendency(
    i,
    j,
    k,
    grid,
    fields,
    energy::Terrarium.AbstractThermodynamics,
    args...
) -> Any

Compute the internal energy tendency ∂U∂t as the divergence of the diffusive heat flux for the explicit two-phase heat conduction operator.

source
Terrarium.compute_evaporation_fluxMethod
compute_evaporation_flux(
    _::Terrarium.AbstractEvapotranspiration,
    Δq,
    g
) -> Any

Compute an evapotranspiration flux (m/s, positive upwards) as the product of a vapor conductance g (m/s) and a specific humidity difference Δq (kg/kg). All evapotranspiration components — soil/canopy evaporation and transpiration — share the functional form $E = Δq · g$, differing only in which conductance and humidity difference are supplied.

source
Terrarium.compute_evapotranspiration_conductancesFunction
compute_evapotranspiration_conductances(
    i,
    j,
    grid,
    fields,
    evaporation::BareGroundEvaporation,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
) -> Any
compute_evapotranspiration_conductances(
    i,
    j,
    grid,
    fields,
    evaporation::BareGroundEvaporation,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Union{Nothing, Terrarium.AbstractSoil}
) -> Any

Compute the skin-driven ground evaporation vapor conductance β/rₐ at grid cell i, j for the given bare-ground evaporation scheme. This conductance is independent of the skin temperature.

source
Terrarium.compute_evapotranspiration_conductances!Function
compute_evapotranspiration_conductances!(
    out,
    i,
    j,
    grid,
    fields,
    evaporation::BareGroundEvaporation,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
) -> Any
compute_evapotranspiration_conductances!(
    out,
    i,
    j,
    grid,
    fields,
    evaporation::BareGroundEvaporation,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Union{Nothing, Terrarium.AbstractSoil}
) -> Any

Compute and store the skin-driven ground evaporation vapor conductance on grid for the given bare-ground evaporation scheme.

source
Terrarium.compute_evapotranspiration_conductances!Method
compute_evapotranspiration_conductances!(
    out,
    i,
    j,
    grid,
    fields,
    evapotranspiration::PALADYNCanopyEvapotranspiration,
    canopy_interception::Terrarium.AbstractCanopyInterception,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Terrarium.AbstractSoil,
    vegetation::Terrarium.AbstractVegetation,
    args...
) -> Any

Compute and store the skin-driven vapor conductances on grid for the given scheme evapotranspiration and process dependencies.

source
Terrarium.compute_evapotranspiration_conductancesMethod
compute_evapotranspiration_conductances(
    i,
    j,
    grid,
    fields,
    evapotranspiration::PALADYNCanopyEvapotranspiration,
    canopy_interception::Terrarium.AbstractCanopyInterception,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    soil::Terrarium.AbstractSoil,
    vegetation::Terrarium.AbstractVegetation,
    args...
) -> Tuple{Any, Any, Any}

Compute the skin-driven vapor conductances (ground_evaporation_conductance, canopy_evaporation_conductance, and transpiration_conductance) at grid cell i, j for the given scheme evapotranspiration and process dependencies. These conductances are independent of the skin temperature.

source
Terrarium.compute_f_tempMethod
compute_f_temp(autoresp, T_air, T_soil)

Computes temperature factors f_temp_air and f_temp_soil for autotrophic respiration.

source
Terrarium.compute_gdd_tendencyMethod
compute_gdd_tendency(phenol, gdd, T_air)

Compute the growing-degree-day tendency d(gdd)/dt [K⋅day/s] at a single grid point.

Heat above the base temperature is accumulated (in degree-days per second) and, below the base temperature, the accumulator relaxes toward zero with timescale gdd_relaxation_time. The relaxation provides a continuous surrogate for the discrete annual reset of the original scheme.

source
Terrarium.compute_ground_heat_flux!Method
compute_ground_heat_flux!(
    out,
    i,
    j,
    grid,
    fields,
    skinT::Terrarium.AbstractSkinTemperature,
    seb::Terrarium.AbstractSurfaceEnergyBalance
)

Per-cell mutating variant used by the fused surface-energy-balance kernel: store the ground heat flux into the auxiliary output field out.

source
Terrarium.compute_ground_heat_flux!Method
compute_ground_heat_flux!(
    state,
    grid,
    skinT::Terrarium.AbstractSkinTemperature,
    seb::Terrarium.AbstractSurfaceEnergyBalance
)

Compute ground_heat_flux as the residual $R_\text{net} + H_s + H_l$ (all fluxes positive upward).

source
Terrarium.compute_ground_heat_fluxMethod
compute_ground_heat_flux(
    i,
    j,
    grid,
    fields,
    skinT::Terrarium.AbstractSkinTemperature,
    _::Terrarium.AbstractSurfaceEnergyBalance
) -> Any

Compute the ground heat flux from the surface net radiation and sensible/latent heat flux at grid cell i, j.

source
Terrarium.compute_ground_heat_fluxMethod
compute_ground_heat_flux(
    _::Terrarium.AbstractSkinTemperature,
    R_net,
    H_s,
    H_l
) -> Any

Compute the ground heat flux G that closes the surface energy balance. With all fluxes positive upward (aligned with +z), the energy arriving at the skin from below must balance the radiative and turbulent losses above, so G = R_net + H_s + H_l.

source
Terrarium.compute_hydraulics!Function
compute_hydraulics!(state, grid, hydrology::SoilHydrology, soil::AbstractSoil, args...)

Compute all state-dependent hydraulic auxiliaries such as hydraulic conductivity and field capacity, and wilting point.

source
Terrarium.compute_hydraulics!Method
compute_hydraulics!(
    out,
    i,
    j,
    k,
    grid,
    fields,
    hydrology::SoilHydrology,
    args...
)

Kernel function that computes dynamic soil hydraulic properties.

source
Terrarium.compute_hydraulics!Method
compute_hydraulics!(
    out,
    i,
    j,
    k,
    grid,
    fields,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    strat::Terrarium.AbstractStratigraphy,
    bgc::Terrarium.AbstractSoilBiogeochemistry
)

Computes the unsaturated hydraulic conductivity for RichardsEq configurations of SoilHydrology.

source
Terrarium.compute_infiltrationMethod
compute_infiltration(
    runoff::DirectSurfaceRunoff{NF},
    influx,
    sat_top,
    max_infil
) -> Any

Compute infiltration from the given influx (water available for infiltration), saturation of the uppermost soil layer sat_top, and the maximum allowed infiltration max_infil.

source
Terrarium.compute_kinetic_parametersMethod
compute_kinetic_parameters(
    photo::LUEPhotosynthesis{NF},
    T_air
) -> Tuple{Any, Any, Any}

Computes kinetic parameters τ, Kc, Ko based on temperature using Q10 temperature response. Follows enzyme kinetics from [17], Appendix C.

  • τ: Rubisco specificity factor (CO₂ to O₂ carboxylation ratio), dimensionless
  • Kc: Michaelis-Menten constant for CO₂ [Pa]
  • Ko: Michaelis-Menten constant for O₂ [Pa]

References

  • [17] Haxeltine & Prentice, Global Biogeochemical Cycles (1996)
source
Terrarium.compute_latent_heat_fluxFunction
compute_latent_heat_flux(
    i,
    j,
    grid,
    fields,
    tur::DiagnosedTurbulentFluxes,
    skinT::Terrarium.AbstractSkinTemperature,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
) -> Any
compute_latent_heat_flux(
    i,
    j,
    grid,
    fields,
    tur::DiagnosedTurbulentFluxes,
    skinT::Terrarium.AbstractSkinTemperature,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    evtr::Union{Nothing, Terrarium.AbstractEvapotranspiration}
) -> Any
compute_latent_heat_flux(
    i,
    j,
    grid,
    fields,
    tur::DiagnosedTurbulentFluxes,
    skinT::Terrarium.AbstractSkinTemperature,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    evtr::Union{Nothing, Terrarium.AbstractEvapotranspiration},
    snow::Union{Nothing, Terrarium.AbstractSnow}
) -> Any

Compute the latent heat flux at i, j based on the current skin temperature and atmospheric conditions. When an evapotranspiration scheme is provided, uses the ET-aware humidity flux; otherwise uses bare ground evaporation.

With a snow component, the flux is partitioned by snow-covered area fraction f_snow: the snow-free fraction (1 − f_snow) evaporates from the ground/canopy (latent heat of vaporization), while the snow-covered fraction sublimates from the snowpack (latent heat of sublimation, see compute_snow_sublimation_flux). Without snow it reduces to the bare ground/canopy latent flux.

source
Terrarium.compute_latent_heat_fluxMethod
compute_latent_heat_flux(
    _::DiagnosedTurbulentFluxes,
    Q_h,
    ρₐ,
    L
) -> Any

Compute the latent heat flux as a function of the humidity flux Q_h [m/s], the density ρₐ [kg/m³] of air, and the specific latent heat of vaporization or sublimation L [J/kg].

source
Terrarium.compute_leaf_area_indexMethod
compute_leaf_area_index(phenol, ϕ, LAI_b)

Compute the instantaneous leaf area index LAI = ϕ·LAI_b from the phenology factor ϕ and the balanced leaf area index LAI_b.

source
Terrarium.compute_longwave_upMethod
compute_longwave_up(::DiagnosedRadiativeFluxes, constants::PhysicalConstants, L_down, Ts, ϵ)

Compute outgoing longwave radiation from incoming longwave radiation L_down, surface temperature Ts, and emissivity ϵ.

source
Terrarium.compute_meltwater_outflowMethod
compute_meltwater_outflow(
    hydraulics::ConstantSnowHydraulics,
    θ_liq
) -> Any

Darcy-type meltwater outflow M_r (m/s, SWE). Liquid water in excess of the capillary retention L_c drains from the snowpack with a cubic conductivity [3] (in excess-saturation form): M_r = K_sat · S*³ with S* = max(θ_liq − L_c, 0) / (1 − L_c), where θ_liq is the liquid fraction of the water substance. Outflow vanishes smoothly as θ_liq → L_c and saturates at K_sat as θ_liq → 1.

References

  • [3] Tarboton et al., Report (1994)
source
Terrarium.compute_phenologyFunction
compute_phenology(i, j, grid, fields, phenol::AbstractPhenology, atmos::AbstractAtmosphere)

Cell-level phenology computation. Implementations return phenology factors and derived LAI at the given index i, j, using atmospheric inputs (e.g. air temperature) where required by the scheme.

source
Terrarium.compute_phenologyMethod
compute_phenology(
    i,
    j,
    grid,
    fields,
    phenol::PALADYNPhenology,
    atmos::Terrarium.AbstractAtmosphere
) -> Tuple{Any, Any}

Compute the phenology factor and instantaneous leaf area index (LAI) at a single grid point.

source
Terrarium.compute_phenology_factorMethod
compute_phenology_factor(phenol, gdd, T_air)

Compute the phenology factor ϕ [-] from accumulated growing degree days gdd and air temperature T_air.

The cold-deciduous factor combines the growth-phase ramp gdd / gdd_crit [16, Eq. (83)] with a senescence ramp that declines linearly from 1 at T_gdd_base to 0 at T_gdd_base − T_senescence_range. Taking the minimum reproduces all three PALADYN regimes (linear green-up, held at 1 when mature and warm, temperature-driven senescence). The result is then blended with the evergreen value of 1 via the prescribed deciduous fraction.

source
Terrarium.compute_photosynthesisFunction
compute_photosynthesis(i, j, grid, fields, photo::AbstractPhotosynthesis, atmos::AbstractAtmosphere)

Cell-level photosynthesis computation. Implementations compute leaf respiration and net assimilation for a single horizontal cell and return the pair (Rd, An, GPP) or similar outputs as required by the photosynthesis scheme.

source
Terrarium.compute_photosynthesis!Method
compute_photosynthesis!(
    out,
    i,
    j,
    grid,
    fields,
    photo::LUEPhotosynthesis,
    stomcond::Terrarium.AbstractStomatalConductance,
    traits::PlantTraits,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
) -> Any

Calls compute_photosynthesis and stores the results in out.

source
Terrarium.compute_photosynthesisMethod
compute_photosynthesis(
    i,
    j,
    grid,
    fields,
    photo::LUEPhotosynthesis,
    stomcond::Terrarium.AbstractStomatalConductance,
    traits::PlantTraits,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
) -> Tuple{Any, Any, Any}

Compute photosynthesis, leaf respiration, and gross primary production at a single grid point. Returns instantaneous rates in [gC/m²/s] and [kgC/m²/s] for integration by the timestepper.

source
Terrarium.compute_plant_available_waterFunction
compute_plant_available_water(
    i, j, k, grid, fields,
    paw::AbstractPlantAvailableWater,
    soil::AbstractSoil
)

Comptue the plant-available water fraction for grid cell i, j and soil layer k.

source
Terrarium.compute_plant_available_water!Method
compute_plant_available_water!(
    out,
    i,
    j,
    k,
    grid,
    fields,
    paw::FieldCapacityLimitedPAW{NF},
    strat::Terrarium.AbstractStratigraphy,
    hydrology::Terrarium.AbstractSoilHydrology,
    bgc::Terrarium.AbstractSoilBiogeochemistry,
    args...
) -> Any

Mutating wrapper for compute_plant_available_water that stores the result in out.

source
Terrarium.compute_plant_available_waterMethod
compute_plant_available_water(
    i,
    j,
    k,
    grid,
    fields,
    paw::FieldCapacityLimitedPAW{NF},
    strat::Terrarium.AbstractStratigraphy,
    hydrology::Terrarium.AbstractSoilHydrology,
    bgc::Terrarium.AbstractSoilBiogeochemistry
) -> Any

Compute the plant avaialble water given the current soil stratigraphy, hydrology, and biogeochemistry state in fields.

source
Terrarium.compute_precip_groundMethod
compute_precip_ground(_, precip, I_can, R_can)

Compute rainfall_ground, the rate of rain reaching the ground, following a modified version of [16, Eq. (44)]. Instead of subtracting the tendency, we just directly subtract interception and add the removal rate R_can.

References

  • [16] Willeit and Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_pres_iMethod
compute_pres_i(photo::LUEPhotosynthesis, λc, pres_a) -> Any

Computes intercellular CO2 partial pressure [Pa], [16, Eq. (67)].

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_radiative_fluxes!Method
compute_radiative_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    rad::PrescribedRadiativeFluxes,
    atmos::Terrarium.AbstractAtmosphere,
    args...
) -> Any

Compute net radiation and store in auxiliary fields at a grid point.

source
Terrarium.compute_respiration_assimilationMethod
compute_respiration_assimilation(
    photo::LUEPhotosynthesis{NF},
    traits::PlantTraits{NF},
    constants::MaterialConstants{NF},
    T_air,
    swdown,
    pres,
    co2,
    LAI,
    λc,
    β
) -> Tuple{Any, Any}

Compute and return leaf respiration [gC/m²/s] and net assimilation [gC/m²/s] rates.

source
Terrarium.compute_saturation_tendency!Method
compute_saturation_tendency!(
    saturation_water_ice_tendency,
    i,
    j,
    k,
    grid,
    clock,
    fields,
    hydrology::SoilHydrology,
    strat::Terrarium.AbstractStratigraphy,
    bgc::Terrarium.AbstractSoilBiogeochemistry,
    constants::PhysicalConstants,
    evtr::Union{Nothing, Terrarium.AbstractEvapotranspiration}
)
source
Terrarium.compute_sensible_heat_fluxMethod
compute_sensible_heat_flux(
    i,
    j,
    grid,
    fields,
    tur::DiagnosedTurbulentFluxes,
    skinT::Terrarium.AbstractSkinTemperature,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
) -> Any

Compute the sensible heat flux at i, j based on the current skin temperature and atmospheric conditions.

source
Terrarium.compute_sensible_heat_fluxMethod
compute_sensible_heat_flux(
    _::DiagnosedTurbulentFluxes,
    Q_T,
    ρₐ,
    cₐ
) -> Any

Compute the sensible heat flux [W/m²] as a function of the bulk aerodynamic temperature gradient Q_T [K m/s] and the density ρₐ [kg/m³] and specific heat capacity cₐ [J/kg K] of air.

source
Terrarium.compute_shortwave_upMethod
compute_shortwave_up(::DiagnosedRadiativeFluxes, S_down, α)

Compute outgoing shortwave radiation from the incoming shortwave radiation S_down and albedo α.

source
Terrarium.compute_skin_temperatureFunction
compute_skin_temperature(
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    constants::PhysicalConstants
) -> Any
compute_skin_temperature(
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    constants::PhysicalConstants,
    snow::Union{Nothing, Terrarium.AbstractSnow}
) -> Any

Estimate the skin temperature from the current ground_heat_flux at grid cell i, j, using the effective conduction target of the medium below the skin. The optional snow argument enables the snow-covered blend (see ground_thermal_interface); with snow === nothing this is the snow-free soil conduction.

source
Terrarium.compute_skin_temperature!Function
compute_skin_temperature!(
    state,
    grid,
    skinT::ImplicitSkinTemperature,
    constants::PhysicalConstants
)
compute_skin_temperature!(
    state,
    grid,
    skinT::ImplicitSkinTemperature,
    constants::PhysicalConstants,
    snow::Union{Nothing, Terrarium.AbstractSnow}
)

Compute skin_temperature from the current ground_heat_flux using the (optionally snow-aware) conduction target. constants supplies the material properties for the conduction blend; passing a snow component (default nothing) selects the snow-covered ground_thermal_interface, while snow === nothing recovers the snow-free soil conduction.

source
Terrarium.compute_skin_temperature!Function
compute_skin_temperature!(
    out,
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    constants::PhysicalConstants
)
compute_skin_temperature!(
    out,
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    constants::PhysicalConstants,
    snow::Union{Nothing, Terrarium.AbstractSnow},
    seb_args...
)

Recompute surface energy fluxes using compute_surface_energy_fluxes! and update the skin temperature based on the resulting ground heat flux.

source
Terrarium.compute_skin_temperatureMethod
compute_skin_temperature(
    _::ImplicitSkinTemperature,
    Tg,
    G,
    Δz,
    κ
) -> Any

Compute the implicit update of the skin temperature from the sub-surface temperature Tg, ground heat flux G, half-cell distance Δz, and effective conductivity κ, by equating G to the half-cell conductive flux 2κ(Tg − Ts)/Δz.

source
Terrarium.compute_snow_basal_heat_fluxMethod
compute_snow_basal_heat_flux(
    κ_snow,
    T_soil,
    T_snow,
    d_snow
) -> Any

Snow→soil basal conductive heat flux Q_base [W/m²], positive upward (soil → snow). The snowpack is a strong insulator, so only its resistance is retained (snow-resistance-only closure): Q_base = 2·κ_snow·(T_soil − T_snow)/d_snow. The depth is regularized with a machine-eps offset so the flux stays finite as the snowpack vanishes.

source
Terrarium.compute_snow_cover_fractionMethod
compute_snow_cover_fraction(
    cover::FractionalSnowCover{NF},
    swe
) -> Any

Sub-grid snow-covered area fraction f_snow = W_snow/(W_snow + W_ref) ∈ [0,1) from the snow water equivalent W_snow [m] and the reference level W_ref (half_coverage), clamping negative SWE (which can occur transiently in the prognostic state) to zero cover.

source
Terrarium.compute_snow_depthMethod
compute_snow_depth(
    _::Terrarium.AbstractSnow,
    W_snow,
    ρ_snow,
    ρ_w
) -> Any

Snow layer depth d_snow = W_snow·ρ_w/ρ_snow [m], converting the water-equivalent depth W_snow [m] to the physical snow depth using the water density ρ_w and the bulk snow density ρ_snow.

source
Terrarium.compute_snow_energy_tendencyMethod
compute_snow_energy_tendency(
    i,
    j,
    grid,
    fields,
    snow::SingleLayerSnow,
    atmos::Terrarium.AbstractAtmosphere,
    constants::PhysicalConstants
) -> Any

Depth-integrated snow energy tendency [W/m²] at grid cell i, j (all fluxes positive upward):

dŪ_snow/dt = Q_base − Q_top + Q_precip + Q_subl

where Q_top/Q_base are the surface/basal heat fluxes, Q_precip the advected precipitation heat (see compute_snow_precip_heat_flux), and Q_subl an advective correction for sublimation.

The sublimation correction Q_subl = ρ_w·L_sl·E_subl is required because the latent heat flux carries the full sublimation enthalpy ρ_w·L_sg·E_subl, whereas the mass leaving the snowpack departs as ice, whose specific enthalpy relative to the liquid-water reference is −L_sl. Adding back ρ_w·L_sl·E_subl leaves the snowpack with a net loss of ρ_w·(L_sg − L_sl)·E_subl = ρ_w·L_lg·E_subl, the vaporization enthalpy carried by the departing vapor.

Note that no explicit meltwater energy term appears because meltwater drains as liquid water at 0 °C, which is the zero-enthalpy reference (U = 0) of the FreeWater closure, so it carries no enthalpy out of the snowpack.

source
Terrarium.compute_snow_interface_fluxes!Method
compute_snow_interface_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    snow::SingleLayerSnow,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    soil::Terrarium.AbstractSoil,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
)

Diagnose the snow↔surface/soil coupling fluxes at grid cell i, j, run after the surface energy balance: the blended soil-top heat flux (see compute_snow_soil_heat_flux) and the snow surface sublimation rate (see compute_snow_sublimation_flux, the same snow-fraction vapor flux the surface energy balance uses for the latent-flux partition).

source
Terrarium.compute_snow_interface_fluxes!Method
compute_snow_interface_fluxes!(
    state,
    grid,
    _::Nothing,
    args...
)

Launch compute_snow_interface_fluxes! to diagnose the snow↔surface/soil coupling fluxes from the snow state and the surface energy balance outputs: the blended soil-top heat flux (soil_heat_flux) and the snow surface sublimation rate (sublimation, the snow-fraction bulk-aerodynamic vapor flux at the converged skin temperature). Must run after the surface energy balance (which sets ground_heat_flux and the skin temperature). No-op when there is no snowpack (snow === nothing).

source
Terrarium.compute_snow_precip_heat_fluxMethod
compute_snow_precip_heat_flux(
    _::Terrarium.AbstractSnow,
    constants::PhysicalConstants,
    P_s,
    R_on_snow,
    T_air
) -> Any

Advected heat flux [W/m²] carried into the snowpack by precipitation, relative to liquid water at 0 °C (the U = 0 reference of the FreeWater enthalpy closure). Fresh snow P_s arrives as ice, which sits L_sl below the liquid reference, plus sensible heat for T_air < 0; rain-on-snow R_on_snow arrives as liquid carrying only its sensible heat for T_air > 0. The latent heat released when rain refreezes in a cold pack is captured implicitly by the enthalpy closure, so it is not added here (adding L_sl would double-count relative to the liquid-water reference).

source
Terrarium.compute_snow_properties!Method
compute_snow_properties!(
    out,
    i,
    j,
    grid,
    fields,
    snow::SingleLayerSnow,
    constants::PhysicalConstants
)

Compute the snow depth, cover fraction, and thermal conductivity at grid cell i, j.

source
Terrarium.compute_snow_soil_heat_fluxMethod
compute_snow_soil_heat_flux(
    i,
    j,
    grid,
    fields,
    snow::SingleLayerSnow,
    constants::PhysicalConstants,
    soil::Terrarium.AbstractSoil
) -> Any

Blended soil-top heat flux [W/m²] at grid cell i, j: the snow-cover-fraction-weighted combination of the snow→soil basal conductive flux Q_base and the bare-ground surface energy balance closure flux G (ground_heat_flux), f_snow·Q_base + (1 − f_snow)·G. The bulk snow thermal conductivity entering Q_base is recovered lazily from the density scheme rather than stored.

source
Terrarium.compute_snow_sublimation_fluxMethod
compute_snow_sublimation_flux(
    i,
    j,
    grid,
    fields,
    _::Nothing,
    atmos,
    constants,
    skinT
) -> Any

Snow-surface sublimation rate [m/s SWE] at grid cell i, j, area-weighted by the snow-covered fraction f_snow. The snow surface is treated as saturated: a bulk-aerodynamic vapor flux Δq/rₐ evaluated at the skin temperature, with Δq taken over ice for a sub-freezing surface (the saturation humidity already dispatches over ice for T ≤ 0 — see saturation_specific_humidity_vapor). The water-vapor mass flux ρₐ·Δq/rₐ is converted to a snow-water-equivalent rate via ρ_w. Zero without snow (snow === nothing).

source
Terrarium.compute_snow_volumetric_heat_capacityMethod
compute_snow_volumetric_heat_capacity(
    _::Terrarium.AbstractSnow{NF},
    constants::PhysicalConstants,
    ρ_snow,
    liq
) -> Any

Bulk volumetric heat capacity C_snow [J/m³/K] of the snowpack treated as an ice–liquid–air mixture, given the bulk snow density ρ_snow [kg/m³] and the liquid water fraction liq ∈ [0,1] of the water substance. The water-substance mass per unit snow volume is ρ_snow, of which (1 − liq) is ice and liq is liquid; the remaining void space is dry air. The corresponding constituent volume fractions are

\[\begin{aligned} θ_{ice} &= ρ_{snow}·(1 − liq)/ρ_i,\ θ_{liq} &= ρ_{snow}·liq/ρ_w,\ θ_{air} &= 1 − θ_{ice} − θ_{liq} \end{aligned}\]

and the heat capacity is the volume-weighted sum over the ice and liquid constituents, C_snow = cp_i·ρ_i·θ_ice + cp_w·ρ_w·θ_liq. The air's own sensible-heat storage (≈0.1%) is neglected; note the air is still reflected in the bulk density ρ_snow < ρ_ice.

source
Terrarium.compute_snow_water_tendencyMethod
compute_snow_water_tendency(
    i,
    j,
    grid,
    fields,
    snow::SingleLayerSnow,
    atmos::Terrarium.AbstractAtmosphere
) -> Any

Snow water equivalent (SWE) tendency (m/s) at grid cell i, j:

dW_snow/dt = S + R_snow − M − E_subl

where S is snowfall, R_snow = f_snow · rainfall the rain intercepted by the snow-covered fraction, M the Darcy meltwater outflow (see snow_meltwater_flux), and E_subl the sublimation rate.

source
Terrarium.compute_specific_humidity_differenceMethod
compute_specific_humidity_difference(
    i,
    j,
    grid,
    fields,
    atmos::Terrarium.AbstractAtmosphere,
    c::PhysicalConstants,
    T
) -> Any

Computes the specific humidity difference [kg/kg] between a saturated surface at temperature T [°C] and the current atmospheric fields.

source
Terrarium.compute_stomatal_conductanceFunction
compute_stomatal_conductance(
    i, j, grid, fields,
    stomcond::AbstractStomatalConductance,
    photo::AbstractPhotosynthesis,
    atmos::AbstractAtmosphere,
    constants::PhysicalConstants,
    args...
)

Cell-level stomatal conductance computation. Returns stomatal/canopy conductance and internal CO₂ ratio for the specified cell.

source
Terrarium.compute_stomatal_conductanceMethod
compute_stomatal_conductance(
    i,
    j,
    grid,
    fields,
    stomcond::MedlynStomatalConductance{NF},
    traits::PlantTraits{NF},
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    args...
) -> Any

Compute stomatal conductance (gstm) and leaf-to-air CO₂ ratio (λc) at a grid point. Returns tuple (gstm, λc) for use in photosynthesis and transpiration calculations.

source
Terrarium.compute_stomatal_conductanceMethod
compute_stomatal_conductance(
    stomcond::MedlynStomatalConductance{NF},
    traits::PlantTraits{NF},
    vpd,
    An,
    co2,
    LAI,
    β
) -> Any

Compute canopy-level water conductance [m/s] from the [19] optimal stomatal conductance model. Includes minimum conductance and light extinction effects based on LAI, scaled by soil moisture factor β.

References

  • [19] Medlyn et al., Global Change Biology (2011)
source
Terrarium.compute_surface_drainageMethod
compute_surface_drainage(
    runoff::DirectSurfaceRunoff{NF},
    surface_excess_water
) -> Any

Compute surface drainage flux from the current surface_excess_water resevoir state.

source
Terrarium.compute_surface_energy_fluxes!Function
compute_surface_energy_fluxes!(
    state,
    grid,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
)
compute_surface_energy_fluxes!(
    state,
    grid,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology},
    args...
)

Compute the surface energy fluxes on grid based on the current atmospheric state.

source
Terrarium.compute_surface_energy_fluxes!Function
compute_surface_energy_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
)
compute_surface_energy_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    evtr::Union{Nothing, Terrarium.AbstractEvapotranspiration}
)
compute_surface_energy_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    evtr::Union{Nothing, Terrarium.AbstractEvapotranspiration},
    snow::Union{Nothing, Terrarium.AbstractSnow},
    args...
)

Fused kernel function that computes the radiative and turbulent fluxes, as well as the ground heat flux based on the current skin temperature and humidity fluxes.

source
Terrarium.compute_surface_energy_fluxes!Function
compute_surface_energy_fluxes!(state, grid, ::AbstractSurfaceEnergyBalance, args...)

Compute the surface energy fluxes and skin temperature from the current state and grid. The required args are implementation dependent.

source
Terrarium.compute_surface_excess_water_tendencyMethod
compute_surface_excess_water_tendency(
    i,
    j,
    k,
    grid,
    clock,
    fields,
    hydrology::SoilHydrology,
    runoff::Union{Nothing, Terrarium.AbstractSurfaceRunoff}
) -> Any

Kernel function for computing the tendency of the prognostic surface_excess_water variable in all grid cells.

source
Terrarium.compute_surface_humidity_fluxMethod
compute_surface_humidity_flux(
    i,
    j,
    grid,
    fields,
    _::BareGroundEvaporation,
    atmos::Terrarium.AbstractAtmosphere,
    constants::PhysicalConstants
) -> Any

Evaluate the bare-ground surface humidity flux [m/s] from the current skin temperature and evaporation conductance in fields.

source
Terrarium.compute_surface_humidity_fluxMethod
compute_surface_humidity_flux(
    i,
    j,
    grid,
    fields,
    evtr::PALADYNCanopyEvapotranspiration,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    args...
) -> Any

Compute the surface humidity flux [m/s] from the current skin temperature and conductances in fields.

source
Terrarium.compute_surface_runoff!Function
compute_surface_runoff!(
    out, i, j, grid, fields,
    runoff::DirectSurfaceRunoff{NF},
    canopy_interception::AbstractCanopyInterception,
    soil_hydrology::AbstractSoilHydrology
) where {NF}

Compute surface runoff in grid cell i, j and store the result in out.surface_runoff. Runoff is computed based on the ground-reaching precipitation rate provided by canopy_interception and the soil saturation state provided by soil_hydrology.

source
Terrarium.compute_surface_runoffMethod
compute_surface_runoff(
    runoff::DirectSurfaceRunoff,
    influx,
    surface_drainage,
    infil
) -> Any

Compute surface runoff as precipitation + surface_drainage - infiltration.

source
Terrarium.compute_surface_upwelling_radiationMethod
compute_surface_upwelling_radiation(
    i,
    j,
    grid,
    fields,
    rad::PrescribedRadiativeFluxes,
    args...
) -> NamedTuple{(:surface_shortwave_up, :surface_longwave_up), <:Tuple{Any, Any}}

Compute upwelling shortwave and longwave radiation at a grid point.

source
Terrarium.compute_tendencies!Function
compute_tendencies!(state, model::AbstractModel)

Compute tendencies for all prognostic state variables for model stored in the given state. This method should be called after compute_auxiliary!.

compute_tendencies!(state, grid, process::AbstractProcess, args...)

Compute the tendencies of all prognostic state variables for the given process on grid. Implementations of AbstractProcess may define additional args that correspond to different process coupling interfaces.

source
Terrarium.compute_tendencies!Method
compute_tendencies!(
    state,
    grid,
    canopy_interception::PALADYNCanopyInterception,
    evapotranspiration::Terrarium.AbstractEvapotranspiration,
    args...
)
source
Terrarium.compute_tendencies!Method
compute_tendencies!(
    state,
    grid,
    veg_dynamics::PALADYNVegetationDynamics,
    vegcarbon_dynamics::PALADYNCarbonDynamics,
    traits::PlantTraits,
    args...
)
source
Terrarium.compute_tendencies!Method
compute_tendencies!(
    state,
    grid,
    snow::SingleLayerSnow,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    args...
)

Compute the snow water-equivalent and depth-integrated energy tendencies (see compute_snow_tendencies!), driven by the atmospheric precipitation inputs and the prescribed surface/basal heat fluxes and sublimation.

source
Terrarium.compute_tendencies!Method
compute_tendencies!(
    state,
    grid,
    veg::VegetationCarbonCycle,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    args...
)

Compute tendencies for carbon and vegetation dynamics.

source
Terrarium.compute_tendencies!Method
compute_tendencies!(
    state,
    grid,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    soil::Terrarium.AbstractSoil,
    constants::PhysicalConstants
)
compute_tendencies!(
    state,
    grid,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    soil::Terrarium.AbstractSoil,
    constants::PhysicalConstants,
    evtr::Union{Nothing, Terrarium.AbstractEvapotranspiration}
)
compute_tendencies!(
    state,
    grid,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    soil::Terrarium.AbstractSoil,
    constants::PhysicalConstants,
    evtr::Union{Nothing, Terrarium.AbstractEvapotranspiration},
    runoff::Union{Nothing, Terrarium.AbstractSurfaceRunoff},
    args...
)
source
Terrarium.compute_thermal_conductivityMethod
compute_thermal_conductivity(
    i,
    j,
    k,
    grid,
    fields,
    energy::SoilThermodynamics,
    hydrology::Terrarium.AbstractSoilHydrology,
    strat::Terrarium.AbstractStratigraphy,
    bgc::Terrarium.AbstractSoilBiogeochemistry
) -> Any
source
Terrarium.compute_thermal_conductivityMethod
compute_thermal_conductivity(
    snow::SingleLayerSnow,
    constants::MaterialConstants,
    ρ_snow
) -> Any

Bulk snow thermal conductivity κ_snow [W/m/K], delegating to the process's thermal conductivity scheme with the bulk density ρ_snow.

source
Terrarium.compute_thermal_conductivityMethod
compute_thermal_conductivity(
    cond::PowerLawSnowThermalConductivity{NF},
    constants::MaterialConstants{NF},
    ρ_snow
) -> Any

Bulk snow thermal conductivity via the density power law κ_snow = a·(ρ_snow/ρ_w)^b ([13]).

source
Terrarium.compute_turbulent_fluxes!Method
compute_turbulent_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    tur::DiagnosedTurbulentFluxes,
    skinT,
    constants,
    atmos,
    evtr,
    snow
)

Compute the turbulent (sensible and latent) heat fluxes from the current skin temperature and store them into the auxiliary output fields out.

source
Terrarium.compute_turbulent_fluxes!Method
compute_turbulent_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    _::PrescribedTurbulentFluxes,
    skinT,
    constants,
    atmos,
    evtr,
    snow
)

Prescribed turbulent fluxes are input fields supplied by an external coupler (already present in fields), so there is nothing to compute or store.

source
Terrarium.compute_vapor_pressure_deficitMethod
compute_vapor_pressure_deficit(
    i,
    j,
    grid,
    fields,
    atmos::Terrarium.AbstractAtmosphere,
    c::PhysicalConstants
) -> Any

Computes the vapor pressure deficit (VPD) [Pa] at atmospheric reference level given the current atmospheric fields

source
Terrarium.compute_vapor_pressure_differenceMethod
compute_vapor_pressure_difference(
    i,
    j,
    grid,
    fields,
    atmos::Terrarium.AbstractAtmosphere,
    c::PhysicalConstants,
    T
) -> Any

Computes the vapor pressure difference [Pa] between a saturated surface at temperature T [°C] and the current atmospheric fields.

source
Terrarium.compute_veg_carbon_tendencyFunction
compute_veg_carbon_tendency(i, j, grid, fields, vegcarbon::AbstractVegetationCarbonDynamics)

Cell-level vegetation-carbon tendency computation. Implementations compute the tendency for the total vegetation carbon pool at the given index i, j.

source
Terrarium.compute_veg_carbon_tendencyMethod
compute_veg_carbon_tendency(
    i,
    j,
    grid,
    fields,
    vegcarbon_dynamics::PALADYNCarbonDynamics,
    traits::PlantTraits
) -> Any

Compute the tendency for the carbon vegetation pool given fields LAI_b and NPP.

source
Terrarium.compute_volumetric_snow_energyMethod
compute_volumetric_snow_energy(Ū_snow, d_snow) -> Any

Volumetric snow internal energy U_snow = Ū_snow/d_snow [J/m³] from the depth-integrated energy Ū_snow [J/m²] and the snow depth d_snow [m]. The denominator is regularized with a machine-eps offset so the result stays finite (and differentiable) as W_snow → 0: with Ū_snow → 0 and d_snow → 0 together, U_snow → 0. The thin-snow indeterminacy is additionally masked downstream by f_snow → 0. A finite offset is used rather than safediv because safediv returns Inf at exactly d_snow = 0 (even for Ū_snow = 0), which would produce NaN when multiplied by f_snow = 0 in the surface energy balance blend.

source
Terrarium.compute_volumetric_water_content_tendencyMethod
compute_volumetric_water_content_tendency(
    i,
    j,
    k,
    grid,
    clock,
    fields,
    hydrology,
    constants,
    evapotranspiration
)

Compute the volumetric water content (VWC) tendency at grid cell i, j k according to the Richardson-Richards equation. Note that the VWC tendency is not scaled by the porosity and is thus not the same as the saturation tendency.

source
Terrarium.compute_volumetric_water_content_tendencyMethod
compute_volumetric_water_content_tendency(
    i,
    j,
    k,
    grid,
    clock,
    fields,
    hydrology::SoilHydrology{NF, VerticalFlow, SaturationClosure, SoilHydraulics} where {VerticalFlow<:Terrarium.AbstractVerticalFlow, SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    constants::PhysicalConstants,
    evtr::Union{Nothing, Terrarium.AbstractEvapotranspiration}
) -> Any

Compute the volumetric water content (VWC) tendency at grid cell i, j k f. Note that the VWC tendency is not scaled by the porosity and is thus not the same as the saturation tendency.

source
Terrarium.compute_water_table!Method
compute_water_table!(
    water_table,
    i,
    j,
    grid,
    sat,
    _::SoilHydrology{NF, VerticalFlow, SaturationClosure, SoilHydraulics} where {VerticalFlow<:Terrarium.AbstractVerticalFlow, SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})}
)

Kernel function that diagnoses the water table at grid cell i, j given the current soil saturation profile.

source
Terrarium.compute_Γ_starMethod
compute_Γ_star(
    photo::LUEPhotosynthesis{NF},
    τ,
    pres_O2
) -> Any

Computes the CO₂ compensation point Γ_star [Pa]. The intercellular CO₂ partial pressure at which gross photosynthesis equals respiration. Follows [16, Eq. (C6)].

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_Λ_locMethod
compute_Λ_loc(vegcarbon_dynamics, traits, LAI_b)

Computes the local litterfall rate Λ_loc based on the balanced Leaf Area Index LAI_b (assuming evergreen PFTs), [16, Eq. (75)].

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_γvMethod
compute_γv(veg_dynamics)

Computes the disturbance rateγv, [16, Eq. (80)].

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_λ_NPPMethod
compute_λ_NPP(vegcarbon_dynamics, traits, LAI_b)

Computes λ_NPP,a factor determining the partitioning of NPP between increase of vegetation carbon of the existing vegetated area and spreading of the given PFT based on the balanced Leaf Area Index LAI_b, [16, Eq. (74)].

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_λcMethod
compute_λc(stomcond, vpd)

Computes the ratio of leaf-internal and air CO2 concentration λc, derived from the optimal stomatal conductance model ([19]), [16, Eq. (71)].

References

  • [19] Medlyn et al., Global Change Biology (2011)
  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_ν_starMethod
compute_ν_star(veg_dynamics, ν)

Computes ν_star which is the maximum of the current vegetation fraction ν and the seed fraction ν_seed [-], to ensure that a PFT is always seeded.

source
Terrarium.compute_ν_tendencyFunction
compute_ν_tendency(
    i, j, grid, fields,
    veg_dynamics::AbstractVegetationDynamics,
    vegcarbon::AbstractVegetationCarbonDynamics
)

Cell-level vegetation-fraction tendency computation used by vegetation dynamics. Implementations compute the local tendency value for ν at the given index i, j.

source
Terrarium.compute_ν_tendencyMethod
compute_ν_tendency(
    i,
    j,
    grid,
    fields,
    veg_dynamics::PALADYNVegetationDynamics,
    vegcarbon_dynamics::PALADYNCarbonDynamics,
    traits::PlantTraits
) -> Any

Compute vegetation area fraction tendency at a single grid point from NPP-productivity and disturbance rates.

source
Terrarium.compute_ν_tendencyMethod
compute_ν_tendency(
    veg_dynamics,
    vegcarbon_dynamics,
    traits,
    LAI_b,
    C_veg,
    NPP,
    ν
)

Computes the vegetation fraction tendency for a single PFT, [16, Eq. (73)].

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.convert_dtMethod
convert_dt(Δt)

Convert Δts of type Period to a numeric value in seconds. Return Δt if already a number.

source
Terrarium.darcy_fluxMethod
darcy_flux(i, j, k, grid, ψ, K)

Kernel function for computing the Darcy flux over layer faces from the pressure head ψ and hydraulic conductivity K.

source
Terrarium.daytime_lengthMethod
daytime_length(i, j, grid, fields, ::AbstractAtmosphere{PR, <:LongShortWaveRadiation})

Retrieve the length of the day (in hours) at grid cell i, j. Defaults to a constant 12 hours if no input is provided.

source
Terrarium.debug!Method
debug!(debug::Bool)

Enable or disable global debug mode for Terrarium. Debug mode

source
Terrarium.debughook!Method
debughook!(args)

Provides a "hook" for handling debug calls from relevant callsites. Default implementations for Field and NamedTuple (assumed to be of Fields) simply forward to checkfinite!.

source
Terrarium.debugsite!Method
debugsite!(args)

Utility method that forwards args to debughook! if and only if debug mode is enabled. Debug mode is set by the global variable DEBUG which can be toggled by the user facing API debug!.

source
Terrarium.deduplicateMethod
deduplicate(values)

Filter out duplicates from the given tuple. Note that this method is not type stable or allocation-free!

source
Terrarium.default_clockMethod
default_clock(
    model::Terrarium.AbstractModel{NF, Grid} where Grid<:(Terrarium.AbstractLandGrid{NF})
) -> Clock{_A, _B, Float64, Int64, Int64} where {_A, _B}

Return the default Clock used by initialize for the given model. The generic method returns a plain host clock starting at time zero; architecture extensions may specialize on the model's grid to return an architecture-specific clock (e.g. TerrariumReactantExt returns a traced ConcreteRNumber-backed clock so that time advances inside the compiled step).

source
Terrarium.default_dtFunction
default_dt(timestepper::AbstractTimeStepper)

Get the current timestep size for the time stepper.

source
Terrarium.default_dtMethod
default_dt(integrator::ModelIntegrator)

Return the default timestep size for the given integrator, taken from its model's timestepper.

source
Terrarium.default_skin_temperature_solverMethod
default_skin_temperature_solver(
    _::Type{NF}
) -> Terrarium.RootSolver{NF, RootSolvers.NewtonsMethod{T}, RootSolvers.CompactSolution, RootSolvers.ResidualTolerance{NF}} where {NF, T<:Union{Real, AbstractArray}}

Construct the default solver for the implicit skin temperature: a Newton root-finder (RootSolver backed by RootSolvers.jl) with a small iteration budget.

source
Terrarium.density_socFunction
density_soc(i, j, k, grid, fields, bgc::AbstractSoilBiogeochemistry)

Compute or return the soil organic carbon density at grid cell index i, j, k.

source
Terrarium.density_socMethod
density_soc(i, j, k, grid, fields, bgc)

Calculate the organic solid fraction based on the prescribed SOC and natural porosity/density of the organic material.

source
Terrarium.diffusive_heat_fluxMethod
diffusive_heat_flux(
    i,
    j,
    k,
    grid,
    fields,
    energy::Terrarium.AbstractThermodynamics,
    args...
) -> Any

Compute the diffusive (Fourier) heat flux q = -κ ∂T/∂z at the cell face i, j, k, interpolating the medium-specific thermal conductivity to the face.

source
Terrarium.drag_coefficientMethod
drag_coefficient(i, j, grid, fields, aero::AbstractAerodynamics)

Compute the bulk drag coefficient for heat and moisture transfer at grid cell i, j.

source
Terrarium.emissivityMethod
emissivity(
    i,
    j,
    grid,
    fields,
    albedo::ConstantAlbedo
) -> Any

Return the surface emissivity at grid point i, j.

source
Terrarium.emissivityMethod
emissivity(i, j, grid, fields, ::AbstractAlbedo)

Return the current emissivity at the given indices.

source
Terrarium.energy_to_temperature!Method
energy_to_temperature!(
    out,
    i,
    j,
    grid,
    fields,
    _::SnowEnergyTemperatureClosure,
    snow::SingleLayerSnow,
    constants::PhysicalConstants
)

Recover the snow temperature and liquid water fraction from the depth-integrated energy at grid cell i, j.

source
Terrarium.energy_to_temperatureMethod
energy_to_temperature(_::FreeWater, U, ρLθ, C) -> Any

Calculate the inverse enthalpy function given the internal energy U (J/m³), volumetric latent heat content ρLθ (J/m³), and volumetric heat capacity C (J/m³/K) under the free water freezing characteristic.

source
Terrarium.explicit_step!Method
explicit_step!(state, grid, timestepper, Δt, names)

Evaluate an explicit update u += ∂u∂t*Δt for the prognostic fields of state listed in names and their corresponding tendencies. By default, this is implemented as a simple Euler update u += dudt*Δt which can serve as a building block for more complex, multi-stage timesteppers. Where necessary, additional dispatches of explicit_step_kernel!(field, tendency, ::AbstractLandGrid, ::TimeStepper, Δt) can be defined to implement more specialized time-stepping schemes.

source
Terrarium.explicit_step!Method

Accumulate tendency*Δt in the given prognostic field. This method can be overridden by specialized timestepping schemes as needed.

source
Terrarium.fastiterateMethod
fastiterate(f!::F, iters::NTuple{N,Any}...) where {F,N}

Same as fastmap but simply invokes f! on each argument set without constructing a tuple.

source
Terrarium.fastmapMethod
fastmap(f::F, iter::NamedTuple...) where {F}

Same as map for NamedTuples but with guaranteed type stability. fastmap is a @generated function which unrolls calls to f into a loop-free tuple construction expression. All named tuples must have the same keys but in no particular order. The returned NamedTuple

source
Terrarium.fastmapMethod
fastmap(f::F, iter::NTuple{N,Any}...) where {F,N}

Same as map for NTuples but with guaranteed type stability. fastmap is a @generated function which unrolls calls to f into a loop-free tuple construction expression.

source
Terrarium.field_indicesMethod
field_indices(
    indices::Tuple{Integer, Integer, Integer}
) -> Tuple{Integer, Integer, Integer}

Pad the grid indices to the three indices required to write to a Field. A 2D (XY) solve passes (i, j), but Oceananigans only defines setindex!(::Field, val, i, j, k) for exactly three indices.

source
Terrarium.findfirst_zMethod
findfirst_z(i, j, condition_func, z_nodes, field)

2D kernel function that finds the first coordinate in z_nodes where condition_func(field[i, j, k]). This implementation performs a linear scan over the z-axis and thus has time complexity O(N_z).

source
Terrarium.forcingMethod
forcing(i, j, k, grid, clock, fields, evapotranspiration::AbstractEvapotranspiration, ::AbstractSoilHydrology)

Compute and return the evapotranspiration forcing for soil moisture at the given indices i, j, k. The ET forcing is just the surface_humidity_flux rescaled by the thickness of layer k.

source
Terrarium.forcingMethod
forcing(i, j, k, grid, clock, fields, forcing::AbstractForcing, target::AbstractProcess, args...)

Return the value computed by the given Oceananigans forcing type, which should be an instance of either DiscreteForcing or ContinuousForcing. Note that target and additional args are only included for interface consistency and are not passed through to forcing.

source
Terrarium.get_albedoMethod
get_albedo(seb)

Return the albedo parameterization associated with the surface energy balance.

source
Terrarium.get_artifactMethod
get_artifact(name::String) -> String

Retrieve the path to the artifact with the given name. Throws an AssertionError if no artifact with name exists in Artifacts.toml.

source
Terrarium.get_assetMethod
get_asset(asset::Terrarium.AbstractLandAsset) -> String

Download (if necessary) the given asset and return the path to its data file within the installed artifact directory. The artifact is installed via get_artifact and the data file is located by its file_extension. Reading the file is left to the caller; use load_asset to read a variable into a data Field wrapped on the asset's native_grid.

source
Terrarium.get_cacheMethod
get_cache(cache::AbstractTimeStepperCache, timestepper::AbstractTimeStepper)

Return the working cache for timestepper given the model's state.timestepper_cache. For a single timestepper this is the cache itself; an IMEX cache returns the sub-cache matching the timestepper's class.

source
Terrarium.get_closureMethod
get_closure(
    hydrology::SoilHydrology
) -> Terrarium.AbstractSoilWaterClosure

Return the saturation-pressure closure defined by the given hydrology process, or nothing if not defined for the given configuration.

source
Terrarium.get_constantsMethod
get_constants(model::AbstractModel)::PhysicalConstants

Return the PhysicalConstants associated with the given model.

source
Terrarium.get_fieldMethod
get_field(
    state,
    _::Union{Terrarium.AbstractVariable{name}, Terrarium.Namespace{name}}
) -> Any

Retrieves the Field from state matching the name of the given variable.

source
Terrarium.get_field_gridFunction
get_field_grid(grid::AbstractLandGrid)::Oceananigans.AbstractGrid

Returns the underlying Oceananigans grid type for Fields defined on the given land grid.

source
Terrarium.get_fieldsMethod
get_fields(state, ns::Terrarium.Namespace) -> Any

Retrieves all Fields declared by the given Namespace from state, where state is assumed to correspond to the (nested) StateVariables of the namespace itself.

source
Terrarium.get_fieldsMethod
get_fields(state, vars)

Retrieves all Fields from state matching the names of the given variables. Any Namespaces in vars are resolved recursively and their fields are merged into the returned NamedTuple keyed by namespace name, with the namespace's own fields collected into a nested NamedTuple.

source
Terrarium.get_fieldsMethod
get_fields(state, components; except)

Retrieves all non-tendency Fields from state defined on the given components.

source
Terrarium.get_fieldsMethod
get_fields(state, queries::Union{Symbol, Pair}...)

Retrieves fields with names given in queries and returns them in a NamedTuple. Each argument in queries can either be a Symbol corresponding to a field/variable defined in the namespace of state or a Pair{Symbol, Tuple} where the key is the child namespace and the value is a tuple of queries from that namespace.

Warning

This method relies on runtime dispatch and thus should not be used in performance-critical code. If you need to query fields for specific sets of variables or components, use one of the type-stable variants instead.

# initialize model state
state = StateVariables(model)
# get the temperature and saturation_water_ice fields
fields = get_fields(state, :temperature, :saturation_water_ice)
# extract temperature as well as variables from a namespace
nested_fields = get_fields(state, :temperature, :namespace => (:subvar1, :subvar2))
source
Terrarium.get_gridMethod
get_grid(model::AbstractModel)::AbstractLandGrid

Return the spatial grid associated with the given model.

source
Terrarium.get_hydraulic_propertiesMethod
get_hydraulic_properties(
    hydrology::SoilHydrology
) -> Terrarium.AbstractSoilHydraulics

Return the soil hydraulic properties defined by the given hydrology process.

source
Terrarium.get_initializerMethod
get_initializer(model::AbstractModel)::AbstractInitializer

Return the initializer associated with the given model.

source
Terrarium.get_spacingMethod
get_spacing(spacing)

Return a Vector of vertical layer thicknesses according to the given discretization.

source
Terrarium.get_swrcFunction
get_swrc(::AbstractUnsatK)

Return the soil water retention curve associated with the given unsaturated hydraulic conductivity scheme.

source
Terrarium.get_swrcMethod
get_swrc(hydrology::SoilHydrology) -> Any

Return the soil water retention curve from the hydraulic_properties associated with the given SoilHydrology configuration.

source
Terrarium.get_swrcMethod
get_swrc(hydrology::AbstractSoilHydrology)

Return the soil water retention curve from the hydraulic_properties associated with the given soil hydrology configuration.

source
Terrarium.ground_evaporation_resistance_factorFunction
ground_evaporation_resistance_factor(i, j, grid, fields, :AbstractGroundEvaporationResistanceFactor, args...)

Compute the resistance factor against ground evaporation [-] based on the current state and implementation-specific process dependencies in args.

source
Terrarium.ground_heat_fluxMethod
ground_heat_flux(i, j, grid, fields, ::AbstractSkinTemperature)

Return the current ground heat flux at the given indices.

source
Terrarium.ground_thermal_interfaceFunction
ground_thermal_interface(
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    snow::Nothing
) -> Tuple{Any, Any, Any}
ground_thermal_interface(
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    snow::Nothing,
    constants
) -> Tuple{Any, Any, Any}

Return the effective conduction target (Tg, κ, Δz) seen by the skin-temperature solve: the temperature of the medium directly beneath the skin, its thermal conductivity, and the half-cell thickness. Without snow (snow === nothing) these are the uppermost ground layer's ground_temperature, the assumed surface conductivity κₛ, and the top ground cell thickness — i.e. the snow-free behavior is unchanged.

source
Terrarium.ground_thermal_interfaceMethod
ground_thermal_interface(
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    snow::Terrarium.AbstractSnow,
    constants::PhysicalConstants
) -> Tuple{Any, Any, Any}

Snow-covered variant: the conduction target is the snow-cover-fraction-weighted blend of the snow layer and the underlying ground, x_eff = (1 − f_snow)·x_ground + f_snow·x_snow for the temperature, conductivity, and half-cell thickness.

source
Terrarium.hydraulic_conductivityFunction

Compute (variably saturated) hydraulic conductivity based on the given hydraulic properties, soil water retention curve (SWRC), and volumetric fractions.

source
Terrarium.hydraulic_conductivityMethod
hydraulic_conductivity(
    i,
    j,
    k,
    grid,
    fields,
    hydrology,
    strat,
    bgc
)

Compute the hydraulic conductivity at the center of the grid cell i, j, k.

source
Terrarium.initialize!Function

Initialize input variables from the given input sources. The scope corresponds to the path of namespace names from the root namespace to state and is used to match namespaced input sources to their target variables; see varpath.

source
Terrarium.initialize!Function
initialize!(state, model::AbstractModel)

Initialize all variables defined in state which are defined by model. This defaults to simply calling initialize!(state, model, get_initializer(model)).

initialize!(state, model::AbstractModel, initializer::AbstractInitializer)

Initialize the model state variables using the corresponding initializer. This method only needs to be implemented if initialization routines are necessary in addition to direct field/variable initializers.

initialize!(state, grid, process::AbstractProcess, args...)

Initialize all state variables associated with the given process on grid. Implementations of AbstractProcess may define additional args that correspond to different process coupling interfaces.

source
Terrarium.initialize!Method
initialize!(inputs, grid, clock, fields, _::InputSource)

Initializes the input source, writing into the input inputs fields at model start. The grid and the full model state fields (read-only) are provided so that sources may compute their inputs from the grid geometry or other state variables. Namespace routing is handled by the caller (see [InputSources]). Default implementation does nothing.

source
Terrarium.initialize!Method
initialize!(
    state,
    grid,
    _::ImplicitSkinTemperature,
    args...
)

Seed the prognostic skin_temperature with the current ground_temperature so the implicit nonlinear solve starts from a physically sensible guess close to the root.

source
Terrarium.initialize!Method
initialize!(
    state,
    grid,
    snow::SingleLayerSnow,
    constants::PhysicalConstants,
    args...
)

Initialize the snow internal energy by evaluating the inverse closure (temperature → energy). Assumes snow_temperature and snow_water_equivalent have already been initialized.

source
Terrarium.initialize!Method

Initialize the soil energy, water, and carbon state variables on grid given the parameter values in constants.

source
Terrarium.initialize!Method
initialize!(
    state,
    grid,
    energy::SoilThermodynamics,
    soil::Terrarium.AbstractSoil,
    constants::PhysicalConstants,
    args...
)
source
Terrarium.initialize!Method

Resets the simulation clock and calls initialize!(state, model) on the underlying model which should reset all state variables to their values as defiend by the model initializer.

source
Terrarium.initialize!Method
initialize!(
    state,
    grid,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    soil::Terrarium.AbstractSoil,
    constants::PhysicalConstants,
    args...
)
source
Terrarium.initialize!Method
initialize!(state, inits::NamedTuple{names}) -> Any

Initialize the state with Field initializers (any valid argument to set!) in inits.

source
Terrarium.initializeMethod
initialize(integrator, params; clock, inputs)

Reconstruct the given integrator using the same underlying model populated with the given params. The clock and inputs can also optionally be updated via their respective keyword arguments.

source
Terrarium.initializeMethod
initialize(timestepper::AbstractTimeStepper, state, progvars, model)

Allocate the time stepper cache for timestepper against the given state. progvars is the named tuple of prognostic variable metadata and model the owning AbstractModel; both are needed e.g. by AbstractIMEX timesteppers to resolve each variable's timestepping class.

source
Terrarium.initializeMethod
initialize(
    var::Terrarium.AbstractVariable,
    grid::Terrarium.AbstractLandGrid,
    clock::Clock,
    boundary_conditions::NamedTuple,
    fields::NamedTuple
) -> Any

Initialize a Field on grid based on the given var metadata. The named tuple of boundary_conditions should follow the standard convention of (var1 = (; top, bottom, ...), var2 = (; top, bottom, ...)). If fields contains a Field matching the name of var, this field will be directly returned. Otherwise, the new Field is constructed using the given boundary_conditions with the other fields being made available to the constructor for auxiliary variables.

source
Terrarium.initializeMethod
initialize(
    var::Terrarium.AuxiliaryVariable,
    grid::Terrarium.AbstractLandGrid,
    clock::Clock,
    boundary_conditions::NamedTuple,
    fields::NamedTuple
) -> Any

Initialize a Field on grid for the given AuxiliaryVariable.

source
Terrarium.initializeMethod
initialize(::AbstractTimeStepper, state)

Initialize and return the AbstractTimeStepperCache holding any intermediate fields/state required by the given timestepper. Time steppers that need no working state fall back to the default implementation, which returns an EmptyCache.

source
Terrarium.initializeMethod
initialize(
    model::Terrarium.AbstractModel{NF, Grid} where Grid<:(Terrarium.AbstractLandGrid{NF});
    ...
) -> Union{ModelIntegrator{_A, _B, _C, _D, var"#s179", StateVariables{NF, prognames, closurenames, auxnames, inputnames, nsnames, ProgFields, TendFields, AuxFields, InputFields, Namespaces, Cache, ClockType}, Clock{_A1, _B1, Float64, Int64, Int64}, @NamedTuple{}, InputSources{NF1, name, Sources}} where {_B<:Oceananigans.Architectures.AbstractArchitecture, _C<:Terrarium.AbstractLandGrid{_A, _B}, _D<:Terrarium.AbstractTimeStepper{_A}, var"#s179"<:Terrarium.AbstractModel{_A, _C}, NF, prognames, closurenames, auxnames, inputnames, nsnames, ProgFields, TendFields, AuxFields, InputFields, Namespaces, Cache, ClockType, _A1, _B1, NF1, name, Sources<:Tuple{Vararg{InputSource{NF1}}}}, ModelIntegrator{_A, Arch, _C, _D, var"#s179", StateVariables{NF, prognames, closurenames, auxnames, inputnames, nsnames, ProgFields, TendFields, AuxFields, InputFields, Namespaces, Cache, ClockType}, Clock{_A1, _B, Float64, Int64, Int64}, @NamedTuple{}, InputSources{NF1, name, Sources}} where {Arch<:Oceananigans.Architectures.AbstractArchitecture, _C<:Terrarium.AbstractLandGrid{_A, Arch}, _D<:Terrarium.AbstractTimeStepper{_A}, var"#s179"<:Terrarium.AbstractModel{_A, _C}, NF, prognames, closurenames, auxnames, inputnames, nsnames, ProgFields, TendFields, AuxFields, InputFields, Namespaces, Cache, ClockType, _A1, _B, NF1, name, Sources<:Tuple{Vararg{InputSource{NF1}}}}} where _A
initialize(
    model::Terrarium.AbstractModel{NF, Grid} where Grid<:(Terrarium.AbstractLandGrid{NF}),
    params;
    clock,
    inputs,
    boundary_conditions,
    initializers,
    fields
) -> Union{ModelIntegrator{_A, _B, _C, _D, var"#s179", StateVariables{NF, prognames, closurenames, auxnames, inputnames, nsnames, ProgFields, TendFields, AuxFields, InputFields, Namespaces, Cache, ClockType}, Clock{_A1, _B1, Float64, Int64, Int64}, @NamedTuple{}, InputSources{NF1, name, Sources}} where {_B<:Oceananigans.Architectures.AbstractArchitecture, _C<:Terrarium.AbstractLandGrid{_A, _B}, _D<:Terrarium.AbstractTimeStepper{_A}, var"#s179"<:Terrarium.AbstractModel{_A, _C}, NF, prognames, closurenames, auxnames, inputnames, nsnames, ProgFields, TendFields, AuxFields, InputFields, Namespaces, Cache, ClockType, _A1, _B1, NF1, name, Sources<:Tuple{Vararg{InputSource{NF1}}}}, ModelIntegrator{_A, Arch, _C, _D, var"#s179", StateVariables{NF, prognames, closurenames, auxnames, inputnames, nsnames, ProgFields, TendFields, AuxFields, InputFields, Namespaces, Cache, ClockType}, Clock{_A1, _B, Float64, Int64, Int64}, @NamedTuple{}, InputSources{NF1, name, Sources}} where {Arch<:Oceananigans.Architectures.AbstractArchitecture, _C<:Terrarium.AbstractLandGrid{_A, Arch}, _D<:Terrarium.AbstractTimeStepper{_A}, var"#s179"<:Terrarium.AbstractModel{_A, _C}, NF, prognames, closurenames, auxnames, inputnames, nsnames, ProgFields, TendFields, AuxFields, InputFields, Namespaces, Cache, ClockType, _A1, _B, NF1, name, Sources<:Tuple{Vararg{InputSource{NF1}}}}} where _A

Creates and initializes a ModelIntegrator for the given model with input variables populated by the given inputs and optionally params . InputSources can be specified via the inputs keyword argument. This method allocates all necessary Fields for the state variables and subsequently calls initialize!(::ModelIntegrator).

Note that this method is not type stable and thus should not be called from Enzyme autodiff. To reinitialize the model for an existing state, use initialize!(state, model).

See the docstring for initialize(::AbstractModel) for further details.

source
Terrarium.initializeMethod
initialize(
    vars::NamedTuple{names, <:Tuple{Vararg{Terrarium.AbstractVariable}}},
    grid::Terrarium.AbstractLandGrid,
    clock::Clock,
    boundary_conditions::NamedTuple,
    fields::NamedTuple
) -> @NamedTuple{}

Initialize Fields on grid for each of the variables in the given named tuple vars. Any predefined boundary_conditions and fields will be passed through to initialize for each variable.

source
Terrarium.inputMethod
input(name, dims; default, units, bounds, desc)

Convenience constructor method for InputVariable.

source
Terrarium.input_fieldsMethod
input_fields(state, components)

Retrieves all Fields from state corresponding to input variables defined on the given components.

source
Terrarium.invclosure!Method
invclosure!(
    state,
    grid,
    closure::SnowEnergyTemperatureClosure,
    snow::SingleLayerSnow,
    constants::PhysicalConstants,
    args...
)

Inverse closure: compute the prognostic snow_energy from a prescribed snow_temperature (used for initialization). snow_water_equivalent must be initialized first, since the snow depth d_snow enters the depth-integrated energy.

source
Terrarium.invclosure!Method
invclosure!(state, grid, closure::AbstractClosureRelation, process::AbstractProcess, args...)

Apply the inverse of closure for the process proc on the given grid with additional implementation-specific args defined by the coupling interface for the process type.

source
Terrarium.invclosure!Method
invclosure!(state, grid, proc::AbstractProcess, args...)

Apply the inverse closure mappings for the process proc on the given grid with additional implementation-specific args defined by the coupling interface for the process type. The default implementation calls invclosure! with args for each closure returned by closures.

source
Terrarium.invclosure!Method
invclosure!(state, model::AbstractModel)

Apply the inverse of all closure relations defined for the given model.

source
Terrarium.invclosure!Method
invclosure!(
    state,
    grid,
    closure::SoilSaturationPressureClosure,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    soil::Terrarium.AbstractSoil,
    args...
)

Computes saturation_water_ice from the current pressure_head state.

source
Terrarium.is_adaptiveFunction
is_adaptive(timestepper::AbstractTimeStepper)

Return true if the given time stepper is adaptive, false otherwise.

source
Terrarium.kernelMethod
kernel(func, args...; clock = false)

Return a KernelFunction that lazily constructs a KernelFunctionOperation from the given func and tuple of args when invoked, i.e:

ctor = kerenl(my_function, arg1, arg2)
...
kfo = ctor(grid, clock, fields)

This is intended to be used as a constructor for AuxiliaryVariables:

myvar(i, j, k, grid, fields) = clamp(fields.x[i, j, k], zero(eltype(grid)), one(eltype(grid)))

auxvar = auxiliary(:myvar, XYZ(), kernel(myvar))
source
Terrarium.latent_heat_fluxMethod
latent_heat_flux(i, j, grid, fields, ::AbstractTurbulentFluxes)

Return the current latent heat flux at the given indices.

source
Terrarium.liquid_water_fractionFunction
liquid_water_fraction(i, j, k, grid, fields, ::AbstractSoilHydrology)

Compute or retrieve the current fraction of unfrozen water in the pore space.

source
Terrarium.liquid_water_fractionMethod
liquid_water_fraction(_::FreeWater, U, ρLθ) -> Any

Calculate the unfrozen water content from the given internal energy U (J/m³) and volumetric latent heat content ρLθ (J/m³).

source
Terrarium.load_assetMethod
load_asset(
    asset::Terrarium.AbstractLandAsset,
    name::String;
    NF,
    fill_value
) -> Union{RingGrids.FullGaussianField{_A, _B, <:AbstractArray{T, N}, RingGrids.FullGaussianGrid{SpeedyWeatherInternals.Architectures.CPU{KernelAbstractions.CPU}, Vector{UnitRange{Int64}}, Vector{Int64}, Int64}} where {_A, _B}, RingGrids.FullClenshawField{_A, _B, <:AbstractArray{T, N}, RingGrids.FullClenshawGrid{SpeedyWeatherInternals.Architectures.CPU{KernelAbstractions.CPU}, Vector{UnitRange{Int64}}, Vector{Int64}, Int64}} where {_A, _B}}

Download (if necessary) the given asset via get_asset and read the variable name from its data file, returning a suitable Field based on the asset's native_grid with element type NF. The asset's indices are applied when reading (e.g. to select a single time record), and fill_value replaces missing data; it defaults to NF(NaN).

The underlying read is dispatched to an I/O extension based on the asset's format; load Rasters.jl and NCDatasets.jl to enable reading NetCDF and other raster files.

source
Terrarium.locate_asset_fileMethod
locate_asset_file(
    dir::String,
    format::Terrarium.FileFormat
) -> String

Locate the single data file of the given format within an installed artifact directory dir, searching recursively. Errors unless exactly one matching file is found.

source
Terrarium.longwave_downMethod
longwave_down(i, j, grid, fields, ::AbstractAtmosphere{NF, PR, <:LongShortWaveRadiation})

Retrieve or compute the incoming/downwelling longwave radiation at the current time step.

source
Terrarium.longwave_upMethod
longwave_up(i, j, grid, fields, ::AbstractRadiativeFluxes)

Return the current outgoing (upwelling) longwave radiation at the given indices i, j.

source
Terrarium.matches_scopeMethod
matches_scope(
    source::InputSource,
    scope::Tuple{Vararg{Symbol}}
) -> Union{Missing, Bool}

Determine whether the given source provides an input variable for the namespace at the given scope, where scope is the path of namespace names from the root namespace, i.e. () for the root namespace itself, (:ns1,) for its child namespace ns1, and so on.

source
Terrarium.merge_namespacesMethod
merge_namespaces(namespaces)

Merge all Namespaces with matching names into a single Namespace containing the union of their variables.

source
Terrarium.min_zᵃᵃᶠMethod
min_zᵃᵃᶠ(i, j, k, grid, x)
min_zᵃᵃᶠ(i, j, k, grid, f, args...)

Computes the field or function at the vertical (z-axis) face by taking the min of the two adjacent vertical layers.

source
Terrarium.mineral_porosityFunction
mineral_porosity(::AbstractSoilPorosity, texture::SoilTexture)

Compute or retrieve the natural porosity of the mineral soil constitutents, i.e. excluding organic material.

source
Terrarium.mineral_textureFunction
organic_fraction(::AbstractSoilMatrix)

Return the SoilTexture describing the mineral component of the soil matrix.

source
Terrarium.mineral_thermal_conductivityMethod
mineral_thermal_conductivity(conductivities, texture)

Compute the thermal conductivity of the mineral grains for the given texture as the quartz-weighted geometric mean of the quartz and non-quartz mineral endpoints ([31]; [32]):

\[\lambda_{\text{min}} = \lambda_q^{\,q} \, \lambda_o^{\,1 - q}\]

where the quartz volume fraction $q$ is assumed equal to the sand fraction.

source
Terrarium.normalize_texture!Method
normalize_texture!(
    sand::Oceananigans.Fields.AbstractField{LX, LY, LZ, G, NF},
    silt::Oceananigans.Fields.AbstractField{LX, LY, LZ, G, NF},
    clay::Oceananigans.Fields.AbstractField{LX, LY, LZ, G, NF};
    default
)

Normalize the given sand, silt, and clay fraction Fields in place such that the fractions sum to unity in each element, as required by the SoilTexture constructor.

source
Terrarium.ntdiffMethod
ntdiff(
    nt::NamedTuple,
    other::NamedTuple{excluded}
) -> NamedTuple

Filters out all entries from nt that exist in other; like setdiff but for NamedTuple.

source
Terrarium.organic_fractionMethod
organic_fraction(
    i,
    j,
    k,
    grid,
    fields,
    strat::SoilStratigraphy,
    bgc::Terrarium.AbstractSoilBiogeochemistry
) -> Any

Compute the organic fraction of solid material in the soil volume at index i, j, k.

source
Terrarium.organic_porosityFunction
organic_porosity(::AbstractSoilPorosity, texture::SoilTexture)

Compute or retrieve the natural porosity of the organic soil constitutents, i.e. excluding mineral material.

source
Terrarium.porosityMethod
porosity(
    i,
    j,
    k,
    grid,
    fields,
    strat::SoilStratigraphy,
    bgc::Terrarium.AbstractSoilBiogeochemistry
) -> Any

Compute the porosity of the soil volume at the given indices.

source
Terrarium.porosityMethod
porosity(horizon::Terrarium.AbstractSoilHorizon) -> Any

Return the porosity parameterization for the given soil horizon.

source
Terrarium.processesMethod
processes(obj::Union{AbstractCoupledProcesses, AbstractModel})

Return a tuple of AbstractProceses contained in the given model or coupled processes type. Note that this is a type-stable, @generated function that is compiled for each argument type.

source
Terrarium.prognosticMethod
prognostic(name, dims; units, closure, bounds, desc)

Convenience constructors for PrognosticVariable.

source
Terrarium.prognostic_fieldsMethod
prognostic_fields(state, components)

Retrieves all Fields from state corresponding to prognostic variables defined on the given components.

source
Terrarium.rainfallMethod
rainfall(i, j, grid, fields, ::AbstractAtmosphere{NF, <:RainSnow})

Retrieve or compute the liquid precipitation (rainfall) at the current time step.

source
Terrarium.rainfall_groundFunction
rainfall_ground(i, j, grid, fields, ::AbstractCanopyInterception)

Compute or retrieve the current rate of precipitation reaching the ground [m/s].

source
Terrarium.relative_to_specific_humidityMethod
relative_to_specific_humidity(r_h, pr, T, c::ThermodynamicConstants)

Derives specific humidity from measured relative humidity r_h [%], air pressure pr [Pa], air temperature T [°C], and physical constants c. Assumes saturation over ice for T <= 0°C and over liquid water otherwise. Wrapper around q_vap_from_RH.

source
Terrarium.relaxed_updateMethod
relaxed_update(
    relax::Terrarium.RelaxationFactor{NF},
    x_target,
    x_old
) -> Any

Apply the under-relaxed fixed-point update to the skin temperature.

source
Terrarium.root_densityFunction
root_density(::AbstractRootDistribution, z, args...)

Compute the continuous density function of the given root distirbution as a function of depth z. Note that this function must be integrated and normalized over the root zone in order to obtain the cumulative root fraction in each soil layer.

source
Terrarium.root_densityMethod
root_density(
    rd::StaticExponentialRootDistribution{NF},
    z
) -> Any

Compute the continuous density function of the root distirbution as a function of depth z.

source
Terrarium.run_timesteps!Function
run_timesteps!(integrator, Δt, Nt, checkpointing = false)

Advance integrator by Nt steps of size Δt.

The generic (host) implementation is a plain loop and ignores checkpointing. ReactantState integrators override this method in TerrariumReactantExt, compiling the loop into a single traced program in which checkpointing selects the reverse-mode-AD checkpointing scheme (false, or a scheme such as Reactant.Periodic(n)).

source
Terrarium.safedivMethod
safediv(x, y)

Evaluates x / (y + eps(NF)) if and only if y != zero(y); returns Inf otherwise.

source
Terrarium.saturation_water_iceFunction
saturation_water_ice(i, j, k, grid, fields, ::AbstractSoilHydrology)

Compute or retrieve the current saturation level of water + ice in the pore space.

source
Terrarium.shortwave_downMethod
shortwave_down(i, j, grid, fields, ::AbstractAtmosphere{NF, PR, <:LongShortWaveRadiation})

Retrieve or compute the incoming/downwelling shortwave radiation at the current time step.

source
Terrarium.shortwave_upMethod
shortwave_up(i, j, grid, fields, ::AbstractRadiativeFluxes)

Return the current outgoing (upwelling) shortwave radiation at the surface.

source
Terrarium.skin_temperatureMethod
skin_temperature(i, j, grid, fields, ::AbstractSkinTemperature)

Return the current skin temperature at the given indices.

source
Terrarium.snow_cover_fractionFunction
snow_cover_fraction(i, j, grid, fields, ::AbstractSnow)

Compute or retrieve the sub-grid snow-covered area fraction f_snow ∈ [0,1].

source
Terrarium.snow_densityMethod
snow_density(density::ConstantSnowDensity) -> Any

Return the constant bulk snow density ρ_snow [kg/m³].

source
Terrarium.snow_densityMethod
snow_density(snow::SingleLayerSnow) -> Any

Bulk snow density ρ_snow [kg/m³] of the snowpack, delegating to the process's density scheme.

source
Terrarium.snow_depthFunction
snow_depth(i, j, grid, fields, ::AbstractSnow)

Compute or retrieve the snow layer depth d_snow [m].

source
Terrarium.snow_energyFunction
snow_energy(i, j, grid, fields, ::AbstractSnow)

Retrieve the depth-integrated (column) snow internal energy Ū_snow [J/m²] relative to ice at 0°C.

source
Terrarium.snow_water_equivalentFunction
snow_water_equivalent(i, j, grid, fields, ::AbstractSnow)

Retrieve the snow water equivalent (SWE) W (m) — the total water substance (ice + retained liquid).

source
Terrarium.snowfallMethod
snowfall(i, j, grid, fields, ::AbstractAtmosphere{NF, <:RainSnow})

Retrieve or compute the frozen precipitation (snowfall) at the current time step.

source
Terrarium.soil_horizonMethod
soil_horizon(
    i,
    j,
    k,
    grid,
    fields,
    strat::SoilStratigraphy{NF, N, Horizons} where {N, Horizons<:NTuple{N, Terrarium.AbstractSoilHorizon{NF}}}
) -> Any

Retrieve the soil horizon for the soil volume at index i, j, k. The last soil horizon in strat is assumed to extend to the bottom of the vertical column regardless of its associated thickness. Note that, since SoilStratigraphy uses namespaces for the state variables of each horizon, any methods defined on AbstractSoilHorizon types should be passed the namespace, e.g:

horizon = soil_horizon(i, j, k, grid, fields, strat)
texture = soil_texture(i, j, grid, getproperty(fields, nameof(horizon)), horizon)
source
Terrarium.soil_matrixFunction
soil_matrix(i, j, grid, fields, ::AbstractSoilHorizon, args...)
soil_matrix(i, j, k, grid, fields, ::AbstractStratigraphy, args...)

Return the solid matrix of the soil at index i, j, k for the given stratigraphy parameterization.

source
Terrarium.soil_matrixMethod
soil_matrix(
    i,
    j,
    k,
    grid,
    fields,
    strat::Terrarium.AbstractStratigraphy,
    bgc::Terrarium.AbstractSoilBiogeochemistry
) -> MineralOrganic

Compute and return the soil solid matrix at index i, j, k on grid. The default implementation assumes a simple MineralOrganic parameterization of the solid material.

source
Terrarium.soil_moisture_limiting_factorMethod
soil_moisture_limiting_factor(
    grid,
    clock,
    fields,
    _::FieldCapacityLimitedPAW
) -> Field{LX, LY, LZ, O, G, I, D, T, B, Oceananigans.Fields.FieldStatus{Float64}} where {LX, LY, LZ, O, G, I, D, T, B}

Field constructor for the soil moisture limiting factor. Returns a derived Field that calculates the integral of W(z) * r(z) where W is the water availability coefficient and r is the root fraction.

source
Terrarium.soil_surface_water_fluxFunction
soil_surface_water_flux(
    i,
    j,
    grid,
    fields,
    canopy_interception::Terrarium.AbstractCanopyInterception
) -> Any
soil_surface_water_flux(
    i,
    j,
    grid,
    fields,
    canopy_interception::Terrarium.AbstractCanopyInterception,
    snow::Union{Nothing, Terrarium.AbstractSnow}
) -> Any

Meltwater flux [m/s] reaching the soil surface, accounting for the snowpack. Without snow this is just the rainfall reaching the ground; with snow the snow-covered fraction f_snow intercepts rain into the snowpack, so only the bare-ground fraction (1 − f_snow)·rain_ground reaches the soil directly, plus the snow meltwater outflow M draining from the snowpack base.

source
Terrarium.soil_textureFunction
soil_texture(i, j, grid, fields, ::AbstractSoilHorizon, args...)
soil_texture(i, j, k, grid, fields, ::AbstractStratigraphy, args...)

Return the texture of the soil at index i, j, k for the given stratigraphy parameterization.

source
Terrarium.soil_textureMethod
soil_texture(
    i,
    j,
    k,
    grid,
    fields,
    strat::SoilStratigraphy{NF, N, Horizons} where {N, Horizons<:NTuple{N, Terrarium.AbstractSoilHorizon{NF}}}
) -> Any

Retrieve the soil texture of the soil volume at index i, j, k in the given stratigraphy strat.

source
Terrarium.soil_volumeFunction
soil_volume(i, j, k, grid, fields, ::AbstractStratigraphy, args...)

Return a SoilComposition describing the full material composition of the soil volume at index i, j, k for the given stratigraphy parameterization.

source
Terrarium.soil_volumeMethod
soil_volume(i, j, k, grid, fields, strat, hydrology, bgc)

Construct a SoilComposition object summarizing the material composition of the soil volume at the given indices i, j, k on grid.

source
Terrarium.solve!Function
solve!(out, indices, grid, fields, objective_func!::ObjectiveFunction, solver, args...; kwargs...)

Solve the nonlinear problem defined by objective_func! for its target field at the given indices, mutating out in place. The objective returns the residual F(x) whose root is sought; on return, the target field holds the converged estimate and the method returns the root (and, for some solvers, the number of iterations performed). Dispatches on the concrete solver type, e.g. RootSolver or FixedPointSolver.

source
Terrarium.solve_skin_temperature!Method
solve_skin_temperature!(
    out,
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    snow,
    seb_args...
) -> Any

Run a full nonlinear solve to determine the skin_temperature at grid cell i, j that solves the surface energy balance.

source
Terrarium.solve_surface_energy_balance!Method
solve_surface_energy_balance!(
    state,
    grid,
    seb::SurfaceEnergyBalance{NF, SkinTemperature, TurbulentFluxes, RadiativeFluxes, Albedo} where {SkinTemperature<:Terrarium.AbstractSkinTemperature{NF}, TurbulentFluxes<:Terrarium.AbstractTurbulentFluxes{NF}, RadiativeFluxes<:Terrarium.AbstractRadiativeFluxes{NF}, Albedo<:Terrarium.AbstractAlbedo{NF}},
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
)
solve_surface_energy_balance!(
    state,
    grid,
    seb::SurfaceEnergyBalance{NF, SkinTemperature, TurbulentFluxes, RadiativeFluxes, Albedo} where {SkinTemperature<:Terrarium.AbstractSkinTemperature{NF}, TurbulentFluxes<:Terrarium.AbstractTurbulentFluxes{NF}, RadiativeFluxes<:Terrarium.AbstractRadiativeFluxes{NF}, Albedo<:Terrarium.AbstractAlbedo{NF}},
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology}
)
solve_surface_energy_balance!(
    state,
    grid,
    seb::SurfaceEnergyBalance{NF, SkinTemperature, TurbulentFluxes, RadiativeFluxes, Albedo} where {SkinTemperature<:Terrarium.AbstractSkinTemperature{NF}, TurbulentFluxes<:Terrarium.AbstractTurbulentFluxes{NF}, RadiativeFluxes<:Terrarium.AbstractRadiativeFluxes{NF}, Albedo<:Terrarium.AbstractAlbedo{NF}},
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology},
    snow::Union{Nothing, Terrarium.AbstractSnow},
    args...
)

Solve the surface energy balance for skin temperature on grid based on the current atmospheric and surface hydrology state.

source
Terrarium.specific_heat_capacity_moist_airMethod
specific_heat_capacity_moist_air(c::ThermodynamicConstants, q)

Compute the isobaric specific heat capacity [J/(kg*K)] of moist air as a function of the total specific humidity q [kg/kg]. Wrapper around cp_m.

source
Terrarium.specific_humidityMethod
specific_humidity(i, j, grid, fields, ::PrescribedAtmosphere{PR, IR, <:SpecificHumidity})

Retrieve or compute the specific_humidity at the current time step.

source
Terrarium.specific_humidity_differenceMethod
specific_humidity_difference(
    c::ThermodynamicConstants,
    p,
    q_air,
    T
) -> Any

Computes the difference in specific humidity between a saturated surface at temperature T [°C] and the atmosphere, defined by its specific humidity q_air [kg/kg] and pressure p [Pa].

source
Terrarium.stefan_boltzmannMethod
stefan_boltzmann(c::UniversalConstants, T, ϵ)

Stefan-Boltzmann law $M = \epsilon \sigma T^4$ where T is the surface temperature in Kelvin and ϵ is the emissivity and σ is the Stefan-Boltzmann constant.

source
Terrarium.surface_excess_waterFunction
surface_excess_water(i, j, k, grid, fields, ::AbstractSoilHydrology)

Retrieve the current saturation level of water + ice in the pore space.

source
Terrarium.surface_humidity_fluxFunction
surface_humidity_flux(i, j, grid, fields, ::AbstractEvapotranspiration)

Compute the surface humidity flux [m/s] at cell i, j based on the current state.

source
Terrarium.temperature_to_energy!Method
temperature_to_energy!(
    out,
    i,
    j,
    grid,
    fields,
    _::SnowEnergyTemperatureClosure,
    snow::SingleLayerSnow,
    constants::PhysicalConstants
)

Compute the depth-integrated snow energy from a prescribed temperature at grid cell i, j.

source
Terrarium.tendencyMethod
tendency(var)

Creates an AuxiliaryVariable for the tendency of a prognostic variable with the given name, dimensions, and physical units. This constructor is primarily used internally by other constructors and does not usually need to be called by implementations of variables.

source
Terrarium.tendency_fieldsMethod
tendency_fields(state, components)

Retrieves all Fields from state corresponding to tendencies defined on the given components.

source
Terrarium.timestep!Function
timestep!(integrator::ModelIntegrator, timestepper::AbstractTimeStepper, Δt)

Advance prognostic variables of the integrator model by one time step based on the current state, or by Δt units of time.

source
Terrarium.timestep!Method
timestep!(state, model::AbstractModel, timestepper::AbstractTimeStepper, Δt)

Apply any necessary corrections or model-specific time stepping logic after applying timestepper to the prognostic state variables defined by model.

source
Terrarium.timestep!Method
timestep!(integrator::ModelIntegrator, timestepper::AbstractIMEX, Δt)

Advance the model forward by one timestep of size Δt using an AbstractIMEX timestepper. Each prognostic variable is routed to the explicit or implicit sub-stepper according to the resolved classes stored in the IMEXCache type; each sub-stepper fetches its own sub-cache via get_cache. The clock is advanced once for the whole step.

source
Terrarium.timestep!Method
timestep!(integrator::ModelIntegrator, timestepper::AbstractTimeStepper, Δt)

Advance the model forward by one timestep of size Δt using a single timestepper, which integrates all prognostic variables. Dispatches on the timestepper's timestepping trait (Explicit/Implicit) to timestep!(integrator, timestepper, ::Timestepping, Δt).

source
Terrarium.timestep!Method
timestep!(integrator::ModelIntegrator, timestepper::AbstractTimeStepper, ::Timestepping, Δt)

Trait-dispatched single-timestepper step: forward the prognostic variable names to the scheme's timestep!(integrator, timestepper, Δt, names) method and advance the clock once for the whole step.

source
Terrarium.timestep!Method
timestep!(integrator::ModelIntegrator; finalize)

Advance the model forward by one timestep with optional timestep size Δt. If finalize = true, compute_auxiliary! is called after the time step in order to update the values of auxiliary/diagnostic variables.

source
Terrarium.timesteppingMethod
timestepping(timestepper::AbstractTimeStepper)::Timestepping

Return the Timestepping trait — Explicit or Implicit — of the given timestepper. Every concrete timestepper must define this trait (e.g. timestepping(::ForwardEuler) = Explicit()); there is no default so that a new scheme declares its class explicitly. It is used, among other things, to route each sub-stepper of an AbstractIMEX to its slice of the IMEXCache.

timestepping(var::AbstractVariable, model::AbstractModel, timestepper::AbstractTimeStepper)::Timestepping

Return the Timestepping class with which the prognostic variable var of model is integrated under timestepper. Defaults to Explicit() for all variables; specialize this method (typically on an AbstractIMEX timestepper together with particular variable and/or model types) to route selected variables to the implicit sub-stepper.

source
Terrarium.transpiration_conductanceMethod
transpiration_conductance(
    _::PALADYNCanopyEvapotranspiration{NF},
    rₐ,
    g_stm
) -> Any

Compute the transpiration vapor conductance [m/s] from aerodynamic resistance rₐ and stomatal conductance g_stm. The transpiration flux is this conductance times the humidity gradient.

source
Terrarium.update_inputs!Function

Update input variables from the given input sources. The scope corresponds to the path of namespace names from the root namespace to state and is used to match namespaced input sources to their target variables; see varpath.

source
Terrarium.update_inputs!Method
update_inputs!(inputs, grid, clock, fields, _::InputSource)

Updates the values of the input variables stored in inputs from the given input source, called at every time step. The grid and the full model state fields (read-only) are provided so that sources may compute their inputs from the grid geometry or other state variables. Namespace routing is handled by the caller (see [InputSources]). Default implementation returns nothing.

source
Terrarium.vapor_pressure_deficitMethod
vapor_pressure_deficit(c, T, pres, q_air)

Computes the vapor pressure deficit for an air parcel at temperature T [°C] with pressure pres [Pa] and specific humidity q_air [kg/kg]. Assumes that air parcel is over water when T > 0°C and over ice when T < 0°C. Wrapper around vapor_pressure_deficit.

source
Terrarium.varFunction
var(name, dims)
var(name, dims, units)

Convenience constructor for Variable.

source
Terrarium.variablesFunction
variables(model::AbstractModel)
variables(process::AbstractProcess)

Return a Tuple of AbstractVariables (i.e. PrognosticVariable, AuxiliaryVariable, etc.) defined by the model or process.

source
Terrarium.variablesMethod
variables(
    _::InputSource
) -> Tuple{Union{Terrarium.InputVariable{_A, VD, UT, _B, DomainSets.RealLine{Float64}, Nothing} where {_A, VD<:Terrarium.VarDims, UT<:Unitful.Units, _B<:Terrarium.Variable{_A, VD, UT}}, Terrarium.Namespace}}

Returns a tuple of Symbols corresponding to variable names supported by this InputSource.

source
Terrarium.varnameMethod
varname(source::InputSource)

Returns the name of the input variable provided by this source, i.e. the last entry of its varpath.

source
Terrarium.varnameMethod
varname(_)

Retrieve the name of the given variable or closure. For closure relations, varname should return the name of the variable returned by the closure relation.

source
Terrarium.varpathMethod
varpath(name::Symbol)
varpath(path::Pair)
varpath(path::Tuple{Vararg{Symbol}})

Normalize the given variable name into a path of the form (namespace_1, ..., namespace_N, varname). Plain Symbol names correspond to variables in the root namespace, i.e. the path (varname,). Namespaced variables can be specified either as Pairs, e.g. :ns1 => :ns2 => :varname, or directly as a tuple of Symbols, e.g. (:ns1, :ns2, :varname).

source
Terrarium.vegetation_area_fractionFunction
vegetation_area_fraction(i, j, grid, fields, ::AbstractVegetationDynamics)

Return the fraction of the grid cell i, j covered by vegetation of any type.

source
Terrarium.volumetric_fractionsMethod
volumetric_fractions(soil::SoilComposition) -> NamedTuple

Calculates the volumetric fractions of all constituents in the given soil volume and returns them as a named tuple of the form (; water, ice, air, solids...), where solids corresponds to the volumetric fractions defined by the solid phase soil.solid.

source
Terrarium.volumetric_fractionsMethod
volumetric_fractions(
    solid::MineralOrganic{NF},
    solid_frac
) -> NamedTuple{(:organic, :mineral), <:Tuple{Any, Any}}

Compute the volumetric fractions of the solid phase scaled by the overall solid fraction of the soil solid_frac.

source
Terrarium.water_tableFunction
water_table(i, j, k, grid, fields, ::AbstractSoilHydrology)

Compute or retrieve the current water table level relative to the surface.

source
Terrarium.windspeedMethod
windspeed(i, j, grid, fields, ::PrescribedAtmosphere)

Retrieve or compute the windspeed at the current time step.

source
Terrarium.with_scopeMethod
with_scope(path, var)

Wrap the given variable var in nested Namespaces according to the path, where path is the namespace scope (i.e. the sequence of enclosing namespace names, excluding the variable's own name). An empty path returns var unwrapped.

source
Terrarium.with_soil_horizonMethod
with_soil_horizon(
    func,
    i,
    j,
    k,
    grid,
    fields,
    strat::SoilStratigraphy,
    args...;
    kwargs...
) -> Any

Convenience method that invokes func(i, j, grid, horizon_fields, horizon, args...; kwargs...) where horizon is the soil horizon returned by soil_horizon and horizon_fields is getproperty(fields, nameof(horizon)).

source
Core.TypeMethod
(::Type{Model})(grid::AbstractLandGrid; kwargs...) where {Model <: AbstractModel}

Convenience constructor for all AbstractModel types that accepts grid as a positional argument.

source
Oceananigans.Fields.FieldType
Field(
    grid::AbstractLandGrid,
    dims::VarDims,
    boundary_conditions = nothing,
    args...;
    kwargs...
)

Auxiliary constructor for an Oceananigans Field on grid with the given Terrarium variable dims and boundary conditions. Additional arguments are passed direclty to the Field constructor. The location of the Field is determined by VarDims defined on var.

source
Oceananigans.Fields.FieldMethod
Field(ring_field, grid; default_value)

Converts a RingGrids.Field to an Oceananigans Field using the given ColumnRingGrid. Only masked grid points are copied to the Oceananigans field. For 2D RingGrids fields, returns a 2D Oceananigans field. For 3D fields, returns a 3D field.

source
RingGrids.FieldMethod
Field(field, grid; fill_value)

Converts the given Oceananigans Field to a RingGrids.Field with a ring grid matching that of the given ColumnRingGrid.

source
Terrarium.AbstractAerodynamicsType
abstract type AbstractAerodynamics{NF}

Base type for aerodynamic parameterizations that compute the bulk drag coefficient for turbulent heat and moisture exchange between the land surface and atmosphere.

source
Terrarium.AbstractAtmosphereType
abstract type AbstractAtmosphere{NF, PR<:Terrarium.AbstractPrecipitation, IR<:Terrarium.AbstractIncomingRadiation, HM<:Terrarium.AbstractHumidity, AD<:Terrarium.AbstractAerodynamics{NF}} <: Terrarium.AbstractProcess{NF}

Base type for representations of the atmosphere that provide meterological state variables such as air temperature and pressure, humidity, precipitation, incoming solar radiation, tracer gas concentrations, wind speed, and near-surface aerodynamics.

source
Terrarium.AbstractClosureRelationType
abstract type AbstractClosureRelation

Base type for prognostic variable closure relations for differential equations of the form:

\[\frac{\partial g(u)}{\partial t} = F(u)\]

where F represents the RHS tendency as a function of the state variable u, and g(u) is a closure or constitutive relation that maps u to the physical units matching the tendency. Common examples in soil hydrothermal modeling are temperature-enthalpy and saturation-pressure relations.

source
Terrarium.AbstractCoupledProcessesType
abstract type AbstractCoupledProcesses{NF} <: Terrarium.AbstractProcess{NF}

Base type for AbstractProces implementations that define a coupling interface for (typically two or more) sub-processes.

source
Terrarium.AbstractEnergyClosureType
abstract type AbstractEnergyClosure <: Terrarium.AbstractClosureRelation

Base type for closure relations between internal energy and temperature in a material volume.

source
Terrarium.AbstractHumidityType
abstract type AbstractHumidity

Base type for representations of near-surface atmospheric humidity. Subtypes define which form of humidity (e.g. specific or relative humidity) is used as input.

source
Terrarium.AbstractIMEXType
abstract type AbstractIMEX{NF} <: Terrarium.AbstractTimeStepper{NF}

Base type for implicit-explicit (IMEX) time steppers. An AbstractIMEX integrates each prognostic variable with one of two sub-steppers depending on its timestepping class: variables of class Explicit are stepped by the explicit sub-stepper and those of class Implicit by the implicit sub-stepper.

Concrete subtypes (e.g. IMEX) must provide the explicit and implicit sub-steppers via explicit_timestepper and implicit_timestepper; most other behavior is defined here against AbstractIMEX.

source
Terrarium.AbstractIncomingRadiationType
abstract type AbstractIncomingRadiation

Base type for representations of downwelling (incoming) radiation. Subtypes define which spectral components are provided as inputs (e.g. split into shortwave and longwave).

source
Terrarium.AbstractInitializerType

Base type for model initializers. Implementations should provide a dispatch of the initialize!(state, model::M, init::I) method where M corresponds to the model type and I to the initializer. An implementation of get_field_initializers can also be provided which returns a NamedTuple of initializer functions for individual state variable fields.

source
Terrarium.AbstractModelType
abstract type AbstractModel{NF, Grid<:(Terrarium.AbstractLandGrid{NF})}

Base type for all Terrarium "models". Models are standalone representations of a system that consist of

(i) a spatial grid characterizing the model domain, (ii) zero or more AbstractProcesses defining the dynamics, and (iii) an AbstractInitializer responsible for defining the initial state of the model.

Implementations of AbstractModel are required to implement, at minimum, three methods:

  • variables which declares the state variables requried by the model,
  • compute_auxiliary! which is responsible for computing all auxiliary (non-prognostic) variables,
  • compute_tendencies! which is responsible for computing the tendencies of all prognostic variables.

Note that a default implementation of variables is provided which automatically collects all variables declared by AbstractProcesses defined as fields (properties) of structs that subtype AbstractModel.

source
Terrarium.AbstractPlantAvailableWaterType
abstract type AbstractPlantAvailableWater{NF} <: Terrarium.AbstractProcess{NF}

Base type for processes that comptue the plant available water fraction in each soil layer.

source
Terrarium.AbstractPrecipitationType
abstract type AbstractPrecipitation

Base type for representations of atmospheric precipitation. Subtypes define which variables describe the precipitation input (e.g. rain and snow as separate fields).

source
Terrarium.AbstractProcessType
abstract type AbstractProcess{NF}

Base type for all "processes". Implementations of AbstractProcess define equations, state variables, and parameterizations which characterize the dynamics of a system at for any given transient state. Note that processes should be largely agnostic to the details regarding spatial and temporal discretization of the model; i.e. they should not require specification of a specific grid or time stepping scheme but rather should be able to operate on any given set of Fields and parameters representing the state of a model at any point in time. Note that process types may also wrap/orchestrate one or more other process types.

source
Terrarium.AbstractSnowType
abstract type AbstractSnow{NF} <: Terrarium.AbstractCoupledProcesses{NF}

Base type for coupled snow processes. Implementations should typically couple an energy balance and a mass (water equivalent) balance for a snowpack overlying the ground surface. Snow is modeled as its own coupled process (a sibling of soil), reusing the medium-agnostic FreeWater enthalpy relations for the energy↔temperature closure (the same closure used for the soil; see Soil energy balance).

source
Terrarium.AbstractSoilType
abstract type AbstractSoil{NF} <: Terrarium.AbstractCoupledProcesses{NF}

Base type for coupled soil processes.

source
Terrarium.AbstractSoilHorizonType
abstract type AbstractSoilHorizon{NF, name}

Base type for soil "horizons", i.e. vertical segments of soil with homogeneous soil properties and a user-defined name.

source
Terrarium.AbstractSoilHydraulicsType
abstract type AbstractSoilHydraulics{NF, RC<:SWRC, UnsatK<:Terrarium.AbstractUnsatK}

Base type for soil hydraulic properties and parameterization schemes.

source
Terrarium.AbstractSoilHydrologyType
abstract type AbstractSoilHydrology{NF} <: Terrarium.AbstractProcess{NF}

Base type for soil hydrology implementations. Subtypes should define state variables for saturation_water_ice, hydraulic_conductivity, liquid_water_fraction, and the current water_table level, along with any other implementation-specific state variables.

source
Terrarium.AbstractSoilThermodynamicsType
abstract type AbstractSoilThermodynamics{NF} <: Terrarium.AbstractThermodynamics{NF}

Base type for soil energy balance process implementations. Subtypes should define state variables for soil temperature, internal_energy, and any other relevant thermal properties or state variables. Soil energy balances evolve the soil internal energy and therefore subtype AbstractThermodynamics.

source
Terrarium.AbstractSoilWaterClosureType
abstract type AbstractSoilWaterClosure <: Terrarium.AbstractClosureRelation

Base type for closure relations between water saturation and potential in soil volumes.

source
Terrarium.AbstractThermodynamicsType
abstract type AbstractThermodynamics{NF} <: Terrarium.AbstractProcess{NF}

Base type for energy balance process implementations that evolve the internal energy of a solid or porous material medium.

source
Terrarium.AbstractVegetationType
abstract type AbstractVegetation{NF} <: Terrarium.AbstractCoupledProcesses{NF}

Base type for coupled vegetation (carbon) processes.

source
Terrarium.AuxiliaryVariableType
struct AuxiliaryVariable{name, VD<:Terrarium.VarDims, UT<:Unitful.Units, Var<:Terrarium.Variable{name, VD<:Terrarium.VarDims, UT<:Unitful.Units}, BT<:IntervalSets.AbstractInterval, FC} <: Terrarium.AbstractProcessVariable{name, VD<:Terrarium.VarDims, UT<:Unitful.Units}

Represents an auxiliary (a.k.a "diagnostic") state variable with the given name and spatial dims. Auxiliary variables are those which are diagnosed directly or indirectly from the values of one or more prognostic variables.

source
Terrarium.BareGroundEvaporationType
BareGroundEvaporation{NF, GR} <: AbstractEvapotranspiration

Evaporation scheme for bare ground that calculates the humidity flux as

\[E = \beta \frac{\Delta q}{r_a}\]

where Δq is the specific humidity difference, rₐ is aerodynamic resistance, and β is an evaporation limiting factor.

source
Terrarium.ColumnGridType
ColumnGrid{NF, Arch<:AbstractArchitecture, RectGrid<:Oceananigans.Grids.RectilinearGrid} <: AbstractLandGrid

Represents a set of laterally independent vertical columns with dimensions (x, y, z) where x is the column dimension, y=1 is constant, and z is the vertical axis.

source
Terrarium.ColumnRingGridType
struct ColumnRingGrid{NF, Arch, RingGrid<:RingGrids.AbstractGrid, RectGrid<:Oceananigans.Grids.RectilinearGrid, Mask<:AbstractArray} <: Terrarium.AbstractColumnGrid{NF, Arch}

Represents a global (spherical) grid of independent, vertical columns where the spatial discretization in the horizontal direction is defined by a RingGrids.AbstractGrid.

source
Terrarium.ConstantAerodynamicsType
struct ConstantAerodynamics{NF} <: Terrarium.AbstractAerodynamics{NF}

Dummy implementation of aerodynamics that simply returns constant values for all drag coefficients.

source
Terrarium.ConstantAlbedoType
struct ConstantAlbedo{NF} <: Terrarium.AbstractAlbedo{NF}

Properties:

  • albedo::Any: Surface albedo, i.e. ratio of outgoing to incoming shortwave radiation

  • emissivity::Any: Surface emissivity, i.e. fraction of thermal radiation emitted from the surface

source
Terrarium.ConstantSaturationType
struct ConstantSaturation{NF} <: Terrarium.AbstractInitializer{NF}

Initializer for soil water/ice sets the saturation profile to a constant value.

Properties:

  • sat::Any
source
Terrarium.ConstantSnowAlbedoType
struct ConstantSnowAlbedo{NF}

Basic constant albedo scheme for snow that treats both albedo and emissivity as both spatially and temporally constants. The default values are for freshly fallen snow, taken from [12].

source
Terrarium.ConstantSnowDensityType
struct ConstantSnowDensity{NF} <: Terrarium.AbstractSnowDensity{NF}

Constant, spatially homogeneous bulk snow density ρ_snow. This is the default (and currently only) snow density scheme for SingleLayerSnow. Default bulk snow density follows [12].

Properties:

  • density::Any: Bulk snow density ρ_snow

References

  • [12] Westermann et al., Geoscientific Model Development (2016)
source
Terrarium.ConstantSnowHydraulicsType
struct ConstantSnowHydraulics{NF} <: Terrarium.AbstractSnowHydraulics{NF}

Constant, spatially homogeneous snow hydraulic properties: a saturated hydraulic conductivity K_sat and a capillary retention L_c, setting the Darcy-type meltwater outflow (see compute_meltwater_outflow). Default values follow [3].

Properties:

  • saturated_conductivity::Any: Hydraulic conductivity at saturation

  • capillary_retention::Any: Capillary retention liq_c: liquid fraction held against gravity before meltwater drains

References

  • [3] Tarboton, Chowdhury and Jackson (1994)
source
Terrarium.ConstantSoilCarbonDensityType
struct ConstantSoilCarbonDensity{NF} <: Terrarium.AbstractSoilBiogeochemistry{NF}

Naive implementation of soil biogeochemistry that just assumes there to be a constant organic content in all soil layers.

Properties:

  • ρ_soc::Any: Soil organic carbon density

  • ρ_org::Any: Pure organic matter density

source
Terrarium.ConstantSoilHorizonType
struct ConstantSoilHorizon{NF, name, Porosity<:Terrarium.AbstractSoilPorosity{NF}} <: Terrarium.AbstractSoilHorizon{NF, name}

Represents an arbitrary soil horizon whose properties (texture and porosity) are assumed to be constant across both space and time.

source
Terrarium.ConstantSoilHydraulicsType
struct ConstantSoilHydraulics{NF, RC, UnsatK<:Terrarium.AbstractUnsatK{NF}} <: Terrarium.AbstractSoilHydraulics{NF, RC, UnsatK<:Terrarium.AbstractUnsatK{NF}}

Represents a simple case where soil hydraulic properties are given as constant values. This is mostly provided just for testing, although it may be useful in certain cases where direct measurements of hydraulic properites are available.

Properties:

  • swrc::Any: Soil water retention curve

  • unsat_hydraulic_cond::Terrarium.AbstractUnsatK: Unsaturated hydraulic conductivity formulation; defaults to saturated_conductivity

  • saturated_conductivity::Any: Hydraulic conductivity at saturation

  • field_capacity::Any: Constant field capacity

  • wilting_point::Any: Constant wilting point

  • residual::Any: Residual (minimum) saturation level

source
Terrarium.ConstantSoilPorosityType
struct ConstantSoilPorosity{NF} <: Terrarium.AbstractSoilPorosity{NF}

Parameterization of soil porosity that simply specifies constant values for the mineral and organic components.

source
Terrarium.ConstantSoilTemperatureType
struct ConstantSoilTemperature{NF} <: Terrarium.AbstractInitializer{NF}

Initializer for soil/ground temperature that sets the temperature profile to a constant value.

Properties:

  • T₀::Any
source
Terrarium.DiagnosedRadiativeFluxesType
struct DiagnosedRadiativeFluxes{NF} <: Terrarium.AbstractRadiativeFluxes{NF}

Computes outgoing shortwave and longwave radiation according to separately specified schemes for the albedo, skin temperature, and atmospheric inputs.

source
Terrarium.DiagnosedTurbulentFluxesType
struct DiagnosedTurbulentFluxes{NF} <: Terrarium.AbstractTurbulentFluxes{NF}

Represents the standard case where the turbulent (sensible and latent) heat fluxes are diagnosed from atmosphere and soil conditions.

source
Terrarium.DiagnosticAlbedoType
struct DiagnosticAlbedo{NF} <: Terrarium.AbstractAlbedo{NF}

Diagnosed surface albedo and emissivity. The values are computed in compute_auxiliary! as a snow-cover-weighted blend of a snow-free background and snow, α = (1 − f_snow)·α_bg + f_snow·α_snow (and likewise for emissivity), where f_snow is the snow-covered area fraction of the optional snow component passed to compute_auxiliary!. Without a snow component (snow === nothing), f_snow = 0 and the background values are used.

Properties:

  • background_albedo::Any: Snow- and vegetation-free (background) albedo of bare ground

  • background_emissivity::Any: Snow- and vegetation-free (background) emissivity of bare ground

source
Terrarium.DirectSurfaceRunoffType
struct DirectSurfaceRunoff{NF} <: Terrarium.AbstractSurfaceRunoff{NF}

Simple surface runoff scheme that computes runoff as

\[R = P + D - I\]

where P is precipitation reaching the ground, D is drainage from accumualted excess water at the surface, and I is infiltration into the soil.

Properties:

  • τ_r: Surface water removal timescale
source
Terrarium.ERA5LandForcingsType
struct ERA5LandForcings <: Terrarium.AbstractLandAsset

One year of ERA5-Land hourly meterological variables regridded to approximately 1° x 1° resolution (72 Gaussian rings).

VariableDescriptionUnits
t2m2 metre air temperatureK
d2m2 metre dewpoint temperatureK
tpTotal precipitationm
sfSnowfall (water equivalent)m
spSurface pressurePa
ssrdSurface solar (shortwave) radiation downwardsJ/m²
strdSurface thermal (longwave) radiation downwardsJ/m²
u1010 metre eastward (U) wind componentm/s
v1010 metre northward (V) wind componentm/s
source
Terrarium.ERA5LandInvariantsType
struct ERA5LandInvariants <: Terrarium.AbstractLandAsset

Time-invariant spatial fields from ERA5-Land at the native 0.1° x 0.1° resolution.

VariableDescriptionUnits
cvhHigh vegetation coverfraction (0–1)
lsmLand-sea mask (fraction of land)fraction (0–1)
tvlType of low vegetationcategorical index
cvlLow vegetation coverfraction (0–1)
zSurface geopotential (orography × g)m²/s²
sltSoil typecategorical index
dlLake total depthm
clLake coverfraction (0–1)
si1010 metre wind speedm/s
tvhType of high vegetationcategorical index
source
Terrarium.ERA5LandLeafAreaIndexType
struct ERA5LandLeafAreaIndex <: Terrarium.AbstractLandAsset

Leaf area index daily climatology for 1980-2010 from ERA5-Land at the native 0.1° x 0.1° resolution.

VariableDescriptionUnits
lai_lvLeaf area index, low vegetationm²/m²
lai_hvLeaf area index, high vegetationm²/m²
source
Terrarium.ExplicitTwoPhaseHeatConductionType
struct ExplicitTwoPhaseHeatConduction <: Terrarium.AbstractHeatOperator

Represents an explicit formulation of the two-phase heat conduction operator in 1D:

\[\frac{\partial U(T,\phi)}{\partial t} = \boldsymbol{\nabla} \cdot \left[ \kappa(T) \boldsymbol{\nabla}_x T(x,t) \right]\]

where $T$ is temperature [K], $U$ is internal energy [J m⁻³], and $\kappa$ is the thermal conductivity [W m K⁻¹].

source
Terrarium.ExponentialSpacingType
struct ExponentialSpacing{NF, ST<:Union{Nothing, Integer}} <: Terrarium.AbstractVerticalSpacing{NF}

Variably-spaced vertical discretization with N layers increasing quasi-exponentially in thickness from Δz_min at the top (surface) to Δz_max at the bottom. The integer property sig determines to what significant digit each layer thickness should be rounded.

Properties:

  • Δz_min::Any: Minimum layer thickness at the surface

  • Δz_max::Any: Maximum layer thickness at the bottom

  • N::Int64: Number of layers

  • sig::Union{Nothing, Integer}: Number of significant digits for rounding or nothing

source
Terrarium.FieldBCsType

Alias for a NamedTuple of FieldBC types where the keys correspond to field/variable names.

source
Terrarium.FieldCapacityLimitedPAWType
struct FieldCapacityLimitedPAW{NF} <: Terrarium.AbstractPlantAvailableWater{NF}

Implementation of vegetation water availability (a.k.a "plant available water") that computes the wilting fraction

\[W_i = \min\left(\frac{\theta_{\text{w},i} - \theta_{\text{wp},i}}{\theta_{\text{fc},i} - \theta_{\text{wp},i}} , 1\right)\]

where $\theta_{\text{w},i}$ is the volumetric water content of the $i$'th soil layer, $\theta_{\text{fc},i}$ is the "field capacity", and $\theta_{\text{wp},i}$ is the "wilting point". The water availability

Properties:

source
Terrarium.FieldInputSourceType
struct FieldInputSource{NF, name, VD<:Terrarium.VarDims, FS<:(Oceananigans.Fields.AbstractField{LX, LY, LZ, G, NF} where {LX, LY, LZ, G}), UT} <: InputSource{NF, name}

Input source that defines input state variables with the given names which can then be directly modified by the user.

source
Terrarium.FieldTimeSeriesInputSourceType
struct FieldTimeSeriesInputSource{NF, name, VD<:Terrarium.VarDims, FTS<:(FieldTimeSeries{LX, LY, LZ, TI, K, I, D, G, NF} where {LX, LY, LZ, TI, K, I, D, G}), UT} <: InputSource{NF, name}

Input source that reads input fields from pre-specified Oceananigans FieldTimeSeries.

source
Terrarium.FixedPointSolverType
struct FixedPointSolver{NF, R}

Fixed-point (Picard) iteration solver. Repeatedly applies the update g(x) = x - F(x), where F is the residual returned by the ObjectiveFunction, optionally under-relaxed via a RelaxationFactor, until the change in the iterate falls below tolerance or max_iterations is reached.

Properties:

  • tolerance: Numerical tolerance of the fixed point iteration

  • relax: Relaxation scheme

  • max_iterations: Maximum number of iterations to run

source
Terrarium.FractionalSnowCoverType
struct FractionalSnowCover{NF} <: Terrarium.AbstractSnowCover{NF}

Simple fractional snow cover parameterization f_snow = W_snow/(W_snow + W_ref) where W_snow is the current snow water equivalent (SWE) within any given finite area and W_ref is the reference SWE at which the area would be expected to be 50% covered. The function is smooth and differentiable, with f_snow → 0 as W_snow → 0 and f_snow → 1 as W_snow → ∞.

Default SWE level for half_coverage is set to 0.01 m following [11].

Properties:

  • half_coverage::Any: Reference snow water equivalent level W_ref

References

  • [11] Douville et al., Climate Dynamics (1995)
source
Terrarium.HeunType
struct Heun{NF} <: Terrarium.AbstractTimeStepper{NF}

Simple forward 2nd order Heun / improved Euler time stepping scheme.

source
Terrarium.HeunCacheType
struct HeunCache{NF, P, T, NS} <: Terrarium.AbstractTimeStepperCache{NF}

Cache for the Heun scheme, holding copies of the prognostic state u₀ and the predictor tendencies ∂u∂t₀ (Heun steps in-place on state, so only these two are needed). The cache mirrors the namespace tree of the state: namespaces holds a sub-HeunCache per namespace so that namespaced prognostic variables are staged (saved/restored/averaged) consistently with how explicit_step! recurses into namespaces.

source
Terrarium.IMEXType
struct IMEX{NF, E<:Terrarium.AbstractTimeStepper{NF}, I<:Terrarium.AbstractTimeStepper{NF}} <: AbstractIMEX{NF}

Implicit-explicit (IMEX) time stepper that integrates each prognostic variable with one of two sub-steppers depending on its timestepping class: variables of class Explicit are stepped by explicit, and those of class Implicit by implicit.

Each variable's class is resolved from timestepping(var, model, imex), which defaults to Explicit() for all variables. To integrate selected variables implicitly, specialize timestepping on the relevant variable and/or model types together with the IMEX timestepper. The resolved per-variable classes are stored in the IMEXCache type parameter and used to route variables at each step.

Properties:

  • explicit::Terrarium.AbstractTimeStepper: Sub-stepper for prognostic variables of class Explicit (should have timestepping(explicit) == Explicit())

  • implicit::Terrarium.AbstractTimeStepper: Sub-stepper for prognostic variables of class Implicit (should have timestepping(implicit) == Implicit())

source
Terrarium.IMEXMethod
IMEX(explicit, implicit)
IMEX(; explicit, implicit)

Construct an IMEX time stepper from an explicit and an implicit sub-stepper (which must share the same numerical type NF). Which prognostic variables are integrated implicitly is controlled by specializing timestepping.

source
Terrarium.IMEXCacheType
struct IMEXCache{classes, NF, EC<:Terrarium.AbstractTimeStepperCache{NF}, IC<:Terrarium.AbstractTimeStepperCache{NF}} <: Terrarium.AbstractTimeStepperCache{NF}

Cache for an AbstractIMEX time stepper. Holds each sub-stepper's own cache; the resolved per-variable timestepping classes are stored as the leading type parameter classes (a tuple of Explicit/Implicit instances, in prognostic-variable order) so that routing each variable to its sub-stepper is type stable.

Properties:

  • explicit::Terrarium.AbstractTimeStepperCache: Cache for the explicit sub-stepper

  • implicit::Terrarium.AbstractTimeStepperCache: Cache for the implicit sub-stepper

source
Terrarium.ImplicitType
struct Implicit <: Timestepping

Timestepping trait marking implicit integration. It is the trait of implicit timesteppers and, under an AbstractIMEX, of prognostic variables routed to the implicit sub-stepper.

source
Terrarium.ImplicitSkinTemperatureType
struct ImplicitSkinTemperature{NF, Solver} <: Terrarium.AbstractSkinTemperature{NF}

Scheme for an implicit skin temperature $T_s$ satisfying:

\[R_{\text{net}}(T_s) + H_s(T_s) + H_l(T_s) - G(T_s, T_g) = 0 \]

where $R_{\text{net}}$ is the net radiation budget, $H_s$ is the sensible heat flux, $H_l$ is the latent heat flux from sublimation and evapotranspiration, $G$ is the ground heat flux, and $T_g$ is the ground temperature, or temperature of the uppermost subsurface (soil or snow) layer. All fluxes follow the positive upwards convention. For $G$, this means from the deeper soil towards the surface is positive. For the other fluxes, this means from the surface towards the atmosphere is positive.

Properties:

  • κₛ: Assumed thermal conductivity at the surface

  • solver: Numerical solver for the implicit skin temperature

source
Terrarium.InputSourceType
abstract type InputSource{NF, name}

Base type for input data sources. Implementations of InputSource are free to load data from any arbitrary backend. They expect an initialize!(inputs, grid, clock, fields, ::InputSource) that is called once at model initialization and an update_inputs!(inputs, grid, clock, fields, ::InputSource) method that is called at every time step, where inputs are the input Fields to be written, grid is the model grid, clock the simulation clock, and fields the full (read-only) model state. Both default to doing nothing. Implementations should additionally provide a constructor as a dispatch of InputSource. Namespace routing (scope) is handled by the enclosing [InputSources] container.

The type argument NF corresponds to the numeric type of the input data, name to its name that's also used in its variables definition.

source
Terrarium.InputSourceMethod
InputSource(
    grid::Terrarium.AbstractLandGrid{NF},
    field::Oceananigans.Fields.AbstractField{LX, LY, LZ, G, NF} where {LX, LY, LZ, G};
    name,
    units
)

Create a FieldInputSource with the given grid and input variable fields. Use it for static input fields. The name can either be a plain Symbol or a namespaced path; see varpath.

source
Terrarium.InputSourceMethod
InputSource(
    grid::ColumnRingGrid{NF},
    ring_field::RingGrids.AbstractField;
    name,
    units
)

Convenience function to create a FieldInputSource from a RingGrids.Field. Converts the RingGrids field to an Oceananigans field and then creates the input source.

source
Terrarium.InputVariableType
struct InputVariable{name, VD<:Terrarium.VarDims, UT<:Unitful.Units, Var<:Terrarium.Variable{name, VD<:Terrarium.VarDims, UT<:Unitful.Units}, BT<:IntervalSets.AbstractInterval, Def<:Union{Nothing, Function, Number}} <: Terrarium.AbstractProcessVariable{name, VD<:Terrarium.VarDims, UT<:Unitful.Units}

Represents a spatially varying input (e.g. forcing) variable with the given name and spatial dims. Input variables can also be made to vary in time through the use of InputSources.

source
Terrarium.InverseQuadraticType
struct InverseQuadratic <: Terrarium.AbstractBulkWeighting

The inverse quadratic (or "quadratic parallel") bulk weighting formula for thermal conductivity ([33]):

\[k = \left[\sum_{i=1}^N θᵢ\sqrt{kᵢ}\right]^2\]

References

  • [33] Cosenza et al., European Journal of Soil Science (2003)
source
Terrarium.LUEPhotosynthesisType
struct LUEPhotosynthesis{NF} <: Terrarium.AbstractPhotosynthesis{NF}

Photosynthesis implementation from PALADYN [16] for C3 PFTs following the mechanistic approach of [17]. Computes instantaneous photosynthetic rates as differential equations that are integrated over arbitrary timesteps by the timestepper.

Authors: Maha Badri and Matteo Willeit

Properties:

  • τ25::Any: Rubisco specificity factor at 25°C. Ratio of carboxylation to oxygenation rates.

  • Kc25::Any: Michaelis-Menten constant for CO₂ at 25°C. PALADYN value for needleleaf trees.

  • Ko25::Any: Michaelis-Menten constant for O₂ at 25°C. PALADYN value for needleleaf trees.

  • q10_τ::Any: Q10 temperature sensitivity for τ. Controls temperature dependence of specificity.

  • q10_Kc::Any: Q10 temperature sensitivity for Kc. Controls temperature dependence of CO₂ affinity.

  • q10_Ko::Any: Q10 temperature sensitivity for Ko. Controls temperature dependence of O₂ affinity.

  • α_leaf::Any: Leaf albedo in PAR range

  • α_a::Any: Fraction of PAR assimilated at ecosystem level, relative to leaf level

  • α_C3::Any: Intrinsic quantum efficiency of CO2 uptake in C3 plants

  • cq::Any: Conversion factor for solar radiation at 550 nm from J/m² to mol/m²

  • T_CO2_high::Any: Upper temperature threshold for CO₂/O₂ specificity factor. Above this, photosynthesis rapidly declines. PFT-specific, needleleaf tree value.

  • T_CO2_low::Any: Lower temperature threshold for CO₂/O₂ specificity factor. Below this, photosynthesis rapidly declines. PFT-specific, needleleaf tree value.

  • T_photos_high::Any: Upper temperature threshold for light-limited photosynthesis rate. Peak photosynthesis capacity. PFT-specific, needleleaf tree value.

  • T_photos_low::Any: Lower temperature threshold for light-limited photosynthesis rate. Minimum for photosynthesis. PFT-specific, needleleaf tree value.

  • θ_r::Any: Root of quadratic mean shape parameter. Controls smoothness of interpolation between light and RuBisCO limitations (0.7 for smooth, 0.5 for arithmetic mean).

References

  • [17] Haxeltine & Prentice, Global Biogeochemical Cycles (1996)
  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.LandModelType
struct LandModel{NF, GridType<:(Terrarium.AbstractLandGrid{NF}), Vegetation<:Union{Nothing, Terrarium.AbstractVegetation{NF}}, Soil<:Terrarium.AbstractSoil{NF}, Snow<:Union{Nothing, Terrarium.AbstractSnow{NF}}, SEB<:Terrarium.AbstractSurfaceEnergyBalance, Hydrology<:Terrarium.AbstractSurfaceHydrology, Atmosphere<:Terrarium.AbstractAtmosphere, Initializer<:Terrarium.AbstractInitializer, Timestepper<:Terrarium.AbstractTimeStepper{NF}} <: Terrarium.AbstractLandModel{NF, GridType<:(Terrarium.AbstractLandGrid{NF})}

Fully-coupled land model integrating atmosphere, surface energy balance, surface hydrology, vegetation, and soil processes.

Properties:

  • grid::Terrarium.AbstractLandGrid: Spatial discretization

  • vegetation::Union{Nothing, Terrarium.AbstractVegetation{NF}} where NF: Vegetation processes

  • soil::Terrarium.AbstractSoil: Soil processes

  • snow::Union{Nothing, Terrarium.AbstractSnow{NF}} where NF: Snow processes (default nothing: no snowpack)

  • surface_energy_balance::Terrarium.AbstractSurfaceEnergyBalance: Surface energy balance

  • surface_hydrology::Terrarium.AbstractSurfaceHydrology: Surface hydrology scheme

  • atmosphere::Terrarium.AbstractAtmosphere: Near-surface atmospheric conditions

  • constants::PhysicalConstants: Physical constants

  • initializer::Terrarium.AbstractInitializer: State variable initializer

  • timestepper::Terrarium.AbstractTimeStepper: Time stepper: a single AbstractTimeStepper (e.g. ForwardEuler, Heun) or an IMEX

source
Terrarium.LongShortWaveRadiationType
struct LongShortWaveRadiation <: Terrarium.AbstractIncomingRadiation

Incoming radiation parameterization in which downwelling shortwave [W/m²] and longwave [W/m²] radiation are provided as separate input fields, along with daytime length [hr].

source
Terrarium.MaterialConstantsType
struct MaterialConstants{NF}

Material constants for water, ice, and carbon used in soil energy, hydrology, and vegetation process implementations.

julia> show(MaterialConstants(Float64))
MaterialConstants{Float64}(1000.0, 916.7, 12.0)

Properties:

  • density_water: Density of water in kg/m^3

  • density_ice: Density of ice in kg/m^3

  • atomic_weight_carbon: Atomic mass of carbon [gC/mol]

source
Terrarium.MedlynStomatalConductanceType
struct MedlynStomatalConductance{NF} <: Terrarium.AbstractStomatalConductance{NF}

Stomatal conductance implementation from [16] following the optimal stomatal conductance model of [19].

Authors: Maha Badri and Matteo Willeit

Properties:

  • g₁::Any: Parameter in optimal stomatal conductance formulation representing the quasi-linear relationship between conductance and net assimilation, [20]. PFT specific.

  • g_min::Any: Minimum stomatal conductance parameter

References

  • [20] Lin et al., Nature Climate Change (2015)
  • [19] Medlyn et al., Global Change Biology (2011)
  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.MineralOrganicType
struct MineralOrganic{NF} <: Terrarium.AbstractSoilMatrix{NF}

Soil matrix consisting of a simple, homogeneous mixture of mineral and organic material.

Properties:

  • texture::SoilTexture: Mineral soil texture

  • organic::Any: Organic soil fraction

source
Terrarium.MineralOrganicMethod
MineralOrganic(; texture, organic)

Validating keyword constructor for MineralOrganic; enforces that organic lies in the unit interval.

source
Terrarium.ModelIntegratorType
struct ModelIntegrator{NF, Arch<:Oceananigans.Architectures.AbstractArchitecture, Grid<:Terrarium.AbstractLandGrid{NF, Arch<:Oceananigans.Architectures.AbstractArchitecture}, TimeStepper<:Terrarium.AbstractTimeStepper{NF}, Model<:Terrarium.AbstractModel{NF, Grid<:Terrarium.AbstractLandGrid{NF, Arch<:Oceananigans.Architectures.AbstractArchitecture}}, StateVars<:Terrarium.AbstractStateVariables, ClockType<:Clock, Inits<:NamedTuple, Inputs<:InputSources} <: Oceananigans.AbstractModel{TimeStepper<:Terrarium.AbstractTimeStepper{NF}, Arch<:Oceananigans.Architectures.AbstractArchitecture}

Represents a "integrator" for a simulation of a given model. ModelIntegrator consists of a clock, a model, and an initialized StateVariables data structure, as well as any relevant inputs provided by a corresponding InputProvider. The ModelIntegrator implements the Oceananigans.AbstractModel interface and can thus be treated as a "model" in Oceananigans Simulations and output reading/writing utilities.

source
Terrarium.NamespaceType
struct Namespace{name, Vars}

Represents a new variable namespace, typically from a subcomponent of the model.

source
Terrarium.NoCanopyInterceptionType
struct NoCanopyInterception{NF} <: Terrarium.AbstractCanopyInterception{NF}

No-op canopy interception that routes all rainfall directly to the ground (open sky). This is necessary since downstream processes consume rainfall_ground rather than the rainfall directly; this no-op implementation allows for a unified interface.

source
Terrarium.NoFlowType
struct NoFlow <: Terrarium.AbstractVerticalFlow

Represents a hydrology scheme where soil water is immobile.

source
Terrarium.ObjectiveFunctionType
struct ObjectiveFunction{target, F, DF}

Represents an objective function for nonlinear solvers. The name target refers to the output Field which should updated on each iteration. The objective function should have the signature

func(out, indices..., grid, fields, func_args...; func_kwargs...)

where indices are the grid indices passed to solve! and directly return the scalar residual. If an analytical derivative is provided via dfunc, it should follow the same signature as func and return the derivative of the residual with respect to the target.

source
Terrarium.PALADYNAutotrophicRespirationType
struct PALADYNAutotrophicRespiration{NF} <: Terrarium.AbstractAutotrophicRespiration{NF}

Autotrophic respiration implementation from [16].

Authors: Maha Badri and Matteo Willeit

Properties:

  • cn_sapwood::Any: Sapwood parameter

  • cn_root::Any: Root parameter

  • aws::Any: Ratio of total to respiring stem carbon, [21]. PFT specific.

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
  • [21] Cox, Hadley Centre Technical Note (2001)
source
Terrarium.PALADYNCanopyEvapotranspirationType
struct PALADYNCanopyEvapotranspiration{NF, GR<:Terrarium.AbstractGroundEvaporationResistanceFactor} <: Terrarium.AbstractEvapotranspiration{NF}

Canopy evapotranspiration scheme from PALADYN ([16, Eq. (5)]) that includes a canopy evaporation term based on the saturation fraction of canopy water defined by the canopy hydrology scheme.

\[E_{\text{ground}} = \beta \frac{\Delta q}{r_a + r_e}\]

\[E_{\text{can}} = f_{\text{can}} \frac{\Delta q}{r_a}\]

\[T_{\text{can}} = \frac{\Delta q}{r_a + r_s}\]

Properties:

  • C_can: Drag coefficient for the transfer of heat and water between the ground and canopy

  • ground_resistance: Parameterization for ground resistance to evaporation/sublimation

References

  • [16] Willeit and Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.PALADYNCanopyInterceptionType
struct PALADYNCanopyInterception{NF} <: Terrarium.AbstractCanopyInterception{NF}

Canopy interception and storage implementation following PALADYN ([16]) considering only liquid water (no snow).

Properties:

  • α_int: Canopy water interception factor for tree PFTs

  • k_ext: Extinction coefficient for radiation through vegetation

  • W_can_max: Canopy interception capacity parameter, [26]

  • τ_w: Canopy water removal timescale

References

  • [26] Verseghy et al., International Journal of Climatology (1993)
  • [16] Willeit and Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.PALADYNCarbonDynamicsType
struct PALADYNCarbonDynamics{NF} <: Terrarium.AbstractVegetationCarbonDynamics{NF}

Vegetation carbon dynamics implementation following [16] but considering only the sum of the vegetation carbon pools. The subsequent splitting into Cleaf, Cstem, C_root is not implemented for now.

Authors: Maha Badri

Properties:

  • γL::Any: Leaf turnover rate ([22]). PFT specific.

  • γR::Any: Root turnover rate. PFT specific.

  • γS::Any: Stem src/processes/vegetation/hydraulicsturnover rate modified from [23]. PFT specific.

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
  • [21] Cox, Hadley Centre Technical Note (2001)
  • [23] Clark et al., Geoscientific Model Development (2011)
  • [22] Kattge et al., Global Change Biology (2011)
source
Terrarium.PALADYNPhenologyType
struct PALADYNPhenology{NF} <: Terrarium.AbstractPhenology{NF}

Prognostic, growing-degree-day (GDD) based vegetation phenology following the cold-deciduous scheme of [16] and [24].

The instantaneous leaf area index is LAI = ϕ·LAI_b, where LAI_b is the balanced (annual-maximum) leaf area index and ϕ is the phenology factor. For a cold-deciduous PFT, ϕ ramps up linearly with accumulated growing degree days above a base temperature T_gdd_base at a rate set by gdd_crit [16, Eq. (83)], holds at 1 once fully leafed out, and declines linearly during senescence as air temperature falls from T_gdd_base to T_gdd_base − T_senescence_range.

Unlike the discrete daily accumulation of the original scheme in PALADYN, the growing degree days are integrated as a prognostic state variable, so no history of past inputs needs to be stored. To recover a periodic seasonal cycle without a discrete annual reset (which would violate the continuous-time design), a cold-season relaxation term drains the accumulator with timescale gdd_relaxation_time whenever air temperature is below T_gdd_base.

The deciduous/evergreen distinction, set in PALADYN by the coldest-month temperature, is represented here by the prescribed f_deciduous fraction: ϕ = f_deciduous·ϕ_deciduous + (1 − f_deciduous), so an evergreen PFT (f_deciduous = 0) has ϕ = 1 (and LAI = LAI_b) independent of temperature.

Authors: Maha Badri and Matteo Willeit

Properties:

  • T_gdd_base::Any: Base temperature for growing-degree-day accumulation and senescence onset

  • gdd_crit::Any: Critical growing-degree-day sum for full leaf-out

  • T_senescence_range::Any: Air-temperature range below T_gdd_base over which leaves fully senesce

  • gdd_relaxation_time::Any: Cold-season relaxation timescale for the continuous growing-degree-day reset

  • f_deciduous::Any: Deciduous fraction (0 = evergreen, 1 = fully deciduous); prescribed per PFT via the coldest-month-temperature criterion

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
  • [24] Sitch et al., Global Change Biology (2003)
source
Terrarium.PALADYNVegetationDynamicsType
struct PALADYNVegetationDynamics{NF} <: Terrarium.AbstractVegetationDynamics{NF}

Vegetation dynamics implementation following [16] for a single PFT based on the Lotka–Volterra approach.

Authors: Maha Badri

Properties:

  • ν_seed::Any: Vegetation seed fraction

  • γv_min::Any: Minimum vegetation disturbance rate

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.PhysicalConstantsType
struct PhysicalConstants{NF}

Top-level container for all physical constants used in Terrarium. Groups three sub-structs by category:

Construction

julia> show(PhysicalConstants())
PhysicalConstants{Float64}(ThermodynamicConstants{Float64}(1004.5, 2070.0, 4181.0, 1859.0, 333550.0, 2.5008e6, 2.83435e6, 273.16, 273.15, 273.16, 611.657, 287.0, 461.5), MaterialConstants{Float64}(1000.0, 916.7, 12.0), UniversalConstants{Float64}(9.80665, 5.6704e-8, 0.4))

To override individual constants, pass a customised sub-struct:

julia> tc = ThermodynamicConstants(Float64; temperature_reference = 273.15);

julia> c = PhysicalConstants(Float64; thermodynamics = tc);

julia> c.thermodynamics.temperature_reference
273.15

Properties:

  • thermodynamics

  • material

  • universal

source
Terrarium.PiecewiseLinearInitialSoilTemperatureType
struct PiecewiseLinearInitialSoilTemperature{NF, N}

Represents a piecewise linear temperature initializer specified from the given knots.

initializer = PiecewiseLinearInitialSoilTemperature(
    0.0u"m" => 5.0, # always in °C!
    0.5u"m" => 2.0,
    1.0u"m" => 1.0,
    10.0u"m" => 1.5,
    ...
)

Properties:

  • knots::NTuple{N, NF} where {NF, N}
source
Terrarium.PlantTraitsType
struct PlantTraits{NF}

Plant-specific parameters for a single functional type. This is a temporary, partial construct that will be soon be replaced will full support for PFTs and other trait parameterizations.

source
Terrarium.PowerLawSnowThermalConductivityType
struct PowerLawSnowThermalConductivity{NF} <: Terrarium.AbstractSnowThermalConductivity{NF}

Power law parameterization for snow thermal conductivity as a function of density following [13, Eq. (34)].

Properties:

  • conductivity_coefficient::Any: Coefficient a in the thermal conductivity power law κ = a·(ρ_snow/ρ_w)^b

  • conductivity_exponent::Any: Exponent b in the thermal conductivity power law κ = a·(ρ_snow/ρ_w)^b

References

  • [13] Yen et al. 1981
source
Terrarium.PrescribedAtmosphereType
struct PrescribedAtmosphere{NF, tracernames, Precip<:Terrarium.AbstractPrecipitation, IncomingRad<:Terrarium.AbstractIncomingRadiation, Humidity<:Terrarium.AbstractHumidity, Aerodynamics<:Terrarium.AbstractAerodynamics, Gases<:Tuple{Vararg{TracerGas{NF}}}} <: Terrarium.AbstractAtmosphere{NF, Precip<:Terrarium.AbstractPrecipitation, IncomingRad<:Terrarium.AbstractIncomingRadiation, Humidity<:Terrarium.AbstractHumidity, Aerodynamics<:Terrarium.AbstractAerodynamics}

Represents prescribed atmospheric conditions given by the following input variables: - Air temperature - Humidity - Atmospheric pressure - Windspeed - Precipitation - Solar radiation - Zero or more tracer gases (defaults to CO2 only)

Precpitation and solar radiation are specified according to specialized subtypes which dictate the form of the input data; for precipitation, this defaults to RainSnow, i.e. rain- and snowfall given as separate inputs, while for solar radiation, the default is LongShortWaveRadiation which partitions downwelling radiation into the common short- and long wave lengths representing solar and thermal (infrared) radiation.

source
Terrarium.PrescribedPhenologyType
struct PrescribedPhenology{NF} <: Terrarium.AbstractPhenology{NF}

Prescribed vegetation phenology where leaf_area_index is treated as a (possibly time-varying) input variable.

Properties:

source
Terrarium.PrescribedRadiativeFluxesType
struct PrescribedRadiativeFluxes{NF} <: Terrarium.AbstractRadiativeFluxes{NF}

Represents the simplest scheme for the radiative budget where outgoing shortwave and longwave radiation are given as input variables. Net radiation is diagnosed by summing all radiative fluxes:

\[R_{\text{net}} = S_{\uparrow} - S_{\downarrow} + L_{\uparrow} - L_{\downarrow}\]

source
Terrarium.PrescribedSkinTemperatureType
struct PrescribedSkinTemperature{NF} <: Terrarium.AbstractSkinTemperature{NF}

Simple scheme for prescribed skin temperatures from input variables.

Properties:

  • κₛ: Assumed thermal conductivity at the surface
source
Terrarium.PrescribedSoilHorizonType
struct PrescribedSoilHorizon{NF, name, Porosity<:Terrarium.AbstractSoilPorosity{NF}} <: Terrarium.AbstractSoilHorizon{NF, name}

Represents an arbitrary soil horizon whose properties (texture and porosity) are prescribed via input Fields and can therefore vary across space and (less commonly) time.

source
Terrarium.PrescribedSpacingType
struct PrescribedSpacing{NF} <: Terrarium.AbstractVerticalSpacing{NF}

Vertical discretization with prescribed thicknesses for each layer. The number of layers is equal to the length of the given vector.

Properties:

  • Δz::Vector
source
Terrarium.PrescribedTurbulentFluxesType
struct PrescribedTurbulentFluxes{NF} <: Terrarium.AbstractTurbulentFluxes{NF}

Represents the simplest case where the turbulent (sensible and latent) heat fluxes are prescribed via input variables.

source
Terrarium.PrescribedVegetationType
struct PrescribedVegetation{NF, Phenology, Photosynthesis, StomatalConductance, RootDistribution, PAW} <: Terrarium.AbstractVegetation{NF}

Coupled vegetation process representing natural vegetation with a prescribed leaf area index. Unlike VegetationCarbonCycle, the vegetation carbon pool and leaf area are not prognostic: leaf area index is imposed externally (via the PrescribedPhenology scheme) and drives photosynthesis, stomatal conductance, and the associated water/energy exchange. There is consequently no prognostic carbon-pool or vegetation-dynamics component and no autotrophic respiration; compute_tendencies! is a no-op. Plant functional-type parameters (including the maximum leaf area index used to derive the phenology factor) are supplied through the traits component.

Properties:

  • phenology::Any: Phenology scheme

  • photosynthesis::Any: Photosynthesis scheme

  • stomatal_conductance::Any: Stomatal conductance scheme

  • root_distribution::Any: Plant vertical root distribution

  • plant_available_water::Any: Plant available water determining soil moisture stress

  • traits::PlantTraits: Plant physical traits

source
Terrarium.PrognosticVariableType
struct PrognosticVariable{name, VD<:Terrarium.VarDims, UT<:Unitful.Units, Var<:Terrarium.Variable{name, VD<:Terrarium.VarDims, UT<:Unitful.Units}, CL<:Union{Nothing, Terrarium.AbstractClosureRelation}, TV<:Union{Nothing, Terrarium.AuxiliaryVariable}, BT<:IntervalSets.AbstractInterval} <: Terrarium.AbstractProcessVariable{name, VD<:Terrarium.VarDims, UT<:Unitful.Units}

Represents a prognostic state variable with the given name and spatial dims. Prognostic variables are those which are integrated by the timestepper and fully define the state of the system at any given point in (simulation) time. From a computational perspective, they can be seen as the "roots" of the computational graph for update_state!/timestep!. Prognostic variables generally should not be modified by any code not belonging to the timestepper or user. They automatically define a tendency (auxiliary) variable which is used to hold the value of their instantaneous time derivative computed by compute_tendencies!.

source
Terrarium.QuadraticSnowThermalConductivityType
struct QuadraticSnowThermalConductivity{NF} <: Terrarium.AbstractSnowThermalConductivity{NF}

Piecewise quadratic snow thermal conductivity parameterization of [14]. Default conductivity of ice from [15].

Properties:

  • func_hi::Terrarium.QuadraticFunction

  • func_lo::Terrarium.QuadraticFunction

  • threshold::Any

  • κ_max::Any

References

  • [14] Sturm et al., Journal of Glaciology (1997)
  • [15] Weller & Schwerdtfeger, Journal of Glaciology (1971)
source
Terrarium.QuasiThermalSteadyStateType
struct QuasiThermalSteadyState{NF} <: Terrarium.AbstractInitializer{NF}

Initializer that sets soil/ground temperature to a thermal quasi-steady state based on the given surface temperature, geothermal heat flux, and bulk (constant) thermal conductivity. Note that this is not a true thermal steady state, which would require iterative calculation of the thermal conductivity from the soil properties and initial temperature profile.

Properties:

  • T₀::Any

  • Qgeo::Any

  • k_eff::Any

source
Terrarium.RainSnowType
struct RainSnow <: Terrarium.AbstractPrecipitation

Precipitation parameterization in which liquid rainfall [m/s] and frozen snowfall [m/s] are provided as separate input fields.

source
Terrarium.RichardsEqType
RichardsEq{PS} <: AbstractVerticalFlow

SoilHydrology flow operator implementing the mixed saturation-pressure form of the Richardson-Richards equation.

State variables defined by the Richards' formulation of SoilHydrology:

  • saturation_water_ice: saturation level of water and ice in the pore space.
  • surface_excess_water: excess water at the soil surface (m^3/m^2).
  • hydraulic_conductivity: hydraulic conductivity at cell centers (m/s).
  • water_table`: elevation of the water table (m).
  • liquid_water_fraction: fraction of unfrozen liquid water in the pore space (dimensionless).

See also SoilSaturationPressureClosure and AbstractSoilHydraulics for details regarding the closure relating saturation and pressure head.

source
Terrarium.RootSolverType
struct RootSolver{NF, M, S, Tolerance<:RootSolvers.AbstractTolerance{NF}}

Wrapper for RootSolvers.jl root-finding methods.

source
Terrarium.SaturationWaterTableType
struct SaturationWaterTable{NF} <: Terrarium.AbstractInitializer{NF}

Simple initialization scheme for soil/ground saturation that sets the initial water table at the given depth and the saturation level in all layers in the vadose (unsaturated) to a constant value.

Properties:

  • vadose_zone_saturation::Any

  • water_table_depth::Any

source
Terrarium.SingleLayerSnowType
struct SingleLayerSnow{NF, Cover, Density, Conductivity, Hydraulics, Albedo, Closure} <: Terrarium.AbstractSnow{NF}

Simple single-layer snow scheme (loosely based on the Utah Energy Balance model, [3]). The snowpack is represented as a single lumped layer with a bulk density ρ_snow supplied by a snow-density scheme (constant by default), from which the thermal properties follow. The prognostic state is the depth-integrated (column) internal energy snow_energy Ū_snow [J/m²] and the snow_water_equivalent W_snow [m]; snow depth, cover fraction, and thermal conductivity are diagnosed from these and the bulk density.

Properties:

  • cover: Snow areal coverage parameterization

  • density: Bulk snow density parameterization

  • thermal_conductivity: Snow thermal conductivity parameterization

  • hydraulic_properties: Snow hydraulic properties

  • albedo: Snow albedo parameterization

  • closure: Snow energy-temperature closure

References

  • [3] Tarboton, Chowdhury and Jackson (1994)
source
Terrarium.SnowEnergyTemperatureClosureType
struct SnowEnergyTemperatureClosure{NF} <: Terrarium.AbstractEnergyClosure

Energy–temperature closure for snow volumes. For SingleLayerSnow, the depth-averaged snow temperature T_snow (°C) and liquid water fraction θ_liq are recovered from the depth-integrated internal energy Ū_snow (J/m²) using the medium-agnostic FreeWater enthalpy relations, treating the bulk snowpack as an ice-water-air mixture. The internal energy is defined as:

\[U(T) = T_{ ext{snow}} \times C(T) - \rho_{snow} L_{sl} (1 - F(T))\]

with C(T) the temperature-dependent volumetric heat capacity of the snowpack (J/m³/K), ρ_snow L_sl = ρ_w L_sl θ the volumetric latent heat of fusion (J/m³), and F(T) = θ_liq/θ the fraction of the total (liquid water + ice) volumetric water content that is liquid.

source
Terrarium.SnowModelType
struct SnowModel{NF, GridType<:(Terrarium.AbstractLandGrid{NF}), Snow<:Terrarium.AbstractSnow{NF}, Atmosphere<:Terrarium.AbstractAtmosphere, Initializer<:Terrarium.AbstractInitializer, Timestepper<:Terrarium.AbstractTimeStepper{NF}} <: Terrarium.AbstractSnowModel{NF, GridType<:(Terrarium.AbstractLandGrid{NF})}

Minimal standalone model of a single-layer snowpack, intended for unit and differentiability testing. Couples an AbstractSnow process with a prescribed atmosphere providing precipitation and air temperature. The surface and basal heat fluxes (surface_heat_flux, basal_heat_flux) and the sublimation rate are prescribed input fields; in a coupled land model these are supplied by the surface energy balance and the snow→soil conduction.

Properties:

  • grid::Terrarium.AbstractLandGrid: Spatial grid type

  • snow::Terrarium.AbstractSnow: Snow processes

  • atmosphere::Terrarium.AbstractAtmosphere: Near-surface atmospheric conditions

  • constants::PhysicalConstants: Physical constants

  • initializer::Terrarium.AbstractInitializer: State variable initializer

  • timestepper::Terrarium.AbstractTimeStepper: Time stepper: a single AbstractTimeStepper (e.g. ForwardEuler, Heun) or an IMEX

source
Terrarium.SoilCompositionType
struct SoilComposition{NF, Solid<:Terrarium.AbstractSoilMatrix{NF}}

Represents the material composition of an elementary volume of soil. The volume is decomposed into the key constitutents of water, ice, air, and a mixture of organic and mineral solid material.

Properties:

  • porosity: Natural porosity or void space of the soil

  • saturation: Fraction of the soil pores occupied by water or ice

  • liquid: Liquid (unfrozen) fraction of pore water

  • solid: Parameterization of the solid phase (matrix) of the soil

source
Terrarium.SoilCompositionMethod
SoilComposition(; porosity, saturation, liquid, solid)

Validating keyword constructor for SoilVolume; enforces that porosity, saturation, and liquid lie in the unit interval.

source
Terrarium.SoilEnergyTemperatureClosureType
struct SoilEnergyTemperatureClosure <: Terrarium.AbstractEnergyClosure

Defines the constitutive relationship between the the internal energy and temperature of a soil volume, i.e.

\[U(T) = T\times C(T) - \rho_w L_{sl} \theta (1 - F(T))\]

where T is temperature (°C), C(T) is the temperature-dependent heat capacity (J/m³/K), ρw L{sl} θ is the volumetric latent heat of fusion (J/m³), and F(T) = θ_w/θ is the constitutive relation between T and the unfrozen fraction of pore water with θ the sum of the volumetric fractions of water and ice. Note that, under this formulation, zero energy corresponds to 0°C with no ice, i.e. all pore water fully thawed.

The closure relation is defined as being a mapping from the conserved quantity (energy) to the continuous quantity (temperature), i.e. the inverse of U(T).

source
Terrarium.SoilEnergyWaterCarbonType
struct SoilEnergyWaterCarbon{NF, Stratigraphy<:Terrarium.AbstractStratigraphy{NF}, Energy<:Terrarium.AbstractSoilThermodynamics{NF}, Hydrology<:Terrarium.AbstractSoilHydrology{NF}, Biogeochemistry<:Terrarium.AbstractSoilBiogeochemistry{NF}} <: Terrarium.AbstractSoil{NF}

Coupled process type that encapsulates the coupling of soil energy, water, and carbon dynamics. The stratigraphy parameterization determines how the vertical layering of the soil is parameterized.

source
Terrarium.SoilHeatCapacitiesType
struct SoilHeatCapacities{NF}

Properties:

  • water::Any: Volumetric heat capacity of water

  • ice::Any: Volumetric heat capacity of ice

  • air::Any: Volumetric heat capacity of air

  • mineral::Any: Volumetric heat capacity of mineral soil

  • organic::Any: Volumetric heat capacity of organic soil

source
Terrarium.SoilHydraulicsSURFEXType
struct SoilHydraulicsSURFEX{NF, RC, UnsatK<:Terrarium.AbstractUnsatK{NF}} <: Terrarium.AbstractSoilHydraulics{NF, RC, UnsatK<:Terrarium.AbstractUnsatK{NF}}

Soil hydraulics parameterization that includes the SURFEX [4, Eq. (28-29)] formulation of field capacity and wilting point as a function of soil texture.

Properties:

  • swrc::Any: Soil water retention curve

  • unsat_hydraulic_cond::Terrarium.AbstractUnsatK: Unsaturated hydraulic conductivity formulation; defaults to saturated_conductivity

  • saturated_conductivity::Any: Hydraulic conductivity at saturation

  • wilting_point_effect::Any: Linear coefficient of wilting point adjustment due to clay content

  • field_capacity_effect::Any: Linear coefficient of field capacity adjustment due to clay content

  • field_capacity_exp::Any: Exponent of field capacity adjustment due to clay content

  • residual::Any: Residual (minimum) saturation level

References

  • [4] Noilhan & Mahfouf, Global and Planetary Change (1996)
source
Terrarium.SoilHydrologyType
struct SoilHydrology{NF, VerticalFlow<:Terrarium.AbstractVerticalFlow, SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF}), VWCForcing<:Union{Nothing, Oceananigans.Forcings.ContinuousForcing{LX, LY, LZ, P} where {P, LX, LY, LZ}, Oceananigans.Forcings.DiscreteForcing}} <: Terrarium.AbstractSoilHydrology{NF}

Properties:

  • vertical_flow::Terrarium.AbstractVerticalFlow: Soil water vertical flow operator

  • closure::Terrarium.AbstractSoilWaterClosure: Closure relation for the soil hydrology state

  • hydraulic_properties::Terrarium.AbstractSoilHydraulics: Soil hydraulic properties parameterization

  • vwc_forcing::Union{Nothing, Oceananigans.Forcings.ContinuousForcing{LX, LY, LZ, P} where {P, LX, LY, LZ}, Oceananigans.Forcings.DiscreteForcing}: Forcing for soil moisture (volumetric water content)

source
Terrarium.SoilInitializerType
struct SoilInitializer{NF, EnergyInit<:Terrarium.AbstractInitializer{NF}, HydrologyInit<:Terrarium.AbstractInitializer{NF}, BGCInit<:Terrarium.AbstractInitializer{NF}} <: Terrarium.AbstractInitializer{NF}

Initializer for coupled soil energy/hydrology/biogeochemistry models.

source
Terrarium.SoilModelType
struct SoilModel{NF, GridType<:(Terrarium.AbstractLandGrid{NF}), Soil<:Terrarium.AbstractSoil{NF}, Initializer<:Terrarium.AbstractInitializer, Timestepper<:Terrarium.AbstractTimeStepper{NF}} <: Terrarium.AbstractSoilModel{NF, GridType<:(Terrarium.AbstractLandGrid{NF})}

General implementation of a 1D column model of soil energy, water, and carbon transport.

Properties:

  • grid::Terrarium.AbstractLandGrid: Spatial grid type

  • soil::Terrarium.AbstractSoil: Soil processes

  • constants::PhysicalConstants: Physical constants

  • initializer::Terrarium.AbstractInitializer: State variable initializer

  • timestepper::Terrarium.AbstractTimeStepper: Time stepper: a single AbstractTimeStepper (e.g. ForwardEuler, Heun) or an IMEX

source
Terrarium.SoilMoistureResistanceFactorType
struct SoilMoistureResistanceFactor{NF} <: Terrarium.AbstractGroundEvaporationResistanceFactor

Implements the soil moisture limiting resistance factor of [28],

\[\beta = \frac{1}{4} \left[1 - \cos\left(π \theta_1/\theta_{\text{fc}} \right)\right] \quad \text{for } \theta_1 < \theta_{\text{fc}}\]

otherwise $\beta=1$.

References

  • [28] Lee and Pielke, Journal of Applied Meteorology (1992)
source
Terrarium.SoilPorositySURFEXType
struct SoilPorositySURFEX{NF} <: Terrarium.AbstractSoilPorosity{NF}

SURFEX parameterization of mineral soil porosity [4, Eq. (27)].

References

  • [4] Noilhan & Mahfouf, Global and Planetary Change (1996)
source
Terrarium.SoilSaturationPressureClosureType
struct SoilSaturationPressureClosure <: Terrarium.AbstractSoilWaterClosure

Represents a closure relating saturation of water/ice in soil pores to a corresponding pressure (or hydraulic) head. Note that here "pressure head" is defined to be synonymous with hydraulic head, i.e. including all both elevation and hydrostatic pressure contributions. This relation is typically described by soil property-dependent soil-water retention curve (SWRC) which is here defined in implementations of AbstractSoilHydraulics.

source
Terrarium.SoilStratigraphyType
struct SoilStratigraphy{NF, N, Horizons<:NTuple{N, Terrarium.AbstractSoilHorizon{NF}}} <: Terrarium.AbstractStratigraphy{NF}

Represents a soil stratigraphy as a stack of named soil horizons. Each soil horizon is assumed to have internally homogeneous soil properties. The number of horizons and their respective names are defined by the user.

Properties:

  • horizons::NTuple{N, Terrarium.AbstractSoilHorizon{NF}} where {NF, N}: Named tuple of soil horizons ordered from top to bottom
source
Terrarium.SoilThermalConductivitiesType
struct SoilThermalConductivities{NF}

Properties:

  • water::Any: Thermal conductivity of water

  • ice::Any: Thermal conductivity of ice

  • air::Any: Thermal conductivity of air

  • quartz::Any: Thermal conductivity of quartz (sand) mineral grains

  • mineral::Any: Thermal conductivity of non-quartz (silt/clay) mineral grains

  • organic::Any: Thermal conductivity of organic soil constituents

Default values from [34].

References

  • [34] Hillel, Academic Press (1982)
source
Terrarium.SoilThermalPropertiesType
struct SoilThermalProperties{NF, FC, CondWeight, Cond}

Properties:

  • conductivities::Any: Thermal conductivities for all constituents

  • conductivity_weighting::Any: Method for computing bulk thermal conductivity from constituents

  • heat_capacities::SoilHeatCapacities: Thermal conductivities for all constituents

  • freezecurve::Any: Freezing characteristic curve needed for energy-temperature closure

source
Terrarium.SoilThermodynamicsType
struct SoilThermodynamics{NF, HeatOperator<:Terrarium.AbstractHeatOperator, EnergyClosure<:Terrarium.AbstractEnergyClosure, ThermalProps<:(SoilThermalProperties{NF})} <: Terrarium.AbstractSoilThermodynamics{NF}

Standard implementation of the soil thermal dynamics accounting for freezing and thawing of pore water/ice. The closure field represents the temperature-energy closure $U(T,\phi)$ which relates temperature to internal energy via an arbitrary set of additional parameters $\phi$ which are determined by the model configuration.

Properties:

  • operator::Terrarium.AbstractHeatOperator: Heat transport operator

  • closure::Terrarium.AbstractEnergyClosure: Closure relating energy and temperature

  • thermal_properties::SoilThermalProperties: Soil thermal properties

source
Terrarium.SpecificHumidityType
struct SpecificHumidity <: Terrarium.AbstractHumidity

Humidity parameterization in which the near-surface specific humidity [kg/kg] is provided directly as an input field.

source
Terrarium.StateVariablesType
struct StateVariables{NF, prognames, closurenames, auxnames, inputnames, nsnames, ProgFields, TendFields, AuxFields, InputFields, Namespaces, Cache, ClockType} <: Terrarium.AbstractStateVariables

Container type for all Fields corresponding to state variables defined by a model. StateVariables partitions the fields into three categories: prognostic, tendencies, and auxiliary. Prognostic variables are those which characterize the state of the system and are assigned tendencies to be integrated by the timestepper. Auxiliary fields are additional state variables derived from the prognostic state variables but which are conditionally independent of their values at the previous time step given the current prognostic state. It is worth noting that tendencies are also treated internally as auxiliary variables; however, they are assigned their own category here since they need to be handled separately by the timestepping scheme.

source
Terrarium.StateVariablesMethod
StateVariables(
    process::Terrarium.AbstractProcess{NF},
    grid::Terrarium.AbstractLandGrid{NF};
    ...
) -> StateVariables{NF, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, Cache, ClockType} where {NF, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, Cache<:Terrarium.EmptyCache, ClockType<:(Clock{_A, _B, Float64, Int64, Int64} where {_A, _B})}
StateVariables(
    process::Terrarium.AbstractProcess{NF},
    grid::Terrarium.AbstractLandGrid{NF},
    params;
    clock,
    input_variables,
    timestepper,
    boundary_conditions,
    initializers,
    fields
) -> StateVariables{NF, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, Cache, ClockType} where {NF, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, Cache<:Terrarium.EmptyCache, ClockType<:(Clock{_A, _B, Float64, Int64, Int64} where {_A, _B})}

Initialize a StateVariables data structure containing Fields defined on the given grid for all variables defined by process. Any predefined boundary_conditions and fields will be passed through to initialize for each variable.

source
Terrarium.StateVariablesMethod
StateVariables(
    vars::Terrarium.Variables,
    grid::Terrarium.AbstractLandGrid{NF};
    clock,
    timestepper,
    model,
    boundary_conditions,
    initializers,
    fields
) -> StateVariables{NF, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, Cache, Clock{Float64, Float64, Float64, Int64, Int64}} where {NF, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, Cache<:Terrarium.EmptyCache}

Initialize a StateVariables data structure containing Fields defined on the given grid for all variables in vars. Any predefined boundary_conditions and fields will be passed through to initialize for each variable. The timestepper's cache is allocated via initialize(timestepper, state, progvars).

source
Terrarium.StateVariablesMethod
StateVariables(
    model::Terrarium.AbstractModel{NF, Grid} where Grid<:(Terrarium.AbstractLandGrid{NF});
    ...
) -> StateVariables
StateVariables(
    model::Terrarium.AbstractModel{NF, Grid} where Grid<:(Terrarium.AbstractLandGrid{NF}),
    params;
    clock,
    input_variables,
    boundary_conditions,
    initializers,
    fields
) -> StateVariables

Initialize a StateVariables data structure containing Fields for all variables defined by model defined on its associated grid. The clock specifies the initial simulation time and is mutated on each time step. User-specified boundary_conditions and initializers can be provided as NamedTuples with keys corresponding to the names of state variables to which they should be applied. If the state variables are defined within namespaces, the given NamedTuple must follow the same structure. The fields argument allows for manual preconstruction of Fields for the named state variables. The time stepper cache is allocated from the model's timestepper.

source
Terrarium.StaticExponentialRootDistributionType
struct StaticExponentialRootDistribution{NF} <: Terrarium.AbstractRootDistribution{NF}

Static vegetation root distribution implementation in [16] based on the scheme proposed by [25]. The continuous density of the root distribution is modeled as

\[\frac{\partial R}{\partial z} = \frac{1}{2} \left[ a \exp(a z) + b \exp(b z) \right]\]

which is then integrated over the soil column and normalized to sum to unity. Note that this is effectively the average of two exponential distributions with rates a and b, both with units m⁻¹. The resulting CDF of this distribution determines the root distribution.

Properties:

  • a: First empirical rate parameter for root distribution

  • b: Second empirical rate parameter for root distribution

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
  • [25] Zeng, Journal of Hydrometeorology (2001)
source
Terrarium.SurfaceEnergyBalanceType
struct SurfaceEnergyBalance{NF, SkinTemperature<:Terrarium.AbstractSkinTemperature{NF}, TurbulentFluxes<:Terrarium.AbstractTurbulentFluxes{NF}, RadiativeFluxes<:Terrarium.AbstractRadiativeFluxes{NF}, Albedo<:Terrarium.AbstractAlbedo{NF}} <: Terrarium.AbstractSurfaceEnergyBalance{NF}

Standard implementation of the surface energy balance (SEB) that computes the radiative, turbulent, and ground energy fluxes at the surface. The SEB is also responsible for defining and solving the so-called skin temperature (effective emission temperature of the land surface) as well as the albedo.

source
Terrarium.SurfaceEnergyModelType
struct SurfaceEnergyModel{NF, GridType<:(Terrarium.AbstractLandGrid{NF}), SEB<:Terrarium.AbstractSurfaceEnergyBalance, Atmosphere<:Terrarium.AbstractAtmosphere, Initializer<:Terrarium.AbstractInitializer, Timestepper<:Terrarium.AbstractTimeStepper{NF}} <: Terrarium.AbstractSurfaceEnergyModel{NF, GridType<:(Terrarium.AbstractLandGrid{NF})}

Simple model wrapper for the SurfaceEnergyBalance that couples it with an AbstractAtmosphere to provide meteorological inputs. This model type is mostly intended for testing but could also be used for simple energy balance calculations from prescribed meteorological and ground temperature conditions.

source
Terrarium.SurfaceHydrologyType
struct SurfaceHydrology{NF, CanopyInterception<:Terrarium.AbstractCanopyInterception{NF}, Evapotranspiration<:Terrarium.AbstractEvapotranspiration{NF}, SurfaceRunoff<:Terrarium.AbstractSurfaceRunoff{NF}} <: Terrarium.AbstractSurfaceHydrology{NF}

Default representation of coupled surface hydrology processes including canopy rain/snow interception, evapotranspiration, and surface runoff.

Properties:

  • canopy_interception: Canopy hydrology scheme

  • evapotranspiration: Canopy evapotranspiration scheme

  • surface_runoff: Surface runoff scheme

source
Terrarium.ThermodynamicConstantsType
struct ThermodynamicConstants{NF} <: Thermodynamics.Parameters.AbstractThermodynamicsParameters{NF}

Thermodynamic and atmospheric constants used in surface energy, turbulent flux, and vegetation process implementations. Subtypes AbstractThermodynamicsParameters so that it integrates directly with Thermodynamics.jl.

julia> show(ThermodynamicConstants(Float64))
ThermodynamicConstants{Float64}(1004.5, 2070.0, 4181.0, 1859.0, 333550.0, 2.5008e6, 2.83435e6, 273.16, 273.15, 273.16, 611.657, 287.0, 461.5)

Properties:

  • specific_heat_capacity_dry_air: Isobaric specific heat capacity of dry air at standard pressure and 0°C in J/(m^3*K)

  • specific_heat_capacity_ice: Isobaric specific heat capacity of ice at standard pressure and 0°C in J/(m^3*K)

  • specific_heat_capacity_liquid_water: Isobaric specific heat capacity of liquid water at standard pressure and 0°C in J/(m^3*K)

  • specific_heat_capacity_water_vapor: Isobaric specific heat capacity of water vapor at standard pressure and 0°C in J/(m^3*K)

  • latent_heat_fusion: Specific latent heat of fusion of water in J/kg at 0°C

  • latent_heat_vaporization: Specific latent heat of vaporization of water in J/kg at 0°C

  • latent_heat_sublimation: Specific latent heat of sublimation of water in J/kg at 0°C

  • temperature_reference: Reference temperature (0°C in Kelvin)

  • temperature_water_freeze: Freezing temperature of water in Kelvin

  • temperature_water_triple_point: Triple point temperature of water in Kelvin

  • pressure_water_triple_point: Triple point pressure of water in Pa

  • gas_constant_dry_air: Specific gas constant of dry air in J/(kg*K)

  • gas_constant_water_vapor: Specific gas constant of water vapor in J/(kg*K)

source
Terrarium.UniformSpacingType
struct UniformSpacing{NF} <: Terrarium.AbstractVerticalSpacing{NF}

Uniform vertical discretization with N layers of size Δz.

Properties:

  • Δz::Any

  • N::Int64

source
Terrarium.UniversalConstantsType
struct UniversalConstants{NF}

Universal physical constants used in surface energy and turbulent flux process implementations.

julia> show(UniversalConstants(Float64))
UniversalConstants{Float64}(9.80665, 5.6704e-8, 0.4)

Properties:

  • gravitational_acceleration: Gravitational constant in m/s^2

  • stefan_boltzmann_constant: Stefan-Boltzmann constant in J/(sm^2K^4)

  • von_karman_constant: von Kármán constant

source
Terrarium.UnsatKLinearType
struct UnsatKLinear{NF} <: Terrarium.AbstractUnsatK{NF}

Simple formulation of hydraulic conductivity as a linear function of the liquid water saturated fraction, i.e. soil.water / (soil.water + soil.ice + soil.air).

source
Terrarium.UnsatKVanGenuchtenType
struct UnsatKVanGenuchten{NF} <: Terrarium.AbstractUnsatK{NF}

Formulation of hydraulic conductivity as a function of saturated hydraulic conductivity K_sat and volumetric fractions, assumed to include those of water, ice, and air, following the van Genuchten formulation [7] extended with an ice impedance factor [8].

References

  • [7] Van Genuchten, Soil Science Society of America Journal (1980)
  • [8] Westermann et al., Geoscientific Model Development (2023)
source
Terrarium.VarPathType
VarPath

Type alias for namespaced variable paths of the form (namespace_1, ..., namespace_N, varname). Used to specify the location of variables in nested namespaces.

source
Terrarium.VariableType
struct Variable{name, VD, UT} <: Terrarium.AbstractVariable{name, VD, UT}

Represents metadata for a generic state variable with the given name and spatial dims.

source
Terrarium.VariablesType
struct Variables{ProgVars, TendVars, AuxVars, InputVars, Namespaces}

Container for abstract state variable definitions. Automatically collates and merges all variables and namespaces passed into the constructor.

source
Terrarium.VegetationCarbonCycleType
struct VegetationCarbonCycle{NF, Photosynthesis<:Terrarium.AbstractPhotosynthesis{NF}, StomatalConductance<:Terrarium.AbstractStomatalConductance{NF}, AutotrophicRespiration<:Terrarium.AbstractAutotrophicRespiration{NF}, Phenology<:Terrarium.AbstractPhenology{NF}, CarbonDynamics<:Terrarium.AbstractVegetationCarbonDynamics{NF}, VegetationDynamics<:Union{Nothing, Terrarium.AbstractVegetationDynamics}, RootDistribution<:Union{Nothing, Terrarium.AbstractRootDistribution}, PAW<:Union{Nothing, Terrarium.AbstractPlantAvailableWater}} <: Terrarium.AbstractVegetation{NF}

Coupled process type representing the major carbon cycle processes for natural vegetation.

source
Terrarium.VegetationModelType
struct VegetationModel{NF, Vegetation<:Terrarium.AbstractVegetation{NF}, Atmosphere<:(Terrarium.AbstractAtmosphere{NF, PR, IR, HM, AD} where {PR<:Terrarium.AbstractPrecipitation, IR<:Terrarium.AbstractIncomingRadiation, HM<:Terrarium.AbstractHumidity, AD<:Terrarium.AbstractAerodynamics{NF}}), GridType<:(Terrarium.AbstractLandGrid{NF}), Initializer<:Terrarium.AbstractInitializer, Timestepper<:Terrarium.AbstractTimeStepper{NF}} <: Terrarium.AbstractVegetationModel{NF, GridType<:(Terrarium.AbstractLandGrid{NF})}

Model for natural (unmanaged) vegetation processes for a single plant functional type (PFT). Multiple PFTs can be later handled with a TiledVegetationModel type that composes multiple VegetationModels with different parameters for each PFT.

Properties:

  • grid::Terrarium.AbstractLandGrid: Spatial grid type

  • atmosphere::Terrarium.AbstractAtmosphere: Atmospheric input configuration

  • vegetation::Terrarium.AbstractVegetation: Vegetation processes

  • constants::PhysicalConstants: Physical constants

  • initializer::Terrarium.AbstractInitializer: State variable initializer

  • timestepper::Terrarium.AbstractTimeStepper: Time stepper: a single AbstractTimeStepper (e.g. ForwardEuler, Heun) or an IMEX

source
Terrarium.WeightedAverageType
struct WeightedAverage <: Terrarium.AbstractBulkWeighting

Simple weighted average formula for computing bulk quantities:

\[\bar{x} = \sum_{i=1}^N \theta_i x_i\]

source
Terrarium.XYType
XY <: VarDims

Indicator type for variables that should be assigned a 2D (lateral only) field on their associated grid.

source
Terrarium.XYZType
XYZ <: VarDims

Indicator type for variables that should be assigned a 3D field on their associated grid.

source
Terrarium.FieldBCType

Alias for union type of FieldBoundaryConditions or a named tuple of BoundaryConditions with keys corresponding to boundary locations (i.e. top, bottom, etc.)

source
Terrarium.OptionalType

Alias for Union{Nothing, T} indicating that an argument or field of type T is optional and can be replaced with nothing.

source