API Reference

Adapt.adapt — Method
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.merge — Method

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

source
Oceananigans.Advection.cell_advection_timescale — Method
cell_advection_timescale(
    integrator::ModelIntegrator{NF, Arch, Grid, TimeStepper, Model} where {Arch<:Oceananigans.Architectures.AbstractArchitecture, Grid<:(Terrarium.AbstractLandGrid{NF}), TimeStepper<:Terrarium.AbstractTimeStepper{NF}, Model<:Terrarium.AbstractModel{NF, Grid}}
) -> Any

Return the advective stability timescale of the integrator. Land models currently transport no quantity advectively, so this is always Inf (no advective restriction); it exists only so that a plain TimeStepWizard (which always evaluates an advective timescale) can be applied to a Terrarium Simulation without providing a custom cell_advection_timescale.

source
Oceananigans.BoundaryConditions.compute_z_bcs! — Method
compute_z_bcs!(tendency, progvar, grid::AbstractLandGrid, clock, fields)

Convenience alias for Oceananigans.BoundaryConditions.compute_z_bcs! that adds flux BCs for progvar to its corresponding tendency.

source
Oceananigans.BoundaryConditions.getbc — Method
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.Diagnostics.cell_diffusion_timescale — Method
cell_diffusion_timescale(
    state,
    grid,
    snow::SingleLayerSnow,
    constants::PhysicalConstants
) -> Any

Return the minimum thermal diffusion timescale $τ = \max(d_{\text{snow}}, d_{\text{min}})² \, C_{\text{snow}} / κ_{\text{snow}}$ over the grid for the snow-top conduction operator, mirroring the cell_diffusion_timescale pattern used for soil. Uses the same floored conduction thickness (min_snow_conduction_thickness) that enters the actual conductive-flux calculations (compute_snow_surface_heat_flux, compute_snow_basal_heat_flux), so the reported timescale reflects the stability limit of the discretization as implemented — the floor bounds it below for a vanishing pack, while a genuinely thick pack still reports its own (longer, less restrictive) timescale rather than being pinned to the floor.

source
Oceananigans.Diagnostics.cell_diffusion_timescale — Method
cell_diffusion_timescale(
    state,
    grid,
    soil::SoilEnergyWaterCarbon,
    constants::PhysicalConstants
) -> Any

Return the minimum diffusive timescale over the coupled soil processes as the minimum of the individual energy (heat conduction) and hydrology (Richards) timescales.

source
Oceananigans.Diagnostics.cell_diffusion_timescale — Method
cell_diffusion_timescale(
    state,
    grid,
    energy::SoilThermodynamics,
    soil::Terrarium.AbstractSoil,
    args...
) -> Any

Return the minimum thermal diffusion timescale $τ = Δz² C / κ$ over the soil column for the SoilThermodynamics energy process, where κ is the bulk thermal conductivity (W m⁻¹ K⁻¹) and C the bulk volumetric heat capacity (J m⁻³ K⁻¹). This is the diffusive stability limit of the explicit heat conduction operator, whose effective temperature diffusivity is $α = κ / C$.

The sensible heat capacity is used (not the apparent capacity, which includes the latent heat of phase change); since the apparent capacity is never smaller, the reported timescale is conservative near the freezing front.

source
Oceananigans.Diagnostics.cell_diffusion_timescale — Method
cell_diffusion_timescale(integrator::ModelIntegrator) -> Any

Return the minimum diffusive stability timescale $τ = Δz² / D$ (seconds) over all grid cells of the integrator, where D is the largest effective diffusivity among the model's diffusive processes. This is the diagnostic consumed by the Oceananigans TimeStepWizard to enforce a diffusive Courant–Friedrichs–Lewy (CFL) constraint of the form $Δt ≈ \mathrm{diffusive\_cfl} · τ$.

The generic fallback (for models without an implemented diffusive timescale) returns Inf, i.e. no diffusive restriction, mirroring the Oceananigans infinite_diffusion_timescale convention.

source
Oceananigans.Diagnostics.cell_diffusion_timescale — Method
cell_diffusion_timescale(
    state,
    grid,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    soil::Terrarium.AbstractSoil,
    args...
) -> Any

Return the minimum hydraulic diffusion timescale $τ = Δz² (∂θ/∂ψ) / K$ over the soil column for a Richards-equation SoilHydrology, where K is the (variably saturated) hydraulic conductivity (m s⁻¹) and ∂θ/∂ψ the specific moisture capacity (m⁻¹). This is the diffusive stability limit of the explicit Richards operator, whose effective moisture diffusivity is $D = K ∂ψ/∂θ = K / (∂θ/∂ψ)$.

As the soil saturates, $∂θ/∂ψ → 0$ and the timescale tends to zero: explicit Richards is stiff near saturation, which is precisely the regime motivating implicit timestepping. The TimeStepWizard's min_change bound keeps the step from collapsing to zero in a single adjustment.

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

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.AmbientCO2 — Method

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

source
Terrarium.FreeDrainage — Method

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.GeothermalHeatFlux — Function

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.HomogeneousSoilStratigraphy — Method
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.InfiltrationFlux — Method

Alias for a discrete-form FluxBoundaryCondition on saturation_water_ice that normalizes the physical infiltration flux (m/s of water depth) by the top-of-soil porosity at evaluation time, since saturation_water_ice is the dimensionless saturation (VWC / porosity). See saturation_infiltration_bc.

source
Terrarium.SoilGridsStratigraphy — Method
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.SoilHeatFlux — Function

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_expr — Method

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})},
    _::Nothing
)

Kernel function that adjusts the saturation profile at i, j and discards any excess water reaching the surface. Used for standalone soil hydrology, where no surface runoff process owns a water pool.

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})},
    runoff::Terrarium.AbstractSurfaceRunoff
)

Kernel function that adjusts the saturation profile at i, j and routes any excess water reaching the surface into the surface_excess_water pool owned by the given surface runoff process.

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

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

source
Terrarium.aerodynamic_resistance — Method
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_density — Method
air_density(i, j, grid, fields, atmos::AbstractAtmosphere, constants::PhysicalConstants)

Compute density (kg m⁻³) of a parcel of air under current atmospheric conditions.

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

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

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

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

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

Return the surface albedo at grid point i, j.

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

Return the current albedo at the given indices.

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

Return the current prescribed ambient CO2 concentration level.

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

Convenience constructor method for AuxiliaryVariable.

source
Terrarium.auxiliary_fields — Method
auxiliary_fields(state, components)

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

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

Compute the canopy evaporation vapor conductance [m/s] from the current canopy saturation fraction f_can and aerodynamic resistance rₐ.

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

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

source
Terrarium.celsius_to_kelvin — Method
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! — Function
closure!(
    state,
    grid,
    soil::SoilEnergyWaterCarbon,
    constants::PhysicalConstants
)
closure!(
    state,
    grid,
    soil::SoilEnergyWaterCarbon,
    constants::PhysicalConstants,
    surface_hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology}
)

Compute the forward closure mapping for soil hydrology and energy, in that order.

