Photosynthesis

Available photosynthesis implementations include:

Coupled FvCB Example

using PlantBiophysics, PlantSimEngine, PlantMeteo, Dates

meteo = Atmosphere(
    T=25.0,
    Wind=1.0,
    P=101.3,
    Rh=0.5,
    duration=Hour(1),
)

scene = leaf_scene(
    Fvcb(),
    Medlyn(0.03, 12.0);
    status=Status(
        Tₗ=25.0,
        aPPFD=1000.0,
        Cₛ=400.0,
        Dₗ=1.5,
    ),
    environment=meteo,
)

run!(scene)
leaf = only(model_objects(scene; scale=:Leaf))
(A=leaf.status.A, Cᵢ=leaf.status.Cᵢ, Gₛ=leaf.status.Gₛ)
(A = 34.79925186665615, Cᵢ = 364.10236058799467, Gₛ = 0.9694022347056666)

Fvcb declares stomatal conductance as a manual call dependency. The compiled call can be inspected with:

Diagnostics.explain_calls(Advanced.compile_composite_model(scene))
1-element Vector{@NamedTuple{call_plan_slot::Int64, application_slot::Int64, application_id::Symbol, consumer_id::Symbol, call::Symbol, mode::Symbol, origin::Symbol, callee_object_ids::Vector{Symbol}, callee_application_ids::Vector{Symbol}, potential_callee_application_ids::Tuple{Symbol}, process::Symbol, application::Nothing, multiplicity::Symbol, publication_policy::Symbol, default_publish::Bool, accepted_publish::Bool, resolved::Bool, selector::One{@NamedTuple{selectors::Tuple{}, scale::Symbol, process::Symbol}}}}:
 (call_plan_slot = 1, application_slot = 1, application_id = :photosynthesis, consumer_id = :leaf, call = :stomatal_conductance, mode = :manual, origin = :model_default, callee_object_ids = [:leaf], callee_application_ids = [:stomatal_conductance], potential_callee_application_ids = (:stomatal_conductance,), process = :stomatal_conductance, application = nothing, multiplicity = :one, publication_policy = :explicit_accept, default_publish = 0, accepted_publish = 1, resolved = 1, selector = One{@NamedTuple{selectors::Tuple{}, scale::Symbol, process::Symbol}}((selectors = (), scale = :Leaf, process = :stomatal_conductance)))

Raw FvCB Example

raw_scene = leaf_scene(
    FvcbRaw();
    status=Status(Tₗ=25.0, aPPFD=1000.0, Cᵢ=300.0),
    environment=meteo,
)
run!(raw_scene)
only(model_objects(raw_scene; scale=:Leaf)).status.A
32.45005396955518

Photosynthesis models prefer an hourly timestep and accept timesteps from one minute to six hours. Use ModelSpec(...; every=...) on the scenario application when an explicit cadence is required.