API
About
PlantHydraulics.jl provides numerical hydraulic models that can be used to simulate the flow and pressure profiles in plants. In the model, hydraulic system is a combination of hydraulic organs, which are Root, Stem, and Leaf. And as a result, the functions to simulate flow and pressure profiles can be used at organ level and system level. For example, for the simplest case, one can simulate the pressure profile within a xylem segment; and for the most complex case, one can simulate the flow and pressure profiles in a tree with multiple roots, trunk, multiple canopy layers (a stem and a leaf per layer).
Although PlantHydraulics.jl is meant to server as a fundamental dependency package of the CliMA Land, it can also be used as a standalone package and thus to use with other vegetation modeling other than CliMA Land. Below, we will show some examples of how to use PlantHydraulics.jl at organ and plant level.
Organ Level Simulations
Root, Stem, and Leaf organs differ in the following:
- Root has a rhizosphere component before the xylem
- Leaf has an extraxylary component after the xylem
- Stem and Root have a height change to account for gravity
- Stem and Root capacitance is along the flow path
- Leaf capacitance is at the end of the flow path (along with extraxylary component)
For example in a Leaf, to simulate the flow and pressure profiles, what you need to do are
using ClimaCache
using PlantHydraulics
FT = Float64;
leaf = ClimaCache.Leaf{FT}();
stem = ClimaCache.Stem{FT}();
root = ClimaCache.Root{FT}();
soil = ClimaCache.SoilLayer{FT}();
PlantHydraulics.xylem_flow_profile!(leaf, FT(1));
PlantHydraulics.xylem_flow_profile!(stem, FT(1));
PlantHydraulics.xylem_flow_profile!(root, FT(1));
PlantHydraulics.xylem_pressure_profile!(leaf);
PlantHydraulics.xylem_pressure_profile!(stem);
PlantHydraulics.xylem_pressure_profile!(root, soil);Note the second parameter FT(1) is the time step in second to use with non-steady state mode. If the flow mode is steady state, FT(1) will not be used; otherwise, water source/sink term will be applied based on the state of the capacitance tissue. As there is a rhizosphere component in the Root, which uses soil moisture retension curve to compute soil water potential, we need to pass soil information to the xylem_pressure_profile! function when updating soil pressure profile.
Plant Level Simulation
While one can always customize the hydraulic system using functions xylem_flow_profile! and xylem_pressure_profile!, we provide shortcut functions to soil-plant-air continuum where soil layers, plant, and air layers are aligned. For example, a spac of a tree (MonoMLTreeSPAC).
spac = ClimaCache.MonoMLTreeSPAC{FT}();
PlantHydraulics.xylem_flow_profile!(spac, FT(1));
PlantHydraulics.xylem_pressure_profile!(spac);Similarly, one can use MonoMLGrassSPAC, MonoMLPalmSPAC, and MonoElementSPAC (Mono means mono species spac, ML means multiple root and canopy layers, Grass with no trunk and branch, Palm with no branch, and Element means the spac consists of one soil layer, root, stem, and leaf element each). Currently, the predefined SPAC only supports the four listed above. If you need more customized SPACs, you will need to combine the fundamental functions xylem_flow_profile! and xylem_pressure_profile! appropriately. Be carefuly to not forget to synchronize the flow rates with stomtal conductance (this is done automactically for predefined SPACs).
Vulnerability curve
SoilHydraulics.relative_hydraulic_conductance — Methodrelative_hydraulic_conductance(vc::ComplexVC{FT}, p_25::FT) where {FT<:AbstractFloat}
relative_hydraulic_conductance(vc::LogisticVC{FT}, p_25::FT) where {FT<:AbstractFloat}Return the hydraulic conductance ralative to maximum at reference temperature, given
vcComplexVC,LogisticVC,PowerVC, orWeibullVCtype vulnerability curvep_25Equivalent xylem water pressure at 298.15 K in[MPa](surface tension correction made)
PlantHydraulics.critical_pressure — Functioncritical_pressure(vc::ComplexVC{FT}, kr::FT = FT(0.001)) where {FT<:AbstractFloat}
critical_pressure(vc::LogisticVC{FT}, kr::FT = FT(0.001)) where {FT<:AbstractFloat}
critical_pressure(vc::PowerVC{FT}, kr::FT = FT(0.001)) where {FT<:AbstractFloat}
critical_pressure(vc::WeibullVC{FT}, kr::FT = FT(0.001)) where {FT<:AbstractFloat}Return the critical xylem water pressure at 25 °C that triggers a given amount of loss of conductance, given
vcComplexVC,LogisticVC,PowerVC, orWeibullVCtype structkrReference conductance, default is 0.001
Pressure volume curve
PlantHydraulics.xylem_pressure — Functionxylem_pressure(pv::LinearPVCurve{FT}, rvol::FT, T::FT) where {FT<:AbstractFloat}
xylem_pressure(pv::SegmentedPVCurve{FT}, rvol::FT, T::FT) where {FT<:AbstractFloat}Return the xylem water pressure in MPa, given
pvLinearPVCurveorSegmentedPVCurvetype pressure volume curvervolRelative volume (relative to maximum)TTemperature
PlantHydraulics.capacitance_buffer — Functioncapacitance_buffer(pvc::LinearPVCurve{FT}) where {FT<:AbstractFloat}
capacitance_buffer(pvc::SegmentedPVCurve{FT}) where {FT<:AbstractFloat}Return the relative capacictance buffer rate, given
pvLinearPVCurveorSegmentedPVCurvetype pressure volume curve
Cavitation legacy
PlantHydraulics.clear_legacy! — Functionclear_legacy!(spac::MonoElementSPAC{FT}) where {FT<:AbstractFloat}
clear_legacy!(spac::MonoMLGrassSPAC{FT}) where {FT<:AbstractFloat}
clear_legacy!(spac::MonoMLPalmSPAC{FT}) where {FT<:AbstractFloat}
clear_legacy!(spac::MonoMLTreeSPAC{FT}) where {FT<:AbstractFloat}
clear_legacy!(organ::Union{Leaf{FT}, Leaves2D{FT}, Root{FT}, Stem{FT}}) where {FT<:AbstractFloat}
clear_legacy!(organ::Leaves1D{FT}) where {FT<:AbstractFloat}Clear the legacy for hydraulic organ or system, given
spacMonoElementSPAC,MonoMLGrassSPAC,MonoMLPalmSPAC, orMonoMLTreeSPACtype structureorganLeaf,Leaves1D,Leaves2D,Root, orStemtype structure
FLow profile
PlantHydraulics.flow_in — Functionflow_in(organ::Union{Leaf{FT}, Leaves2D{FT}, Root{FT}, Stem{FT}}) where {FT<:AbstractFloat}
flow_in(organ::Leaves1D{FT}) where {FT<:AbstractFloat}
flow_in(organs::Vector{Leaves2D{FT}}) where {FT<:AbstractFloat}
flow_in(organs::Vector{Stem{FT}}) where {FT<:AbstractFloat}Return the flow rate, given
organLeaf,Leaves1D,Leaves2D,Root, orStemtype structorgansVector ofLeaves2DorStemtype struct
PlantHydraulics.flow_out — Functionflow_out(lf::Union{Leaf{FT}, Leaves2D{FT}}) where {FT<:AbstractFloat}Return the net flow that escape from the leaf, given
lfLeaf,Leaves2D,Root, orStemtype organ
PlantHydraulics.root_pk — Functionroot_pk(root::Root{FT}) where {FT<:AbstractFloat}Return the root end pressure and total hydraulic conductance to find solution of flow rates in all roots, given
rootRoottype struct
PlantHydraulics.xylem_flow_profile! — FunctionThis function is designed to serve the following functionalities:
- Update flow profile in different organs
- Partition root flow rates at different layers
- Update flow profile for entire SPAC
PlantHydraulics.xylem_flow_profile! — Methodxylem_flow_profile!(organ::Union{Leaf{FT}, Leaves2D{FT}, Root{FT}, Stem{FT}}, Δt::FT) where {FT<:AbstractFloat}
xylem_flow_profile!(organ::Leaves1D{FT}, Δt::FT) where {FT<:AbstractFloat}Update organ flow rate profile after setting up the flow rate out, given
organLeaf,Leaves1D,Leaves2D,Root, orStemtype structΔtTime step length
PlantHydraulics.xylem_flow_profile! — Methodxylem_flow_profile!(spac::MonoElementSPAC{FT}, Δt::FT) where {FT<:AbstractFloat}
xylem_flow_profile!(spac::MonoMLGrassSPAC{FT}, Δt::FT) where {FT<:AbstractFloat}
xylem_flow_profile!(spac::MonoMLPalmSPAC{FT}, Δt::FT) where {FT<:AbstractFloat}
xylem_flow_profile!(spac::MonoMLTreeSPAC{FT}, Δt::FT) where {FT<:AbstractFloat}Update flow profiles for the soil-plant-air continuum (set up leaf flow rate from stomatal conductance first), given
spacMonoElementSPAC,MonoMLGrassSPAC,MonoMLPalmSPAC, orMonoMLTreeSPACtype SPAC systemΔtTime step length
Pressure profile
PlantHydraulics.xylem_end_pressure — Functionxylem_end_pressure(organ::Union{Leaf{FT}, Stem{FT}}, flow::FT) where {FT<:AbstractFloat}
xylem_end_pressure(organ::Root{FT}, slayer::SoilLayer{FT}, flow::FT) where {FT<:AbstractFloat}
xylem_end_pressure(spac::MonoElementSPAC{FT}, flow::FT) where {FT<:AbstractFloat}Return the xylem end water pressure in MPa, given
organLeaf,Root, orStemtype structslayerSoil layer corresponded to rootflowFlow rate (per leaf area for Leaf)[mol (m⁻²) s⁻¹]spacMonoElementSPACtype struct
PlantHydraulics.xylem_pressure_profile! — FunctionThis function is designed for the following purposes:
- Update organ pressure profile
- Update pressure profile for the entire SPAC
PlantHydraulics.xylem_pressure_profile! — Methodxylem_pressure_profile!(spac::MonoElementSPAC{FT}; update::Bool = true) where {FT<:AbstractFloat}
xylem_pressure_profile!(spac::MonoMLGrassSPAC{FT}; update::Bool = true) where {FT<:AbstractFloat}
xylem_pressure_profile!(spac::MonoMLPalmSPAC{FT}; update::Bool = true) where {FT<:AbstractFloat}
xylem_pressure_profile!(spac::MonoMLTreeSPAC{FT}; update::Bool = true) where {FT<:AbstractFloat}Update xylem pressure profile (flow profile needs to be updated a priori), given
spacMonoElementSPAC,MonoMLGrassSPAC,MonoMLPalmSPAC, orMonoMLTreeSPACtype spacupdateIf true, update xylem cavitation legacy
PlantHydraulics.∂E∂P — Function∂E∂P(lf::Union{Leaf{FT}, Leaves2D{FT}}, flow::FT; δe::FT = FT(1e-7)) where {FT<:AbstractFloat}
∂E∂P(lf::Leaves1D{FT}, flow::FT, ind::Int; δe::FT = FT(1e-7)) where {FT<:AbstractFloat}Return the marginal hydraulic conductance, given
lfLeaf,Leaves1D, orLeaves2Dtype structflowFlow rate through the leaf xylem[mol m⁻² s⁻¹]δeIncremental flow rate, default is 1e-7indWhich leaf inLeaves1D(1 for sunlit and 2 for shaded)
Critical flow
PlantHydraulics.critical_flow — FunctionThis function returns the critical flow rate that triggers a given amount of loss of hydraulic conductance for
- Leaf hydraulic system
- Mono element SPAC system
PlantHydraulics.critical_flow — Methodcritical_flow(hs::LeafHydraulics{FT}, T::FT, ini::FT = FT(0.5); kr::FT = FT(0.001)) where {FT<:AbstractFloat}Return the critical flow rate that triggers a given amount of loss of conductance, given
hsLeafHydraulicstype structTLiquid temperatureiniInitial guesskrReference conductance, default is 0.001
PlantHydraulics.critical_flow — Methodcritical_flow(spac::MonoElementSPAC{FT}, ini::FT = FT(0.5); kr::FT = FT(0.001)) where {FT<:AbstractFloat}Return the critical flow rate that triggers a given amount of loss of conductance, given
spacMonoElementSPACtype structiniInitial guesskrReference conductance, default is 0.001
Tuning factor
PlantHydraulics.β_factor — Functionβ_factor(f::Function, vc::AbstractXylemVC{FT}, x_25::FT) where {FT<:AbstractFloat}
β_factor(f::Function, vc::AbstractSoilVC{FT}, x_25::FT) where {FT<:AbstractFloat}
β_factor(f::Function, x_25::FT) where {FT<:AbstractFloat}Return the β factor based on relative conductance or soil potential/pressure, given
fFunction to translate relative k to β, for example f(x) = x, f(x) = x², and f(x) = sqrt(x) for x in [0,1]vcLeaf vulnerability curve or soil vulnerability curve (moisture retention curve)x_25Leaf xylem pressure corrected to 25 °C, soil water potential corrected to 25 °C (forcing on roots, note that this function may not be useful for plants with salt stress), or soil water content
PlantHydraulics.β_factor! — FunctionThis function updates the beta factor for SPAC if empirical models are used. The method is meant to support all SPAC defined in ClimaCache.jl:
MonoElementSPACMonoMLGrassSPACMonoMLPalmSPACMonoMLTreeSPAC
PlantHydraulics.β_factor! — Methodβ_factor!(spac::MonoElementSPAC{FT}) where {FT<:AbstractFloat}Update the beta factor for the LEAF component in SPAC, given
spacMonoElementSPACtype SPAC
PlantHydraulics.β_factor! — Methodβ_factor!(spac::Union{MonoMLGrassSPAC{FT}, MonoMLPalmSPAC{FT}, MonoMLTreeSPAC{FT}}) where {FT<:AbstractFloat}Update the β factor for the LEAVES component in SPAC, given
spacMonoMLGrassSPAC,MonoMLPalmSPAC, orMonoMLTreeSPACtype SPAC
Note that if the β function is based on Kleaf or Pleaf, β factor is taken as that of leaf; if the β function is based on Ksoil, Psoil, or Θ, β is taken as the average weighted by flow rate in each root.
Energy budget
PlantHydraulics.plant_energy! — FunctionThis function has two major functionalities:
- Compute marginal energy increase in each organ
- Update the temperature in each organ when time step provided
PlantHydraulics.plant_energy! — Methodplant_energy!(spac::MonoMLGrassSPAC{FT}) where {FT<:AbstractFloat}
plant_energy!(spac::MonoMLPalmSPAC{FT}) where {FT<:AbstractFloat}
plant_energy!(spac::MonoMLTreeSPAC{FT}) where {FT<:AbstractFloat}Compute the marginal energy increase in spac, given
spacMonoMLGrassSPAC,MonoMLPalmSPAC, orMonoMLTreeSPACtype SPAC
PlantHydraulics.plant_energy! — Methodplant_energy!(spac::MonoMLGrassSPAC{FT}, δt::FT) where {FT<:AbstractFloat}
plant_energy!(spac::MonoMLPalmSPAC{FT}, δt::FT) where {FT<:AbstractFloat}
plant_energy!(spac::MonoMLTreeSPAC{FT}, δt::FT) where {FT<:AbstractFloat}Compute the marginal energy increase in spac, given
spacMonoMLGrassSPAC,MonoMLPalmSPAC, orMonoMLTreeSPACtype SPACδtTime step