An optional surface_hydrology process may be supplied (by the coupled LandModel) so that excess water removed from an oversaturated soil surface is routed into the surface_excess_water pool owned by its runoff scheme (get_surface_runoff). Without it (standalone soil), the excess is discarded.

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
)
closure!(
    state,
    grid,
    closure::SoilSaturationPressureClosure,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    soil::Terrarium.AbstractSoil,
    runoff::Union{Nothing, Terrarium.AbstractSurfaceRunoff},
    args...
)

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

An optional runoff process routes excess water removed from an oversaturated soil surface into the runoff-owned surface_excess_water pool; without it the excess is discarded.

source
Terrarium.closure_fields — Method
closure_fields(state, components)

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

source
Terrarium.closures — Method
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_APAR — Method
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_Ag — Method
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_tend — Method
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_GPP — Method
compute_GPP(_::LUEPhotosynthesis{NF}, An) -> Any

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

source
Terrarium.compute_JE_JC — Method
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_NPP — Method
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_PAR — Method
compute_PAR(photo::LUEPhotosynthesis{NF}, swdown) -> Any

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

source
Terrarium.compute_Ra — Method
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_Rd — Method
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_Rm — Method
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_max — Method
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_factors — Method
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_respiration — Function
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_respiration — Method
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, 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, seb::SurfaceEnergyBalance)
compute_auxiliary!(
    state,
    grid,
    seb::SurfaceEnergyBalance,
    vegetation::Union{Nothing, Terrarium.AbstractVegetation}
)
compute_auxiliary!(
    state,
    grid,
    seb::SurfaceEnergyBalance,
    vegetation::Union{Nothing, Terrarium.AbstractVegetation},
    snow::Union{Nothing, Terrarium.AbstractSnow},
    args...
)
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! — 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,
    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,
    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,
    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! — 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,
    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!(
    state,
    grid,
    soil::SoilEnergyWaterCarbon,
    constants::PhysicalConstants
)

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_index — Method
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_boundary_conditions! — Function
compute_boundary_conditions!(state, model::AbstractModel)

Compute all internal and external boundary conditions for spatially explicit prognostic and auxiliary variables defined on the model. This should typically be invoked after compute_auxiliary! but before compute_tendencies!.

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

Compute boundary conditions for all spatially explicit prognostic and auxiliary variables defined by the given process on grid.

source
Terrarium.compute_boundary_conditions! — Method
compute_boundary_conditions!(
    state,
    grid,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    strat::Terrarium.AbstractStratigraphy,
    bgc::Terrarium.AbstractSoilBiogeochemistry
)

Fill the pressure_head halo and apply the top/bottom flux boundary conditions for saturation_water_ice. The fields passed to those boundary conditions are built explicitly here (rather than using state.inputs, which only carries declared input variables) so that a discrete-form condition like saturation_infiltration_bc can read auxiliary fields (infiltration) and per-horizon namespaces (via strat/bgc) that only exist once the full state does. infiltration is only merged in when present, since standalone (non-LandModel) configurations may not declare it at all.

source
Terrarium.compute_canopy_interception — Method
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_tendency — Method
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_tendency — Method
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_evapotranspiration_conductances — Function
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,
    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_conductances — Method
compute_evapotranspiration_conductances(
    i,
    j,
    grid,
    fields,
    evapotranspiration::PALADYNCanopyEvapotranspiration,
    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_temp — Method
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_tendency — Method
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 and store ground_heat_flux on grid, dispatching on skinT to the type-specific kernel function: the atmosphere-side demand $R_\text{net} + H_s + H_l$ for PrescribedSkinTemperature (which has no separate conduction target), or the explicit conductive flux $2\kappa_g(T_g - T_s)/\Delta z_g$ for ImplicitSkinTemperature (all fluxes positive upward).

source
Terrarium.compute_ground_heat_flux — Method
compute_ground_heat_flux(
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    _::Terrarium.AbstractSurfaceEnergyBalance
) -> Any

Compute the conductive ground heat flux from the current skin_temperature and ground_temperature.

source
Terrarium.compute_ground_heat_flux — Method
compute_ground_heat_flux(
    i,
    j,
    grid,
    fields,
    skinT::PrescribedSkinTemperature,
    seb::Terrarium.AbstractSurfaceEnergyBalance
) -> Any

For PrescribedSkinTemperature, set the ground heat flux directly to the demand, i.e. G₀ = R_net + H_s + H_l.

source
Terrarium.compute_ground_heat_flux_demand — Method
compute_ground_heat_flux_demand(
    i,
    j,
    grid,
    fields,
    skinT::Terrarium.AbstractSkinTemperature,
    _::Terrarium.AbstractSurfaceEnergyBalance
) -> Any

Compute the ground heat flux demand from the surface net radiation and sensible/latent heat flux at grid cell i, j: i.e. the flux implied by the radiative budget and turbulent fluxes, G = R_net + H_s + H_l.

source
Terrarium.compute_ground_heat_flux_demand — Method
compute_ground_heat_flux_demand(
    _::Terrarium.AbstractSkinTemperature,
    R_net,
    H_s,
    H_l
) -> Any

Compute the residual ground heat flux that would close 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_hydraulic_diffusion_timescale — Method
compute_hydraulic_diffusion_timescale(
    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
) -> Any

Kernel function returning the hydraulic diffusion timescale $Δz² (∂θ/∂ψ) / K$ at cell i, j, k. The hydraulic conductivity K is evaluated at the cell centre from the local soil composition; the specific moisture capacity ∂θ/∂ψ is the analytic derivative of the soil-water retention curve (from FreezeCurves) evaluated at the matric potential ψₘ, reconstructed from the stored total pressure_head by removing its hydrostatic and elevation components. Cells with zero hydraulic conductivity (fully dry or frozen) impose no restriction and return Inf.

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_infiltration — Method
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_parameters — Method
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_flux — Method
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_latent_heat_flux — Method
compute_latent_heat_flux(
    i,
    j,
    grid,
    fields,
    tur::DiagnosedTurbulentFluxes{NF},
    skinT::Terrarium.AbstractSkinTemperature,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
) -> Any
compute_latent_heat_flux(
    i,
    j,
    grid,
    fields,
    tur::DiagnosedTurbulentFluxes{NF},
    skinT::Terrarium.AbstractSkinTemperature,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    surface_hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology}
) -> Any
compute_latent_heat_flux(
    i,
    j,
    grid,
    fields,
    tur::DiagnosedTurbulentFluxes{NF},
    skinT::Terrarium.AbstractSkinTemperature,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    surface_hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology},
    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_leaf_area_index — Method
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_up — Method
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_outflow — Method
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_phenology — Function
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_phenology — Method
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_factor — Method
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_photosynthesis — Function
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_photosynthesis — Method
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_water — Function
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_water — Method
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_ground — Method
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_i — Method
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_assimilation — Method
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_flux — Method
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_flux — Method
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_up — Method
compute_shortwave_up(::DiagnosedRadiativeFluxes, S_down, α)

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

source
Terrarium.compute_skin_temperature — Method
compute_skin_temperature(
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature{NF},
    constants::PhysicalConstants,
    snow::Terrarium.AbstractSnow
) -> Any

Invert the (linear) area-weighted conduction relation for the implicit skin temperature Ts given the atmosphere-side demanded flux G (= R_net + H_s + H_l), by equating G to the area-weighted sum of the unblended ground and snow-top conductive fluxes, (1 − f_snow)·2κg(Tg − Ts)/Δzg + f_snow·2κsnow(Tsnow − Ts)/dsnow.

