25 static void validateOptimalTemperature(
float optimum_temperature_in_C) {
26 if (optimum_temperature_in_C < 0.f) {
27 helios::helios_runtime_error(
"ERROR (PhotosyntheticTemperatureResponseParameters): Optimal temperature cannot be negative. Received Topt = " + std::to_string(optimum_temperature_in_C) +
28 " C. Please check that temperature is provided in units of Celsius, not Kelvin.");
30 if (optimum_temperature_in_C > 100.f) {
31 helios::helios_runtime_error(
"ERROR (PhotosyntheticTemperatureResponseParameters): Optimal temperature cannot exceed 100 C. Received Topt = " + std::to_string(optimum_temperature_in_C) +
32 " C. This value is biologically unrealistic and likely indicates temperature was provided in Kelvin instead of Celsius. Please convert to Celsius (subtract 273.15 from Kelvin value).");
40 static void validateDeactivationEnergy(
float rate_of_increase_dHa,
float rate_of_decrease_dHd) {
41 if (rate_of_increase_dHa <= 0.f) {
44 if (rate_of_decrease_dHd <= rate_of_increase_dHa) {
45 helios::helios_runtime_error(
"ERROR (PhotosyntheticTemperatureResponseParameters): Deactivation energy dHd must be strictly greater than activation energy dHa for a peaked temperature response. Received dHa = " +
46 std::to_string(rate_of_increase_dHa) +
" kJ/mol and dHd = " + std::to_string(rate_of_decrease_dHd) +
47 " kJ/mol. The peaked Arrhenius form evaluates ln(dHd/dHa - 1), which is undefined when dHd <= dHa. Increase dHd (a typical value is 10*dHa, or 200-600 kJ/mol) or omit dHd to use the default.");
53 value_at_25C = 100.0f;
60 this->value_at_25C = value_at_25C;
67 this->value_at_25C = value_at_25C;
68 this->dHa = rate_of_increase_dHa;
69 if (rate_of_increase_dHa > 0.f) {
70 this->dHd = 10.f * rate_of_increase_dHa;
78 validateOptimalTemperature(optimum_temperature_in_C);
79 this->value_at_25C = value_at_25C;
80 this->dHa = rate_of_increase_dHa;
81 if (rate_of_increase_dHa > 0.f) {
82 this->dHd = 10.f * rate_of_increase_dHa;
86 this->Topt = 273.15f + optimum_temperature_in_C;
90 validateOptimalTemperature(optimum_temperature_in_C);
91 validateDeactivationEnergy(rate_of_increase_dHa, rate_of_decrease_dHd);
92 this->value_at_25C = value_at_25C;
93 this->dHa = rate_of_increase_dHa;
94 this->dHd = rate_of_decrease_dHd;
95 this->Topt = 273.15f + optimum_temperature_in_C;
730 static int selfTest(
int argc = 0,
char **argv =
nullptr);
777 void setModelCoefficients(
const std::vector<FarquharModelCoefficients> &modelcoefficients,
const std::vector<uint> &UUIDs);
880 void run(
const std::vector<uint> &lUUIDs);
924 void setCi(
float Ci,
const std::vector<uint> &UUIDs);
933 void setCm(
float Cm,
const std::vector<uint> &UUIDs);
953 std::unordered_map<uint, EmpiricalModelCoefficients> empiricalmodel_coefficients;
954 std::unordered_map<uint, FarquharModelCoefficients> farquharmodel_coefficients;
955 std::unordered_map<uint, C4ModelCoefficients> c4model_coefficients;
958 mutable std::unordered_map<uint, EmpiricalModelCoefficients> material_coefficient_cache_empirical;
959 mutable std::unordered_map<uint, FarquharModelCoefficients> material_coefficient_cache_farquhar;
960 mutable std::unordered_map<uint, C4ModelCoefficients> material_coefficient_cache_c4;
968 std::unordered_map<uint, float> previous_Ci;
971 std::unordered_map<uint, float> manual_Ci;
974 std::unordered_map<uint, float> manual_Cm;
978 float evaluateFarquharModel(
const FarquharModelCoefficients ¶ms,
float i_PAR,
float TL,
float CO2,
float gM,
float &Ci,
float &Gamma,
int &limitation_state,
int &TPU_flag,
float &J_over_Jmax,
helios::WarningAggregator &warnings);
982 float evaluateCi_Empirical(
const EmpiricalModelCoefficients ¶ms,
float Ci,
float CO2,
float fL,
float fT,
float Rd,
float gM)
const;
984 static float evaluateCi_Farquhar(
float Ci, std::vector<float> &variables,
const void *parameters);
986 static float evaluateCi_C4(
float Ci, std::vector<float> &variables,
const void *parameters);
989 static float evaluateCm_C4(
float Cm, std::vector<float> &variables,
const C4ModelCoefficients ¶ms);
999 bool message_flag =
true;
1002 std::vector<std::string> output_prim_data;