4#include "../framework/constants.h"
10#include "../math/roots/onedim/dekker.h"
13using physical_constants::dr_boundary;
14using physical_constants::dr_stomata;
27 double const absorbed_ppfd,
29 double const Tambient,
31 double const Vcmax_at_25,
32 double const Jmax_at_25,
33 double const TPU_rate_max,
34 double const RL_at_25,
42 double const electrons_per_carboxylation,
43 double const electrons_per_oxygenation,
44 double const beta_PSII,
49 double const inf = std::numeric_limits<double>::infinity();
52 if (absorbed_ppfd < 0) {
53 throw std::out_of_range(
"Input `absorbed_ppfd` cannot be negative. Check `solar` is not negative.");
59 double const dark_adapted_phi_PSII = c3_param.
phi_PSII;
60 double const Gstar = c3_param.
Gstar;
61 double const Jmax = Jmax_at_25 * c3_param.
Jmax_norm;
62 double const Kc = c3_param.
Kc;
63 double const Ko = c3_param.
Ko;
64 double const RL = RL_at_25 * c3_param.
RL_norm;
65 double const theta = c3_param.
theta;
66 double const TPU = TPU_rate_max * c3_param.
Tp_norm;
67 double const Vcmax = Vcmax_at_25 * c3_param.
Vcmax_norm;
79 double I2 = absorbed_ppfd * dark_adapted_phi_PSII * beta_PSII;
82 (Jmax + I2 - sqrt(pow(Jmax + I2, 2) - 4.0 * theta * I2 * Jmax)) /
85 double const Oi = O2 *
solo(Tleaf);
89 double const alpha_TPU = 0.0;
92 double const b0_adj = StomWS * b0 + Gs_min * (1.0 - StomWS);
93 double const b1_adj = StomWS * b1;
104 auto check_assim_rate = [=, &FvCB_res, &BB_res, &Gs, &Assim](
double Ci) {
107 Ci, Gstar, J, Kc, Ko, Oi, RL, TPU, Vcmax, alpha_TPU,
108 electrons_per_carboxylation,
109 electrons_per_oxygenation);
135 return Assim - Gt * (Ca - Ci);
143 0.0, Gstar, J, Kc, Ko, Oi, RL, TPU, Vcmax, alpha_TPU,
144 electrons_per_carboxylation,
145 electrons_per_oxygenation)
148 double const Ci_max =
149 Ca - A_min * (dr_boundary / gbw + dr_stomata / b0_adj);
152 using namespace root_finding;
153 dekker solve{500, 1e-12, 1e-12};
154 result_t result = solve(
161 if (!is_successful(result.flag)) {
162 throw std::runtime_error(
163 "Ci solver reports failed convergence with termination flag:\n " +
164 flag_message(result.flag));
168 double const Ci = result.root;
181 FvCB_res.
Vc * Gstar / Ci,
196 return (0.047 - 0.0013087 * LeafT + 2.5603e-05 * pow(LeafT, 2) - 2.1441e-07 * pow(LeafT, 3)) / 0.026934;
FvCB_outputs FvCB_assim(double Ci, double Gstar, double J, double Kc, double Ko, double Oi, double RL, double TPU, double Vcmax, double alpha_TPU, double electrons_per_carboxylation, double electrons_per_oxygenation)
Computes the net CO2 assimilation rate (and other values) using the Farquhar-von-Caemmerer-Berry mode...
stomata_outputs ball_berry_gs(double assimilation, double ambient_c, double ambient_rh, double bb_offset, double bb_slope, double gbw, double leaf_temperature, double ambient_air_temperature)
Calculates steady-state stomatal conductance to water vapor using the Ball-Berry model.
c3_param_at_tleaf c3_temperature_response(c3_temperature_response_parameters param, double Tleaf)
Calculates the values of key C3 photosynthesis parameters at leaf temperature.
double solo(double LeafT)
photosynthesis_outputs c3photoC(c3_temperature_response_parameters const tr_param, double const absorbed_ppfd, double const Tleaf, double const Tambient, double const RH, double const Vcmax_at_25, double const Jmax_at_25, double const TPU_rate_max, double const RL_at_25, double const b0, double const b1, double const Gs_min, double const Ca, double const AP, double const O2, double const StomWS, double const electrons_per_carboxylation, double const electrons_per_oxygenation, double const beta_PSII, double const gbw)
double sequential_conductance(double const conductance_1, double const conductance_2)
Calculates the total conductance across two sequential gas paths.
double conductance_limited_assim(double Ca, double gbw, double gsw)
Computes the conductance-limited net CO2 assimilation rate.
A simple structure for holding the output of FvCB calculations.
double An
Net CO2 assimilation rate (micromol / m^2 / s)
double Vc
RuBP carboxylation rate (micromol / m^2 / s)
double Tp_norm
Tp normalized to its value at 25 degrees C (dimensionless)
double Ko
Michaelis-Menten constant for Rubisco oxygenation (mmol / mol)
double phi_PSII
Dark-adapted operating efficiency of photosystem II (dimensionless)
double Kc
Michaelis-Menten constant for Rubisco carboxylation (micromol / mol)
double theta
Linear light response factor (dimensionless)
double RL_norm
RL normalized to its value at 25 degrees C (dimensionless)
double Gstar
CO2 compensation point in the absence of RL (micromol / mol)
double Vcmax_norm
Vcmax normalized to its value at 25 degrees C (dimensionless)
double Jmax_norm
Jmax normalized to its value at 25 degrees C (dimensionless)
A simple structure for holding the output of photosynthesis calculations.
A simple structure for holding the output of stomatal conductance calculations.
double gsw
Stomatal conductance to water vapor (mmol / m^2 / s)
double hs
Relative humidity at the leaf surface (dimensionless)
double cs
CO2 concentration at the leaf surface (micromol / mol)