source
Terrarium.compute_skin_temperature — Method
compute_skin_temperature(
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature{NF},
    args...
) -> Any

Invert the (linear) ground-only conduction relation for the implicit skin temperature Ts given the atmosphere-side demanded flux G (= R_net + H_s + H_l): Ts = Tg − G/(2κg/Δzg). This is the no-snow special case (f_snow = 0) of the snow-aware method below; it is a separate method (rather than a default snow = nothing) purely so it can skip the unused snow_thermal_interface/snow_cover_fraction calls.

source
Terrarium.compute_skin_temperature_residual! — Function
compute_skin_temperature_residual!(
    out,
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
) -> Any
compute_skin_temperature_residual!(
    out,
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology}
) -> Any
compute_skin_temperature_residual!(
    out,
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology},
    snow::Union{Nothing, Terrarium.AbstractSnow}
) -> Any

Surface-energy-balance residual at grid cell i, j, in temperature space: Ts_prev − Ts_implicit, where Ts_implicit is the exact conduction-side inverse (see compute_skin_temperature) of the atmosphere-side demanded flux G_demand = R_net(Ts_prev) + H(Ts_prev) + LE(Ts_prev).

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

Snow→soil basal conductive heat flux Q_base [W/m²] at grid cell i, j, positive upward (soil → snow), as the series-resistance conduction between the soil's top half-cell and the snow layer: Q_base = (T_soil − T_snow) / (Δz_soil/(2κ_soil) + d_snow/(2κ_snow)). Both the local soil top-layer thermal conductivity κ_soil and the snow conductivity κ_snow are recovered from their respective composition/density schemes rather than stored. The snow-side conduction thickness is floored at min_snow_conduction_thickness as d_snow → 0, matching the floor used elsewhere in the snow thermodynamics; without the soil-side term this reduces to the previous snow-resistance-only closure, which is only valid once the soil resistance is genuinely negligible next to the (floored) snow's.

source
Terrarium.compute_snow_cover_fraction — Method
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_depth — Method
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_diffusion_timescale — Method
compute_snow_diffusion_timescale(
    i,
    j,
    grid,
    fields,
    snow::SingleLayerSnow,
    constants::PhysicalConstants
) -> Any

Kernel function returning the snow thermal diffusion timescale $\max(d_{\text{snow}}, d_{\text{min}})² \, C_{\text{snow}} / κ_{\text{snow}}$ at grid cell i, j, with the bulk thermal conductivity and heat capacity computed from the local snow density and liquid fraction.

source
Terrarium.compute_snow_energy_tendency — Method
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.

The conductive/sublimation terms Q_base - Q_top + Q_subl are gated to zero when the pack is empty at the start of the step (W == 0), since they are otherwise evaluated against a degenerate zero-depth layer (Q_top/Q_base conduction targets floored at min_conduction_thickness, giving an arbitrarily large flux relative to a genuinely-thin pack's tiny heat capacity). Q_prcp is not gated: it is a pure source term from the precipitation rate alone, well-defined regardless of the existing pack depth. Gating it too — as a previous implementation did, multiplying the whole dUdt including Q_prcp by W > 0 — zeroed the energy input on the very first step any snow accumulates onto bare ground (W is read before that step's mass increment), leaving the freshly-fallen, physically cold snow with zero recorded enthalpy. Under the FreeWater closure (U = 0 ≡ liquid water at 0 °C) that reads as instantaneously fully melted, triggering spurious immediate Darcy drainage regardless of how cold the air actually was.

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), the snow-top conductive flux (see compute_snow_surface_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), the snow-top conductive flux (surface_heat_flux, drives the snowpack's own energy tendency), 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_flux — Method
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_flux — Method
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 (see compute_snow_basal_heat_flux) and the explicit bare-ground conductive flux G (ground_heat_flux, already the unblended per-bare-ground-area quantity — see the ImplicitSkinTemperature-specific compute_ground_heat_flux in skin_temperature.jl), f_snow·Q_base + (1 − f_snow)·G.

source
Terrarium.compute_snow_sublimation_flux — Method
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. 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 (i.e. when snow === nothing).

source
Terrarium.compute_snow_surface_heat_flux — Method
compute_snow_surface_heat_flux(
    i,
    j,
    grid,
    fields,
    snow::SingleLayerSnow,
    constants::PhysicalConstants
) -> Any

Snow-top conductive heat flux [W/m²] at grid cell i, j (positive upward, i.e. energy leaving the snow top into the skin), S = 2κ_snow(T_snow − T_skin)/max(d_snow, d_min) — the same unblended snow conduction target the skin-temperature solve closes against (see Terrarium.snow_thermal_interface). This is the per-unit-snow-area flux that drives the snowpack's own top-of-pack energy tendency (compute_snow_energy_tendency's Q_top); it replaces a previous unweighted alias to the whole-grid-cell ground_heat_flux, which forced the entire snowpack with a flux sized for the whole cell regardless of how small the snow-covered fraction actually was.

source
Terrarium.compute_snow_volumetric_energy — Method
compute_snow_volumetric_energy(Ū_snow, d_snow, d_min) -> Any

Volumetric snow internal energy U_snow = Ū_snow/max(d_snow, d_min) [J/m³] from the depth-integrated energy Ū_snow [J/m²] and the snow depth d_snow [m]. The depth is floored at the minimum thermal thickness d_min (see min_snow_conduction_thickness) rather than a machine-eps offset. This bounds the snow temperature recovered downstream: with only an eps offset, any residual Ū_snow over a vanishing d_snow gives a huge U_snow and hence a snow temperature far below physical bounds, which then corrupts the (cover-fraction-blended) skin temperature and basal heat flux. Flooring at d_min gives a thin snowpack a bounded effective heat capacity C_snow·d_min, so it stores negligible energy and is thermally transient — the ground heat flux passes essentially unmediated to the soil (f_snow → 0 in the blend) while the pack still stores mass and modifies the surface albedo.

source
Terrarium.compute_snow_volumetric_heat_capacity — Method
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_tendency — Method
compute_snow_water_tendency(
    i,
    j,
    grid,
    fields,
    snow::SingleLayerSnow{NF},
    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_difference — Method
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_conductance — Function
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_conductance — Method
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_conductance — Method
compute_stomatal_conductance(
    stomcond::MedlynStomatalConductance{NF},
    traits::PlantTraits{NF},
    constants::PhysicalConstants{NF},
    vpd,
    T_air,
    pres,
    co2_ppm,
    An,
    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_drainage — Method
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!(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_energy_fluxes! — Function
compute_surface_energy_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere
) -> Any
compute_surface_energy_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology}
) -> Any
compute_surface_energy_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    seb::SurfaceEnergyBalance,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology},
    snow::Union{Nothing, Terrarium.AbstractSnow},
    args...
) -> Any

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_excess_water_tendency! — Method
compute_surface_excess_water_tendency!(
    tendencies,
    i,
    j,
    grid,
    fields,
    runoff::DirectSurfaceRunoff{NF}
) -> Any

