Package: phylloptim 0.36.0

Daniel Falster

phylloptim: Leaf Gas Exchange with Explicit Plant Hydraulics

An implementation of leaf-level gas exchange in which stomatal behaviour emerges from hydraulics rather than an empirical conductance model. Farquhar-von Caemmerer-Berry photosynthesis is coupled to an explicit soil-root-stem-leaf water transport path, with Weibull vulnerability curves for both xylem and roots, multi-layer soil and gravitational head, and the operating point is chosen by Sperry-style gain-risk profit maximisation over the root-collar water potential. Forward-mode automatic differentiation supplies exact derivatives of profit with respect to the collar potential. Extracted from the TF24 strategy in the 'plant' package so that it can be tested, profiled, extended and embedded independently. The model itself is a set of self-contained C++ headers, under inst/include, that use no R and no 'Rcpp' and depend only on Boost and the header-only parts of 'odelia': they compile and run with no R present at all, so the model can be linked directly into a C++ program or bound to another language such as Python without going through this package. R users get the same model through an 'RcppR6' layer that sits on top of those headers and is never included by them, and R packages get it by naming 'phylloptim' in their LinkingTo field.

Authors:Isaac Towers [aut], Daniel Falster [aut, cre], Rich FitzJohn [ctb]

phylloptim_0.36.0.tar.gz
phylloptim_0.36.0.zip(r-4.7-x86_64)phylloptim_0.36.0.zip(r-4.7-arm64)phylloptim_0.36.0.zip(r-4.6-x86_64)phylloptim_0.36.0.zip(r-4.6-arm64)phylloptim_0.36.0.zip(r-4.5-x86_64)
phylloptim_0.36.0.tgz(r-4.6-x86_64)phylloptim_0.36.0.tgz(r-4.6-arm64)phylloptim_0.36.0.tgz(r-4.5-x86_64)phylloptim_0.36.0.tgz(r-4.5-arm64)
phylloptim_0.36.0.tar.gz(r-4.7-x86_64)phylloptim_0.36.0.tar.gz(r-4.6-x86_64)
phylloptim_0.36.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
phylloptim/json (API)

