1#ifndef PARTITIONING_COEFFICIENT_LOGISTIC_H
2#define PARTITIONING_COEFFICIENT_LOGISTIC_H
4#include "../framework/module.h"
5#include "../framework/state_map.h"
10double strength_term(
double const alpha,
double const beta,
double const DVI);
70 state_map
const& input_quantities,
71 state_map* output_quantities)
75 alphaLeaf{get_input(input_quantities,
"alphaLeaf")},
76 alphaRhizome{get_input(input_quantities,
"alphaRhizome")},
77 alphaRoot{get_input(input_quantities,
"alphaRoot")},
78 alphaShell{get_input(input_quantities,
"alphaShell")},
79 alphaStem{get_input(input_quantities,
"alphaStem")},
80 betaLeaf{get_input(input_quantities,
"betaLeaf")},
81 betaRhizome{get_input(input_quantities,
"betaRhizome")},
82 betaRoot{get_input(input_quantities,
"betaRoot")},
83 betaShell{get_input(input_quantities,
"betaShell")},
84 betaStem{get_input(input_quantities,
"betaStem")},
85 DVI{get_input(input_quantities,
"DVI")},
86 kRhizome_emr{get_input(input_quantities,
"kRhizome_emr")},
87 kRhizome_emr_DVI{get_input(input_quantities,
"kRhizome_emr_DVI")},
90 kGrain_op{get_op(output_quantities,
"kGrain")},
91 kLeaf_op{get_op(output_quantities,
"kLeaf")},
92 kRhizome_op{get_op(output_quantities,
"kRhizome")},
93 kRoot_op{get_op(output_quantities,
"kRoot")},
94 kShell_op{get_op(output_quantities,
"kShell")},
95 kStem_op{get_op(output_quantities,
"kStem")}
100 static std::string
get_name() {
return "partitioning_coefficient_logistic"; }
104 const double& alphaLeaf;
105 const double& alphaRhizome;
106 const double& alphaRoot;
107 const double& alphaShell;
108 const double& alphaStem;
109 const double& betaLeaf;
110 const double& betaRhizome;
111 const double& betaRoot;
112 const double& betaShell;
113 const double& betaStem;
115 const double& kRhizome_emr;
116 const double& kRhizome_emr_DVI;
127 void do_operation() const override final;
161void partitioning_coefficient_logistic::do_operation()
const
165 if (kRhizome_emr > 0.0) {
166 throw std::range_error(
"Thrown in partitioning_coefficient_logistic: kRhizome_emr is positive.");
173 double const leaf_strength{
strength_term(alphaLeaf, betaLeaf, DVI)};
174 double const root_strength{
strength_term(alphaRoot, betaRoot, DVI)};
175 double const shell_strength{
strength_term(alphaShell, betaShell, DVI)};
176 double const stem_strength{
strength_term(alphaStem, betaStem, DVI)};
177 double constexpr grain_strength{1};
183 double const rhizome_strength{DVI < kRhizome_emr_DVI
188 double const total_strength =
189 leaf_strength + rhizome_strength + root_strength + shell_strength +
190 stem_strength + grain_strength;
193 double const kGrain{grain_strength / total_strength};
194 double const kLeaf{leaf_strength / total_strength};
195 double const kRoot{root_strength / total_strength};
196 double const kShell{shell_strength / total_strength};
197 double const kStem{stem_strength / total_strength};
202 double const kRhizome{DVI < kRhizome_emr_DVI
204 : rhizome_strength / total_strength};
207 update(kGrain_op, kGrain);
208 update(kLeaf_op, kLeaf);
209 update(kRhizome_op, kRhizome);
210 update(kRoot_op, kRoot);
211 update(kShell_op, kShell);
212 update(kStem_op, kStem);
215double strength_term(
double const alpha,
double const beta,
double const DVI)
217 return exp(alpha + beta * DVI);
Calculates carbon partitioning coefficients based on logistic-based functions and development index u...
partitioning_coefficient_logistic(state_map const &input_quantities, state_map *output_quantities)
static string_vector get_outputs()
static string_vector get_inputs()
static std::string get_name()
This is the standard BioCro module library; it includes the essential modules used in typical BioCro ...
double strength_term(double const alpha, double const beta, double const DVI)