Kernel function for computing the tendency of the prognostic surface_excess_water pool in the grid column i, j. The pool is drained at the surface drainage rate D = compute_surface_drainage, capped so that a single step cannot remove more water than is present (min(D, S)). The tendency is returned as a negative rate (a removal) consistent with the positive-upward flux convention used by the other surface hydrology tendencies, so that surface_excess_water += ∂S∂t * Δt draws the pool down.

source
Terrarium.compute_surface_humidity_flux — Method
compute_surface_humidity_flux(
    i,
    j,
    grid,
    fields,
    evaporation::BareGroundEvaporation,
    constants::PhysicalConstants,
    atmos::Terrarium.AbstractAtmosphere,
    args...
) -> Any

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

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

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

source
Terrarium.compute_surface_humidity_fluxes — Method

Compute unscaled transpiration, evaporation_ground, and evaporation_canopy fluxes on grid. Following the implementation of PALADYN, Qh_can is clamped to be strictly positive (no canopy dew formation).

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_runoff — Method
compute_surface_runoff(
    runoff::DirectSurfaceRunoff,
    influx,
    surface_drainage,
    infil
) -> Any

Compute surface runoff as precipitation + surface_drainage - infiltration.

source
Terrarium.compute_surface_upwelling_radiation — Method
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,
    soil::SoilEnergyWaterCarbon,
    constants::PhysicalConstants
)

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

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},
    args...
)
source
Terrarium.compute_thermal_conductivity — Method
compute_thermal_conductivity(
    i,
    j,
    k,
    grid,
    fields,
    energy::SoilThermodynamics,
    hydrology::Terrarium.AbstractSoilHydrology,
    strat::Terrarium.AbstractStratigraphy,
    bgc::Terrarium.AbstractSoilBiogeochemistry
) -> Any
source
Terrarium.compute_thermal_conductivity — Method
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_conductivity — Method
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_thermal_diffusion_timescale — Method
compute_thermal_diffusion_timescale(
    i,
    j,
    k,
    grid,
    fields,
    energy::SoilThermodynamics,
    hydrology::Terrarium.AbstractSoilHydrology,
    strat::Terrarium.AbstractStratigraphy,
    bgc::Terrarium.AbstractSoilBiogeochemistry
) -> Any

Kernel function returning the thermal diffusion timescale $Δz² C / κ$ at cell i, j, k, with the bulk thermal conductivity κ and heat capacity C computed from the local soil composition.

source
Terrarium.compute_turbulent_fluxes! — Method
compute_turbulent_fluxes!(
    out,
    i,
    j,
    grid,
    fields,
    tur::DiagnosedTurbulentFluxes,
    skinT,
    constants,
    atmos,
    hydrology,
    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,
    args...
)

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_deficit — Method
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_difference — Method
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_tendency — Function
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_tendency — Method
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_water_content_tendency — Method
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_tendency — Method
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_Γ_star — Method
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_Λ_loc — Method
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_γv — Method
compute_γv(veg_dynamics)

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

References

  • [16] Willeit & Ganopolski, Geoscientific Model Development (2016)
source
Terrarium.compute_λ_NPP — Method
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_λc — Method
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_ν_star — Method
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_ν_tendency — Function
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_ν_tendency — Method
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_ν_tendency — Method
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_dt — Method
convert_dt(Δt)

Convert Δts to the given target Period or numeric type. Numeric types are always assumed to be in seconds.

source
Terrarium.darcy_flux — Method
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_length — Method
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.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.default_clock — Method
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_dt — Function
default_dt(timestepper::AbstractTimeStepper)

Get the current timestep size for the time stepper.

source
Terrarium.default_dt — Method
default_dt(integrator::ModelIntegrator)

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

source
Terrarium.default_skin_temperature_solver — Method
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_soc — Function
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_soc — Method
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.diagnose_evaporation_flux — Method
diagnose_evaporation_flux(state, model::LandModel) -> Any

Return a KernelFunctionOperation that computes the evaporation flux [m/s liquid water] over all grid cells. The kinematic humidity flux is rescaled by the air-to-water density ratio and weighted by the snow-free area fraction.

source
Terrarium.diagnose_surface_humidity_flux — Method
diagnose_surface_humidity_flux(
    state,
    model::LandModel
) -> Any

Return a KernelFunctionOperation that computes the kinematic surface humidity flux [m/s] over all grid cells.

source
Terrarium.diffusive_heat_flux — Method
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_coefficient — Method
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.emissivity — Method
emissivity(
    i,
    j,
    grid,
    fields,
    albedo::ConstantAlbedo
) -> Any

Return the surface emissivity at grid point i, j.

source
Terrarium.emissivity — Method
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{NF},
    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_temperature — Method
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.fastiterate — Method
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.fastmap — Method
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.fastmap — Method
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_indices — Method
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_z — Method
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.forcing — Method
forcing(
    i,
    j,
    k,
    grid,
    clock,
    fields,
    evapotranspiration::Terrarium.AbstractEvapotranspiration,
    _::Terrarium.AbstractSoilHydrology,
    args...
) -> Any

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

source
Terrarium.forcing — Method
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_albedo — Method
get_albedo(seb)

Return the albedo parameterization associated with the surface energy balance.

source
Terrarium.get_artifact — Method
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_asset — Method
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_cache — Method
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_closure — Method
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_constants — Method
get_constants(model::AbstractModel)::PhysicalConstants

Return the PhysicalConstants associated with the given model.

source
Terrarium.get_field — Method
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_grid — Function
get_field_grid(grid::AbstractLandGrid)::Oceananigans.AbstractGrid

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

source
Terrarium.get_fields — Method
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_fields — Method
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_fields — Method
get_fields(state, components; except)

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

source
Terrarium.get_fields — Method
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_grid — Method
get_grid(model::AbstractModel)::AbstractLandGrid

Return the spatial grid associated with the given model.

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

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

source
Terrarium.get_initializer — Method
get_initializer(model::AbstractModel)::AbstractInitializer

Return the initializer associated with the given model.

source
Terrarium.get_spacing — Method
get_spacing(spacing)

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

source
Terrarium.get_swrc — Function
get_swrc(::AbstractUnsatK)

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

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

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

source
Terrarium.get_swrc — Method
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_conductance — Method
ground_evaporation_conductance(
    _::PALADYNCanopyEvapotranspiration,
    β,
    rₐ,
    rₐ_can
) -> Any

Compute the ground evaporation conductance from the given resistance factor β and aerodynamic resistances.

source
Terrarium.ground_evaporation_resistance_factor — Function
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_evapotranspiration_flux — Function
ground_evapotranspiration_flux(i, j, grid, fields, ::AbstractEvapotranspiration)

Return the total ground evapotranspiration flux [m/s], i.e. ground evaporation + plant transpiration, at cell i, j based on the current state.

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

Return the current ground heat flux at the given indices.

source
Terrarium.ground_thermal_interface — Method
ground_thermal_interface(
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature
) -> Tuple{Any, Any, Any}

Return the conduction target (Tg, κ, Δz) for the snow-free ground: the uppermost ground layer's ground_temperature, the assumed surface conductivity κₛ, and the top ground cell thickness. This is always the unblended ground-only target, used both when there is no snow and (weighted by 1 - f_snow) for the bare-ground share of the skin-temperature solve when there is.

source
Terrarium.humidity_flux — Method
humidity_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).

source
Terrarium.hydraulic_conductivity — Function

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

