GCBM
rootbiomassequation.h
Go to the documentation of this file.
1 #ifndef MOJA_MODULES_CBM_ROOTBIOMASSEQUATION_H_
2 #define MOJA_MODULES_CBM_ROOTBIOMASSEQUATION_H_
3 
4 #include "moja/modules/cbm/_modules.cbm_exports.h"
5 
6 #include <cmath>
7 
8 namespace moja {
9 namespace modules {
10 namespace cbm {
11 
12  struct RootProportions {
13  double fine;
14  double coarse;
15  };
16 
17  class CBM_API RootBiomassEquation {
18  public:
19  RootBiomassEquation(double biomassToCarbonRate = 0.5)
20  : _biomassToCarbonRate(biomassToCarbonRate) {}
21 
23  : _biomassToCarbonRate(other._biomassToCarbonRate) {}
24 
25  virtual ~RootBiomassEquation() = default;
26 
27  inline double carbonToBiomass(double carbon) { return carbon / _biomassToCarbonRate; }
28  inline double biomassToCarbon(double biomass) { return biomass * _biomassToCarbonRate; }
29 
30  // Calculate the total root biomass from the total aboveground carbon
31  // for the stand component.
32  virtual double calculateRootBiomass(double componentAbovegroundCarbon) = 0;
33 
34  // Calculate the coarse and fine root proportions from the stand's total
35  // root biomass for all components.
36  virtual RootProportions calculateRootProportions(double standRootBiomass) = 0;
37 
38  protected:
40  };
41 
43  public:
44  SoftwoodRootBiomassEquation(double rootBioA, double frpA, double frpB, double frpC)
46  _rootBioA(rootBioA), _frpA(frpA), _frpB(frpB), _frpC(frpC) {}
47 
48  virtual ~SoftwoodRootBiomassEquation() = default;
49 
50  inline double calculateRootBiomass(double componentAbovegroundCarbon) {
51  // Li et al 2003 softwood root biomass.
52  return _rootBioA * carbonToBiomass(componentAbovegroundCarbon);
53  }
54 
55  inline RootProportions calculateRootProportions(double standRootBiomass) {
56  // Li et al 2003 root proportions.
57  double fineRootProp = _frpA + _frpB * std::exp(_frpC * standRootBiomass);
58  double coarseRootProp = 1 - fineRootProp;
59 
60  return RootProportions{ fineRootProp, coarseRootProp };
61  }
62 
63  private:
64  double _rootBioA;
65  double _frpA;
66  double _frpB;
67  double _frpC;
68  };
69 
71  public:
72  HardwoodRootBiomassEquation(double rootBioA, double rootBioB, double frpA, double frpB, double frpC)
74  _rootBioA(rootBioA), _rootBioB(rootBioB), _frpA(frpA), _frpB(frpB), _frpC(frpC) {}
75 
76  virtual ~HardwoodRootBiomassEquation() = default;
77 
78  inline double calculateRootBiomass(double componentAbovegroundCarbon) {
79  // Li et al 2003 hardwood root biomass.
80  return _rootBioA * std::pow(carbonToBiomass(componentAbovegroundCarbon), _rootBioB);
81  }
82 
83  inline RootProportions calculateRootProportions(double standRootBiomass) {
84  // Li et al 2003 root proportions.
85  double fineRootProp = _frpA + _frpB * std::exp(_frpC * standRootBiomass);
86  double coarseRootProp = 1 - fineRootProp;
87 
88  return RootProportions{ fineRootProp, coarseRootProp };
89  }
90 
91  private:
92  double _rootBioA;
93  double _rootBioB;
94  double _frpA;
95  double _frpB;
96  double _frpC;
97  };
98 
99 }}}
100 #endif
moja::modules::cbm
Definition: ageclasshelper.cpp:12
moja::modules::cbm::SoftwoodRootBiomassEquation::_frpC
double _frpC
Definition: rootbiomassequation.h:67
moja::modules::cbm::SoftwoodRootBiomassEquation::_frpA
double _frpA
Definition: rootbiomassequation.h:65
moja::modules::cbm::RootBiomassEquation::RootBiomassEquation
RootBiomassEquation(double biomassToCarbonRate=0.5)
Definition: rootbiomassequation.h:19
moja::modules::cbm::RootBiomassEquation::RootBiomassEquation
RootBiomassEquation(const RootBiomassEquation &other)
Definition: rootbiomassequation.h:22
moja::modules::cbm::RootProportions::fine
double fine
Definition: rootbiomassequation.h:13
moja::modules::cbm::HardwoodRootBiomassEquation::_frpA
double _frpA
Definition: rootbiomassequation.h:94
moja::modules::cbm::SoftwoodRootBiomassEquation::calculateRootBiomass
double calculateRootBiomass(double componentAbovegroundCarbon)
Definition: rootbiomassequation.h:50
moja::modules::cbm::HardwoodRootBiomassEquation::_rootBioA
double _rootBioA
Definition: rootbiomassequation.h:92
moja::modules::cbm::SoftwoodRootBiomassEquation::calculateRootProportions
RootProportions calculateRootProportions(double standRootBiomass)
Definition: rootbiomassequation.h:55
moja::modules::cbm::RootProportions
Definition: rootbiomassequation.h:12
moja::modules::cbm::RootProportions::coarse
double coarse
Definition: rootbiomassequation.h:14
moja::modules::cbm::RootBiomassEquation::carbonToBiomass
double carbonToBiomass(double carbon)
Definition: rootbiomassequation.h:27
moja::modules::cbm::RootBiomassEquation::_biomassToCarbonRate
double _biomassToCarbonRate
Definition: rootbiomassequation.h:39
moja::modules::cbm::RootBiomassEquation
Definition: rootbiomassequation.h:17
moja::modules::cbm::SoftwoodRootBiomassEquation::_rootBioA
double _rootBioA
Definition: rootbiomassequation.h:64
moja::modules::cbm::HardwoodRootBiomassEquation::_frpB
double _frpB
Definition: rootbiomassequation.h:95
moja::modules::cbm::SoftwoodRootBiomassEquation::_frpB
double _frpB
Definition: rootbiomassequation.h:66
moja::modules::cbm::HardwoodRootBiomassEquation::_frpC
double _frpC
Definition: rootbiomassequation.h:96
moja::modules::cbm::HardwoodRootBiomassEquation::HardwoodRootBiomassEquation
HardwoodRootBiomassEquation(double rootBioA, double rootBioB, double frpA, double frpB, double frpC)
Definition: rootbiomassequation.h:72
moja::modules::cbm::HardwoodRootBiomassEquation::calculateRootBiomass
double calculateRootBiomass(double componentAbovegroundCarbon)
Definition: rootbiomassequation.h:78
moja::modules::cbm::HardwoodRootBiomassEquation::calculateRootProportions
RootProportions calculateRootProportions(double standRootBiomass)
Definition: rootbiomassequation.h:83
moja::modules::cbm::SoftwoodRootBiomassEquation::SoftwoodRootBiomassEquation
SoftwoodRootBiomassEquation(double rootBioA, double frpA, double frpB, double frpC)
Definition: rootbiomassequation.h:44
moja::modules::cbm::HardwoodRootBiomassEquation
Definition: rootbiomassequation.h:70
moja
Definition: ageclasshelper.cpp:10
moja::modules::cbm::RootBiomassEquation::biomassToCarbon
double biomassToCarbon(double biomass)
Definition: rootbiomassequation.h:28
moja::modules::cbm::HardwoodRootBiomassEquation::_rootBioB
double _rootBioB
Definition: rootbiomassequation.h:93
moja::modules::cbm::SoftwoodRootBiomassEquation
Definition: rootbiomassequation.h:42