# Install 'phylloptim' in R:
install.packages('phylloptim', repos = c('https://traitecoevo.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/traitecoevo/phylloptim/issues

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cpp

5.81 score 3 packages 12 scripts 35 exports 18 dependencies

Last updated from:af31832bb4. Checks:2 FAIL, 9 ERROR, 4 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64FAIL3760
linux-devel-x86_64ERROR926
source / vignettesOK388
linux-release-arm64FAIL3752
linux-release-x86_64ERROR649
macos-release-arm64ERROR157
macos-release-x86_64ERROR314
macos-oldrel-arm64ERROR168
macos-oldrel-x86_64ERROR442
windows-devel-arm64OK611
windows-devel-x86_64ERROR1117
windows-release-arm64OK551
windows-release-x86_64ERROR731
windows-oldrel-x86_64ERROR779
wasm-releaseOK120

Exports:align_curvescost_curve_namescost_curve_parametersgradient_output_namesgradient_par_namesLeafleaf_batchleaf_controlleaf_damage_gradientleaf_damage_trajectoryleaf_gradientleaf_gradient_batchleaf_infeasible_codesleaf_modelleaf_solveleaf_supply_multilayerleaf_supply_singlelayerleaf_traitsmodel_registryoperating_pointplot_model_overviewplot_solver_convergencepsi_at_plcregistry_locationsregistry_resolveregistry_valuesroot_network_from_carbonRootNetworkseries_resistanceset_driversset_traitsweibull_p50_cweibull_p50_from_bweibull_s50with_phylloptim_conditions

Dependencies:BHclidplyrgenericsgluelifecyclemagrittrodeliapillarpkgconfigR6Rcpprlangtibbletidyselectutf8vctrswithr

Differentiating the operating point
One surface, two consumers | Terms | The three calls | The solve path, and the eight kinds | Why the implicit function theorem | Why the kind is recorded, not inferred | Inside the surface | Extending it | What is tested | Deliberately not built

Last update: 2026-11-10
Started: 2026-10-08

Fitting traits to data
Simulated data, so the answer is known | The objective, and the loop that makes it affordable | Using the gradients | Faster or slower depends on which parameter count you mean | What reverses it is more fitted parameters per model parameter | Where the intercept goes | Fitting a different collection of parameters | Cost does not depend on the collection | A stem gradient means something different at a boundary | Not everything is reachable | What a new study actually has to write | Where a gradient-based fit goes wrong | Fitting to real data

Last update: 2026-11-10
Started: 2026-08-05

Leaf gas exchange from R
What this model does differently | What is on this page | One solve | A drought response | The same sweep on a familiar scale | Light and VPD together | Traits and numerical settings are separate | Water potentials are positive magnitudes | Two supply paths, two routes | Multiple soil layers | The stateful interface | Trait gradients, and where they stop working | Choosing which gradients to compute | A collar potential you supply | A faster method: the closed form | When it applies, and when it refuses | What it costs, and what it buys | Accuracy, and one failure that is not a tolerance | The caveat that would stop you using this in a demographic model | What the model assumes | Where to go next

Last update: 2026-11-10
Started: 2026-08-05

The models, and the maths behind them
How to read this page | A leaf choosing where to operate | The problem being solved | The two supply paths | One problem, several coordinates | Solving for the optimum by its first-order condition | The scan, which does not run by default | When the answer is a bound, not a stationary point | The benefit, and the root-find inside it | The cost curves | The benefit link, and the proof it costs nothing | The wet-end price, and the one curve that has one | Pricing the drop is not pricing the potential | λ is the common currency | λ is not water use efficiency | λ is a common currency only across difference objectives | The two gates | Thermal damage | When the leaf cannot transpire | The variants, under one roof | Comparable at their defaults | The biological components | 1. Photosynthetic demand | 2. Temperature responses | 3. Diffusive supply | 4. Closing the loop: supply equals demand | 5. Hydraulic supply, and why the problem is non-trivial | 6. Optionally, energy balance and thermal damage | What the models disagree about | What the model assumes | Glossary | Where to go next | Appendix A — the (P50, c) parameterisation | Why not (P50, b) | Why c is not a constant | Converting from published numbers | psi_crit is a quantile, not a parameter | Three consequences for gradients | Appendix B — gradients | The implicit function theorem | The link makes one derivative serve every model | The envelope theorem, and where it stops | Prescribed versus optimised | A partial is not always a total | The energy-balance term | Appendix C — numerical practice | The maximum is flat, so its location is the delicate quantity | A finite difference through a solve has a noise floor, so sweep the step | A scan's argmax cannot feed a parameter gradient | References

Last update: 2026-11-10
Started: 2026-08-24

Using phylloptim from C++
The two umbrella headers, and why the extension matters | Building | A solve | Trait gradients from C++ | What is fast, and what is not | The golden file is the contract

Last update: 2026-11-10
Started: 2026-08-05

Readme and manuals

Help Manual

Help pageTopics
phylloptim: leaf gas exchange with explicit plant hydraulicsphylloptim-package phylloptim
Align the cost curves' level parameters to a common optimumalign_curves
The cost curves, in the order C++ indexes themcost_curve_names
Each cost curve's parameters, from its definitioncost_curve_parameters
The differentiated outputs, in the order C++ indexes themgradient_output_names
The differentiable parameters, in the order C++ indexes themgradient_par_names
Leaf-level gas exchange with explicit hydraulics.Leaf
The observations a batch gradient is taken overleaf_batch
Numerical settings for a leaf solveleaf_control
Gradient of the leaf's thermal-damage trajectoryleaf_damage_gradient
Integrate the leaf's thermal-damage states over a temperature seriesleaf_damage_trajectory
Trait gradients of a solved operating pointleaf_gradient
Trait gradients over a batch of observationsleaf_gradient_batch
Which failures are reported as infeasibleleaf_infeasible_codes
Build a leafleaf_model
Solve a leaf, in one callleaf_solve
Choose how water reaches the root collarleaf_supply_multilayer leaf_supply_singlelayer
Physiological traits for a leafleaf_traits
The model registrymodel_registry
The solved operating point, as one rowoperating_point
Overview figure: how the parts of the model fit togetherplot_model_overview
Convergence of the two ways to locate an optimumplot_solver_convergence
The water potential at a given loss of conductivitypsi_at_plc
Where every symbol is, from Doxygen's XMLregistry_locations
Resolve the registry's symbols against Doxygen's XMLregistry_resolve
The parameters' values, read at render timeregistry_values
Root resistances from a root carbon profileroot_network_from_carbon
Root resistance networkRootNetwork
A single soil-to-collar series resistance, as a supply driverseries_resistance
Set the drivers for a leafset_drivers
Replace the traits on an existing leafset_traits
Recover (P50, c) from any two published quantitiesweibull_p50_c
Convert a Weibull scale parameter to P50weibull_p50_from_b
The slope of the vulnerability curve at P50weibull_s50
Run leaf code with classified error conditionswith_phylloptim_conditions