source
Terrarium.hydraulic_conductivity — Method
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!(
    state,
    grid,
    soil::SoilEnergyWaterCarbon,
    constants::PhysicalConstants
)

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.initialize — Method
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.initialize — Method
initialize(
    vars::OrderedCollections.OrderedDict{Symbol, <:Terrarium.AbstractVariable},
    grid::Terrarium.AbstractLandGrid,
    clock::Clock,
    fields::OrderedCollections.OrderedDict{Symbol, Oceananigans.Fields.AbstractField},
    boundary_conditions::NamedTuple
) -> OrderedCollections.OrderedDict{Symbol, Oceananigans.Fields.AbstractField}

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

source
Terrarium.initialize — Method
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.initialize — Method
initialize(
    var::Terrarium.AbstractVariable,
    grid::Terrarium.AbstractLandGrid,
    clock::Clock,
    fields::OrderedCollections.OrderedDict{Symbol, Oceananigans.Fields.AbstractField},
    boundary_conditions::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 user_fields contains a Field matching the name of var, this field will be directly returned. Otherwise check the accumulated dict for fields from previous groups. Otherwise, the new Field is constructed using the given boundary_conditions.

source
Terrarium.initialize — Method
initialize(
    var::Terrarium.AuxiliaryVariable,
    grid::Terrarium.AbstractLandGrid,
    clock::Clock,
    fields::OrderedCollections.OrderedDict{Symbol, Oceananigans.Fields.AbstractField},
    boundary_conditions::NamedTuple
) -> Any

Initialize a Field on grid for the given AuxiliaryVariable.

source
Terrarium.initialize — Method
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.initialize — Method
initialize(
    model::Terrarium.AbstractModel{NF, Grid} where Grid<:(Terrarium.AbstractLandGrid{NF});
    ...
) -> 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 {_A, _B<:Oceananigans.Architectures.AbstractArchitecture, _C<:(Terrarium.AbstractLandGrid{_A}), _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}}}}
initialize(
    model::Terrarium.AbstractModel{NF, Grid} where Grid<:(Terrarium.AbstractLandGrid{NF}),
    params;
    clock,
    inputs,
    boundary_conditions,
    initializers,
    fields
) -> 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 {_A, _B<:Oceananigans.Architectures.AbstractArchitecture, _C<:(Terrarium.AbstractLandGrid{_A}), _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}}}}

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.input — Method
input(name, dims; default, units, bounds, desc)

Convenience constructor method for InputVariable.

source
Terrarium.input_fields — Method
input_fields(state, components)

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

source
Terrarium.invclosure! — Function
invclosure!(
    state,
    grid,
    soil::SoilEnergyWaterCarbon,
    constants::PhysicalConstants
)
invclosure!(
    state,
    grid,
    soil::SoilEnergyWaterCarbon,
    constants::PhysicalConstants,
    surface_hydrology::Union{Nothing, Terrarium.AbstractSurfaceHydrology}
)

Compute the inverse closure mapping for soil hydrology and energy, in that order.

See closure! for the role of the optional surface_hydrology process.

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
)
invclosure!(
    state,
    grid,
    closure::SoilSaturationPressureClosure,
    hydrology::SoilHydrology{NF, RichardsEq, SaturationClosure, SoilHydraulics} where {SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})},
    soil::Terrarium.AbstractSoil,
    runoff::Union{Nothing, Terrarium.AbstractSurfaceRunoff},
    args...
)

Computes saturation_water_ice from the current pressure_head state.

See closure! for the role of the optional runoff process.

source
Terrarium.is_adaptive — Function
is_adaptive(timestepper::AbstractTimeStepper)

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

source
Terrarium.iterations — Method
iterations(_::Terrarium.NewtonSolver{NF, N}) -> Any

Number of Newton iterations performed by the given solver.

source
Terrarium.kelvin_to_celsius — Method
kelvin_to_celsius(c::ThermodynamicConstants, T)

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

source
Terrarium.kernel — Method
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.kernel_operation — Method
kernel_operation(
    func,
    state,
    grid,
    args...;
    location,
    with_clock
) -> Any

Return a KernelFunctionOperation over grid with the given state and trailing args.

source
Terrarium.latent_heat_flux — Method
latent_heat_flux(i, j, grid, fields, ::AbstractTurbulentFluxes)

Return the current latent heat flux at the given indices.

source
Terrarium.liquid_water_fraction — Function
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_fraction — Method
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_asset — Method
load_asset(
    asset::Terrarium.AbstractLandAsset,
    name::String;
    NF,
    fill_value
) -> Any

Download (if necessary) the given asset via get_asset and read the variable name from its data file, returning a suitable Array-type based on the asset's file format. 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.load_asset — Method
load_asset(path, name, fmt, ::Type{NF}; indices, fill_value) where {NF}

Dispatch implemented by I/O backends which reads variable name from the asset file at path.

source
Terrarium.locate_asset_file — Method
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_down — Method
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_up — Method
longwave_up(i, j, grid, fields, ::AbstractRadiativeFluxes)

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

source
Terrarium.matches_scope — Method
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.min_snow_conduction_thickness — Method
min_snow_conduction_thickness(
    i,
    j,
    grid,
    fields,
    _::SingleLayerSnow
) -> Any

Minimum snow thickness (m) used to regularize the snow thermodynamics (conductive fluxes and the volumetric energy/temperature closure) as the pack thins toward zero: half the thickness of the uppermost soil grid cell, so the floor scales with the grid resolution rather than a fixed constant.

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_porosity — Function
mineral_porosity(::AbstractSoilPorosity, texture::SoilTexture)

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

source
Terrarium.mineral_texture — Function
organic_fraction(::AbstractSoilMatrix)

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

source
Terrarium.mineral_thermal_conductivity — Method
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.ntdiff — Method
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_fraction — Method
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_porosity — Function
organic_porosity(::AbstractSoilPorosity, texture::SoilTexture)

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

source
Terrarium.porosity — Method
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.porosity — Method
porosity(horizon::Terrarium.AbstractSoilHorizon) -> Any

Return the porosity parameterization for the given soil horizon.

source
Terrarium.porosity_top — Method
porosity_top(
    i,
    j,
    grid,
    fields,
    strat::Terrarium.AbstractStratigraphy,
    bgc::Terrarium.AbstractSoilBiogeochemistry
) -> Any

Porosity of the topmost soil layer at column i, j, i.e. porosity(i, j, Nz, grid, fields, strat, bgc) where Nz is the number of grid cells in the z-dimension. Intended for use as a 2D (XY) diagnostic or boundary condition term, e.g. via KernelFunctionOperation{Center, Center, Nothing}.

source
Terrarium.processes — Method
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.prognostic — Method
prognostic(name, dims; units, closure, bounds, desc)

Convenience constructors for PrognosticVariable.

source
Terrarium.prognostic_fields — Method
prognostic_fields(state, components)

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

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

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

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

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

source
Terrarium.redistribute_saturation_profile! — Method
redistribute_saturation_profile!(
    sat,
    i,
    j,
    grid,
    hydrology::SoilHydrology{NF, VerticalFlow, SaturationClosure, SoilHydraulics} where {VerticalFlow<:Terrarium.AbstractVerticalFlow, SaturationClosure<:Terrarium.AbstractSoilWaterClosure, SoilHydraulics<:(Terrarium.AbstractSoilHydraulics{NF})}
) -> Any

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. The remaining surface excess (as a water depth in m³/m²) is returned so that the caller can either route it into a surface water pool or discard it.

