Leaf Composition & Environments
LeafModel assembles concrete photosynthesis, stomatal, and oxygen components behind abstract process interfaces, using explicit no-op types (NoStomatalDynamics, NoOxygenExchange) when optional budgets are omitted. Scalar leaf-site (LeafEnvironment) and boundary-air (GasExchangeEnvironment) containers carry forcing in explicit SI/molar units (K, Pa, μmol m⁻² leaf s⁻¹, mol m⁻² leaf s⁻¹) across Float32, Float64, GPU broadcasts, and ForwardDiff.Dual tangents.
Walkthroughs: Design decisions, Core gas exchange.
Leaf Assembly & Prescribed-CO₂ Evaluation
LeafPhotosynthesis.AbstractLeafScalar Type
AbstractLeafScalarSupertype of every component, parameter, input and result struct of LeafPhotosynthesis.
Its subtypes are immutable values that broadcast as scalars, so photosynthesize.(leaf, environments) needs no Ref(leaf). A new struct gets this by subtyping AbstractLeafScalar or one of the package's abstract component types.
LeafPhotosynthesis.LeafModel Type
LeafModel(; photosynthesis, stomata=NoStomatalDynamics(), oxygen=NoOxygenExchange())
LeafModel(photosynthesis, stomata, oxygen)Compose concrete photosynthesis (AbstractPhotosynthesis), stomata (AbstractStomatalModel), and oxygen (AbstractOxygenExchange) components into an immutable leaf model.
Explicit no-op defaults (NoStomatalDynamics(), NoOxygenExchange()) disable optional processes without introducing hidden scientific parameter values. Components of different binary precisions are a MethodError.
LeafPhotosynthesis.photosynthesize Function
photosynthesize(photosynthesis, environment, excitation=BroadbandExcitation())
photosynthesize(leaf, environment, excitation=BroadbandExcitation())Evaluate leaf photosynthetic carbon assimilation and available electron supply for environment using BroadbandExcitation() by default or an explicit AbstractExcitation.
Return the carbon fluxes of carbon_assimilation followed by electron_transport [μmol e⁻ m⁻² leaf s⁻¹], the available linear electron supply (use biochemical_turnover for realized linear_electron_flow); CytochromePhotosynthesis appends psi_electron_supply, psii_open_fraction and psi_to_psii_ratio. Inputs outside the physical domain (non-finite or negative light, CO₂ or O₂, non-positive temperature, invalid excitation or model domain) give NaN in every field.
LeafPhotosynthesis.is_valid Function
is_valid(result) -> BoolReturn true if result, returned by an entry point, describes a valid evaluation.
Every entry point reports invalid input without throwing, through its result:
a NamedTuple result (
photosynthesize,biochemical_turnover,oxygen_exchange,gas_exchange,assimilation_sensitivity,transpiration_sensitivity,leaf_tendencies) is valid when none of its numbers isNaN(input outside the domain givesNaNin every field; nested results andnothingparts are checked the same way);an
EquilibriumSolutionis valid for the statusesEquilibriumConvergedandEquilibriumStomataClosed;a fluorescence result of
fluorescence(RateCompetitionResult,CytochromeFluorescenceResult) is valid forFluorescenceLitandFluorescenceDark(whose yields areNaNby definition);a
PAMFluorescenceResultis valid forFluorescenceLitonly.
Scalar Forcing Environments
LeafPhotosynthesis.LeafEnvironment Type
LeafEnvironment{FT}(; temperature, absorbed_par, biochemical_co2, oxygen)
LeafEnvironment(temperature, absorbed_par, biochemical_co2, oxygen)Represent prescribed leaf temperature [K], absorbed_par [μmol photons m⁻² leaf s⁻¹], and the biochemical-site CO₂ (biochemical_co2, Cc) and oxygen partial pressures [Pa]. After a gas-exchange solve, build it with the result's biochemical_co2, never with the ambient CO₂ of a GasExchangeEnvironment.
LeafPhotosynthesis.GasExchangeEnvironment Type
GasExchangeEnvironment{FT}(; temperature, absorbed_par, ambient_co2, oxygen, pressure,
relative_humidity, vpd)
GasExchangeEnvironment(temperature, absorbed_par, ambient_co2, oxygen, pressure,
relative_humidity, vpd)Represent prescribed leaf temperature [K], absorbed_par [μmol photons m⁻² leaf s⁻¹], the ambient CO₂ partial pressure outside the boundary layer (ambient_co2, Ca [Pa]), biochemical-site oxygen [Pa], total pressure [Pa], and leaf-surface relative_humidity (∈ [0, 1]) and vpd [Pa]. Only the stomatal target reads the humidity, each law its own driver (Ball–Berry relative_humidity, Medlyn vpd); the other may be NaN.