source
Terrarium.relative_to_specific_humidity — Method
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_update — Method
relaxed_update(
    relax::Terrarium.RelaxationFactor{NF},
    x_target,
    x_old
) -> Any

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

source
Terrarium.resolve_timestepping — Method
resolve_timestepping(imex, progvars, model)

Resolve the timestepping class of each prognostic variable in progvars (an OrderedDict or NamedTuple of PrognosticVariables) for the IMEX timestepper imex and owning model, returned as a tuple of Explicit/Implicit instances in the same order as progvars. Each variable's class is given by timestepping(var, model, imex).

source
Terrarium.root_density — Function
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_density — Method
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, steps, checkpointing = false)

Advance integrator for the given number of 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.safediv — Method
safediv(x, y)

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

source
Terrarium.saturation_infiltration_bc — Method
saturation_infiltration_bc(
    i,
    j,
    grid,
    clock,
    fields,
    parameters
) -> Any

Discrete-form boundary-condition function (see InfiltrationFlux) computing -infiltration / por at column i, j, where infiltration is the physical infiltration flux (m/s of water depth, positive downward) and por is the porosity of the topmost soil layer (porosity_top). saturation_water_ice is the dimensionless saturation (VWC / porosity) so the flux crossing the top boundary must be normalized by porosity to be dimensionally consistent with the interior Richards tendency, which divides by porosity for the same reason (see compute_saturation_tendency!). Note that the hydrology ,odule computes infiltration as positive downward, so it is negated here since fluxes are by convention positive upward.

source
Terrarium.saturation_specific_humidity_vapor — Method
saturation_specific_humidity_vapor(c::ThermodynamicConstants, T, ρ)

Compute saturation specific humidity at temperature T (°C) and density ρ (kg/m³) via q_vap_saturation. Uses ice-phase saturation for T < -1°C, liquid-water saturation for T > 0°C, and linearly interpolates between the two in the range [-1, 0]°C to avoid a discontinuity at the freezing point that can break Newton-type root solvers.

source
Terrarium.saturation_water_ice — Function
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_down — Method
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_up — Method
shortwave_up(i, j, grid, fields, ::AbstractRadiativeFluxes)

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

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

Return the current skin temperature at the given indices.

source
Terrarium.snow_cover_fraction — Function
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_density — Method
snow_density(density::ConstantSnowDensity) -> Any

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

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

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

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

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

source
Terrarium.snow_energy — Function
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_thermal_interface — Method
snow_thermal_interface(
    i,
    j,
    grid,
    fields,
    snow::Terrarium.AbstractSnow,
    constants::PhysicalConstants
) -> Tuple{Any, Any, Any}

Return the conduction target (Tsnow, κsnow, dsnow) for the snow-covered fraction: the snow's own (bulk) temperature, its thermal conductivity recovered from the density scheme, and its depth floored at min_snow_conduction_thickness. Without snow (snow === nothing), returns a placeholders with κsnow = 0 such that the snow conductive heat flux reduces to zero.

source
Terrarium.snow_water_equivalent — Function
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.snowfall — Method
snowfall(i, j, grid, fields, ::AbstractAtmosphere{NF, <:RainSnow})

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

source
Terrarium.soil_composition — Function
soil_composition(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_composition — Method
soil_composition(
    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.soil_horizon — Method
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_matrix — Function
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_matrix — Method
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_factor — Method
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_flux — Function
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_texture — Function
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_texture — Method
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.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, NewtonSolver or FixedPointSolver.

source
Terrarium.solve_skin_temperature! — Method
solve_skin_temperature!(
    out,
    i,
    j,
    grid,
    fields,
    skinT::ImplicitSkinTemperature,
    seb::Terrarium.AbstractSurfaceEnergyBalance,
    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_air — Method
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_humidity — Method
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_difference — Method
specific_humidity_difference(
    c::ThermodynamicConstants{NF},
    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_boltzmann — Method
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_water — Function
surface_excess_water(i, j, k, grid, fields, ::AbstractSoilHydrology)

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

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.tendency — Method
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_fields — Method
tendency_fields(state, components)

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

source
Terrarium.timestamp — Method
timestamp(_, reftime, Δt)

Convert the time delta Δt to a suitable timestamp of type TT relative to reftime. If TT is a TimeType (i.e. Date or DateTime), then this method returns reftime + Δt.

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.timestepping — Method
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_conductance — Method
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.uses_reactant — Method
uses_reactant(_)

Return true when Reactant is loaded, false otherwise.

Note, that ReactantCore.within_compile is not used because it doesn't work properly when KA kernels aren't raised.

source
Terrarium.vapor_pressure_deficit — Method
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.var — Function
var(name, dims)
var(name, dims, units)

Convenience constructor for Variable.

source
Terrarium.variables — Function
variables(model::AbstractModel)
variables(process::AbstractProcess)

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

source
Terrarium.variables — Method
variables(_::InputSource) -> Any

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

source
Terrarium.varname — Method
varname(source::InputSource)

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

source
Terrarium.varname — Method
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.varpath — Method
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_fraction — Function
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_fractions — Method
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_fractions — Method
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_table — Function
water_table(i, j, k, grid, fields, ::AbstractSoilHydrology)

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

source
Terrarium.windspeed — Method
windspeed(
    i,
    j,
    grid,
    fields,
    atmos::Terrarium.AbstractAtmosphere{NF, PR, IR, HD, Windspeed, AD} where AD<:Terrarium.AbstractAerodynamics{NF}
) -> Any

Retrieve or compute the windspeed at the current time step.

source
Terrarium.with_scope — Method
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_horizon — Method
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.Type — Method
(::Type{Model})(grid::AbstractLandGrid; kwargs...) where {Model <: AbstractModel}

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

source
Oceananigans.Fields.Field — Type
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.Field — Method
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.Field — Method
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.AbstractAerodynamics — Type
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.AbstractAtmosphere — Type
abstract type AbstractAtmosphere{NF, PR<:Terrarium.AbstractPrecipitation, IR<:Terrarium.AbstractIncomingRadiation, HM<:Terrarium.AbstractHumidity, WS<:Terrarium.AbstractWind, 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, gas concentrations, wind speed, and near-surface aerodynamics.

source
Terrarium.AbstractClosureRelation — Type
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.AbstractCoupledProcesses — Type
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.AbstractEnergyClosure — Type
abstract type AbstractEnergyClosure <: Terrarium.AbstractClosureRelation

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

source
Terrarium.AbstractHumidity — Type
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.AbstractIMEX — Type
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.AbstractIncomingRadiation — Type
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.AbstractInitializer — Type

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.AbstractModel — Type
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.AbstractPlantAvailableWater — Type
abstract type AbstractPlantAvailableWater{NF} <: Terrarium.AbstractProcess{NF}

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

source
Terrarium.AbstractPrecipitation — Type
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.AbstractProcess — Type
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.AbstractSnow — Type
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.AbstractSoil — Type
abstract type AbstractSoil{NF} <: Terrarium.AbstractCoupledProcesses{NF}

Base type for coupled soil processes.

source
Terrarium.AbstractSoilHorizon — Type
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.AbstractSoilHydraulics — Type
abstract type AbstractSoilHydraulics{NF, RC<:SWRC, UnsatK<:Terrarium.AbstractUnsatK}

Base type for soil hydraulic properties and parameterization schemes.

source
Terrarium.AbstractSoilHydrology — Type
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.AbstractSoilThermodynamics — Type
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.AbstractSoilWaterClosure — Type
abstract type AbstractSoilWaterClosure <: Terrarium.AbstractClosureRelation

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

source
Terrarium.AbstractThermodynamics — Type
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.AbstractVegetation — Type
abstract type AbstractVegetation{NF} <: Terrarium.AbstractCoupledProcesses{NF}

Base type for coupled vegetation (carbon) processes.

source
Terrarium.AbstractWind — Type
abstract type AbstractWind

Base type for representations of wind input fields. The target input variable is windspeed but subtypes may define different input formulations (e.g. u/v component velocities).

source
Terrarium.AuxiliaryVariable — Type
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.BareGroundEvaporation — Type
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.ColumnGrid — Type
struct ColumnGrid{NF, Arch, RectGrid<:Oceananigans.Grids.RectilinearGrid} <: Terrarium.AbstractColumnGrid{NF, Arch}

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.ColumnRingGrid — Type
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.ConstantAerodynamics — Type
struct ConstantAerodynamics{NF} <: Terrarium.AbstractAerodynamics{NF}

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

source
Terrarium.ConstantAlbedo — Type
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.ConstantSaturation — Type
struct ConstantSaturation{NF} <: Terrarium.AbstractInitializer{NF}

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

Properties:

  • sat::Any
source
Terrarium.ConstantSnowAlbedo — Type
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.ConstantSnowDensity — Type
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.ConstantSnowHydraulics — Type
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.ConstantSoilCarbonDensity — Type
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.ConstantSoilHorizon — Type
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.ConstantSoilHydraulics — Type
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_saturation::Any: Residual (minimum) saturation level

source
Terrarium.ConstantSoilPorosity — Type
struct ConstantSoilPorosity{NF} <: Terrarium.AbstractSoilPorosity{NF}

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

source
Terrarium.ConstantSoilTemperature — Type
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.DiagnosedRadiativeFluxes — Type
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.DiagnosedTurbulentFluxes — Type
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.DiagnosticAlbedo — Type
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.DirectSurfaceRunoff — Type
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.ERA5LandForcings — Type
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.ERA5LandInvariants — Type
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.ERA5LandLeafAreaIndex — Type
struct ERA5LandLeafAreaIndex{grid} <: 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.ExplicitTwoPhaseHeatConduction — Type
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.ExponentialSpacing — Type
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.FieldBCs — Type

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

source
Terrarium.FieldCapacityLimitedPAW — Type
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.FieldInputSource — Type
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.FieldTimeSeriesInputSource — Type
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}), TT, UT} <: InputSource{NF, name}

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

source
Terrarium.FixedPointSolver — Type
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.FractionalSnowCover — Type
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.Heun — Type
struct Heun{NF} <: Terrarium.AbstractTimeStepper{NF}

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

source
Terrarium.HeunCache — Type
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.IMEX — Type
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.IMEX — Method
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.IMEXCache — Type
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.Implicit — Type
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.ImplicitSkinTemperature — Type
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) - (1 - f_{\text{snow}})\, G(T_s, T_g) - f_{\text{snow}}\, S(T_s, T_{\text{snow}}) = 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 conductive flux from the skin into the snow-free ground ($T_g$ its temperature), $S$ is the conductive flux from the skin into the top of the snowpack over the snow-covered fraction ($T_{\text{snow}}$ its temperature), and $f_{\text{snow}}$ is the snow-covered area fraction ($f_{\text{snow}} = 0$ and $S$ absent without snow). $G$ and $S$ are each computed from their own unblended conduction target (see ground_thermal_interface and snow_thermal_interface).

Properties:

  • κₛ: Assumed thermal conductivity at the surface

  • solver: Numerical solver for the implicit skin temperature

source
Terrarium.InputSource — Type
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.InputSource — Method
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.InputSource — Method
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.InputVariable — Type
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.InverseQuadratic — Type
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.LUEPhotosynthesis — Type
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.LandModel — Type
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

  • 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.LongShortWaveRadiation — Type
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.MaterialConstants — Type
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, 28.9647)

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 in gC/mol

  • molecular_weight_dry_air: Molecular weight of dry air in g/mol

source
Terrarium.MedlynStomatalConductance — Type
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

  • diffusivity_ratio_water_co2::Any: Diffusivity ratio of water to CO₂

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.MineralOrganic — Type
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.MineralOrganic — Method
MineralOrganic(; texture, organic)

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

source
Terrarium.ModelIntegrator — Type
struct ModelIntegrator{NF, Arch<:Oceananigans.Architectures.AbstractArchitecture, Grid<:(Terrarium.AbstractLandGrid{NF}), TimeStepper<:Terrarium.AbstractTimeStepper{NF}, Model<:Terrarium.AbstractModel{NF, Grid<:(Terrarium.AbstractLandGrid{NF})}, 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.Namespace — Type
struct Namespace{name, Vars}

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

source
Terrarium.NewtonSolver — Type
struct NewtonSolver{NF, iterations}

Newton root-finder that always performs a fixed number of iterations, with the iteration count carried in the type so that the iteration is a compile-time constant and the loop unrolls into straight-line code.

Unlike RootSolver and FixedPointSolver there is no convergence test and hence no data-dependent loop bound. That matters in two places:

  • Reactant: a convergence-tested loop lowers to an scf.while with a dynamic trip count, which the StableHLO raise pass cannot lift. An unrolled loop raises cleanly.
  • Reverse-mode AD: a fixed trip count avoids a dynamically-sized tape.

TODO: In the future, Reactant should just use the regular solvers.

source
Terrarium.NoCanopyInterception — Type
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.NoFlow — Type
struct NoFlow <: Terrarium.AbstractVerticalFlow

Represents a hydrology scheme where soil water is immobile.

source
Terrarium.ObjectiveFunction — Type
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.PALADYNAutotrophicRespiration — Type
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.PALADYNCanopyEvapotranspiration — Type
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.PALADYNCanopyInterception — Type
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.PALADYNCarbonDynamics — Type
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.PALADYNPhenology — Type
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.PALADYNVegetationDynamics — Type
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.PhysicalConstants — Type
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.05, 461.52), MaterialConstants{Float64}(1000.0, 916.7, 12.0, 28.9647), 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.PiecewiseLinearInitialSoilTemperature — Type
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.PlantTraits — Type
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.PowerLawSnowThermalConductivity — Type
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.PrescribedAtmosphere — Type
struct PrescribedAtmosphere{NF, tracernames, Precip<:Terrarium.AbstractPrecipitation, IncomingRad<:Terrarium.AbstractIncomingRadiation, Humidity<:Terrarium.AbstractHumidity, Wind<:Terrarium.AbstractWind, Aerodynamics<:Terrarium.AbstractAerodynamics, Gases<:Tuple{Vararg{TracerGas{NF}}}} <: Terrarium.AbstractAtmosphere{NF, Precip<:Terrarium.AbstractPrecipitation, IncomingRad<:Terrarium.AbstractIncomingRadiation, Humidity<:Terrarium.AbstractHumidity, Wind<:Terrarium.AbstractWind, 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.PrescribedPhenology — Type
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.PrescribedRadiativeFluxes — Type
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.PrescribedSkinTemperature — Type
struct PrescribedSkinTemperature{NF} <: Terrarium.AbstractSkinTemperature{NF}

Simple scheme for prescribed skin temperatures from input variables.

Properties:

  • κₛ: Assumed thermal conductivity at the surface
source
Terrarium.PrescribedSoilHorizon — Type
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.PrescribedSpacing — Type
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.PrescribedTurbulentFluxes — Type
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.PrescribedVegetation — Type
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.PrognosticVariable — Type
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.ProgressReporter — Type
struct ProgressReporter{Progress<:ProgressMeter.Progress}

Simple callable struct wrapper around ProgressMeter.Progress intended to be used in an Oceananigans Callback.

simulation.callbacks[:progress] = Callback(ProgressReporter(nsteps), schedule)

The callback can be created directly via ProgressCallback,

simulation.callbacks[:progress] = ProgressCallback(nsteps)
source
Terrarium.QuadraticSnowThermalConductivity — Type
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.QuasiThermalSteadyState — Type
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.RainSnow — Type
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.RichardsEq — Type
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.
  • 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).

Excess water that reaches the soil surface is routed to the surface_excess_water pool defined by AbstractSurfaceRunoff process (see adjust_saturation_profile!), if passed as a dependency. For standalone soil hydrology with no surface runoff, surface excess water is discarded.

See also SoilSaturationPressureClosure and AbstractSoilHydraulics for details regarding the closure relating saturation and pressure head.

source
Terrarium.RootSolver — Type
struct RootSolver{NF, M, S, Tolerance<:RootSolvers.AbstractTolerance{NF}}

Wrapper for RootSolvers.jl root-finding methods.

source
Terrarium.SaturationWaterTable — Type
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.SingleLayerSnow — Type
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.SnowEnergyTemperatureClosure — Type
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.SnowModel — Type
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.SoilComposition — Type
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.SoilComposition — Method
SoilComposition(; porosity, saturation, liquid, solid)

Validating keyword constructor for SoilVolume; enforces that porosity, saturation, and liquid lie in the unit interval.

source
Terrarium.SoilEnergyTemperatureClosure — Type
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.SoilEnergyWaterCarbon — Type
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.SoilHeatCapacities — Type
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.SoilHydraulicsSURFEX — Type
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

  • field_capacity_min::Any: Minimum field capacity at 0% clay content

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

References

  • [4] Noilhan & Mahfouf, Global and Planetary Change (1996)
source
Terrarium.SoilHydrology — Type
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.SoilInitializer — Type
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.SoilModel — Type
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.SoilMoistureResistanceFactor — Type
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.SoilPorositySURFEX — Type
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.SoilSaturationPressureClosure — Type
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.SoilStratigraphy — Type
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.SoilThermalConductivities — Type
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.SoilThermalProperties — Type
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.SoilThermodynamics — Type
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.SpecificHumidity — Type
struct SpecificHumidity <: Terrarium.AbstractHumidity

Humidity parameterization in which the near-surface specific humidity [kg/kg] is provided directly as an input field.

source
Terrarium.StateVariables — Type
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.StateVariables — Method
StateVariables(
    process::Terrarium.AbstractProcess{NF},
    grid::Terrarium.AbstractLandGrid{NF};
    ...
) -> StateVariables{NF, _A, _B, _C, _D, _E, ProgFields, TendFields, AuxFields, InputFields, _F, Cache, ClockType} where {NF, _A, _B, _C, _D, _E, ProgFields<:Tuple, TendFields<:Tuple, AuxFields<:Tuple, InputFields<:Tuple, _F, 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, ProgFields, TendFields, AuxFields, InputFields, _F, Cache, ClockType} where {NF, _A, _B, _C, _D, _E, ProgFields<:Tuple, TendFields<:Tuple, AuxFields<:Tuple, InputFields<:Tuple, _F, 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.StateVariables — Method
StateVariables(
    vars::Terrarium.Variables,
    grid::Terrarium.AbstractLandGrid{NF};
    clock,
    timestepper,
    model,
    boundary_conditions,
    initializers,
    fields
) -> StateVariables{NF, _A, _B, _C, _D, _E, ProgFields, TendFields, AuxFields, InputFields, _F, Cache, Clock{Float64, Float64, Float64, Int64, Int64}} where {NF, _A, _B, _C, _D, _E, ProgFields<:Tuple, TendFields<:Tuple, AuxFields<:Tuple, InputFields<:Tuple, _F, 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.StateVariables — Method
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.StaticExponentialRootDistribution — Type
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.SurfaceEnergyBalance — Type
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.SurfaceEnergyModel — Type
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.SurfaceHydrology — Type
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.ThermodynamicConstants — Type
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.05, 461.52)

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.UniformSpacing — Type
struct UniformSpacing{NF} <: Terrarium.AbstractVerticalSpacing{NF}

Uniform vertical discretization with N layers of size Δz.

Properties:

  • Δz::Any

  • N::Int64

source
Terrarium.UniversalConstants — Type
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.UnsatKLinear — Type
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.UnsatKVanGenuchten — Type
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.VarPath — Type
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.Variable — Type
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.Variables — Type
struct Variables

Container for abstract state variable definitions. Automatically collates and merges all variables and namespaces passed into the constructor. Uses OrderedDicts internally to avoid NamedTuple type explosion during initialization (each merge in a foldl creates a new distinct type), converting to NamedTuples only at the final StateVariables construction step.

source
Terrarium.VegetationCarbonCycle — Type
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.VegetationModel — Type
struct VegetationModel{NF, Vegetation<:Terrarium.AbstractVegetation{NF}, Atmosphere<:(Terrarium.AbstractAtmosphere{NF, PR, IR, HM, WS, AD} where {PR<:Terrarium.AbstractPrecipitation, IR<:Terrarium.AbstractIncomingRadiation, HM<:Terrarium.AbstractHumidity, WS<:Terrarium.AbstractWind, 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.WeightedAverage — Type
struct WeightedAverage <: Terrarium.AbstractBulkWeighting

Simple weighted average formula for computing bulk quantities:

\[\bar{x} = \sum_{i=1}^N \theta_i x_i\]

source
Terrarium.WindVelocity — Type
struct WindVelocity <: Terrarium.AbstractWind

Represents a windspeed given as u (east-west) and v (south-north) velocity components.

source
Terrarium.Windspeed — Type
struct Windspeed <: Terrarium.AbstractWind

Represents a windspeed as direct input/forcing variable.

source
Terrarium.XY — Type
XY <: VarDims

Indicator type for variables that should be assigned a 2D (lateral only) field on their associated grid.

source
Terrarium.XYZ — Type
XYZ <: VarDims

Indicator type for variables that should be assigned a 3D field on their associated grid.

source
Terrarium.FieldBC — Type

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.Optional — Type

Alias for Union{Nothing, T} indicating that an argument or field of type T is optional and can be replaced with nothing.

source