GCBM
smalltreegrowthmodule.h
Go to the documentation of this file.
1 #ifndef MOJA_MODULES_CBM_SMALLTREEROWTHMODULE_H_
2 #define MOJA_MODULES_CBM_SMALLTREEGROWTHMODULE_H_
3 
4 #include "moja/modules/cbm/_modules.cbm_exports.h"
6 
15 
16 namespace moja {
17  namespace modules {
18  namespace cbm {
19 
20  class CBM_API SmallTreeGrowthModule : public CBMModuleBase {
21  public:
23  virtual ~SmallTreeGrowthModule() {};
24 
25  void configure(const DynamicObject& config) override;
26  void subscribe(NotificationCenter& notificationCenter) override;
27 
28  flint::ModuleTypes moduleType() override { return flint::ModuleTypes::Model; };
29 
30  void doLocalDomainInit() override;
31  void doTimingInit() override;
32  void doTimingStep() override;
33 
34  void getYieldCurve();
35  private:
36  const flint::IPool* _atmosphere{ nullptr };
37 
38  //softwood small tree growth curve component
39  std::shared_ptr<SmallTreeGrowthCurve> _smallTreeGrowthSW = nullptr;
40  const flint::IPool* _softwoodStem{ nullptr };
41  const flint::IPool* _softwoodOther{ nullptr };
42  const flint::IPool* _softwoodFoliage{ nullptr };
43  const flint::IPool* _softwoodCoarseRoots{ nullptr };
44  const flint::IPool* _softwoodFineRoots{ nullptr };
45  const flint::IPool* _softwoodStemSnag{ nullptr };
46  const flint::IPool* _softwoodBranchSnag{ nullptr };
47 
48  //hardwood small tree growth curve compoment
49  std::shared_ptr<SmallTreeGrowthCurve> _smallTreeGrowthHW{ nullptr };
50  const flint::IPool* _hardwoodStem{ nullptr };
51  const flint::IPool* _hardwoodOther{ nullptr };
52  const flint::IPool* _hardwoodFoliage{ nullptr };
53  const flint::IPool* _hardwoodCoarseRoots{ nullptr };
54  const flint::IPool* _hardwoodFineRoots{ nullptr };
55  const flint::IPool* _hardwoodStemSnag{ nullptr };
56  const flint::IPool* _hardwoodBranchSnag{ nullptr };
57 
58  const flint::IPool* _woodyFoliageDead{ nullptr };
59  const flint::IPool* _woodyFineDead{ nullptr };
60  const flint::IPool* _woodyRootsDead{ nullptr };
61 
62  flint::IVariable* _turnoverRates{ nullptr };
63  flint::IVariable* _spuId{ nullptr };
64  flint::IVariable* _smalltreeAge{ nullptr };
65  flint::IVariable* _regenDelay{ nullptr };
66  flint::IVariable* _spinupMossOnly{ nullptr };
67  flint::IVariable* _isForest{ nullptr };
68  flint::IVariable* _isDecaying{ nullptr };
69  flint::IVariable* _outputRemoval{ nullptr };
70  flint::IVariable* _ecoBoundary{ nullptr };
71  flint::IVariable* _blackSpruceGCID{ nullptr };
72  flint::IVariable* _smallTreeGCParameters{ nullptr };
73  flint::IVariable* _appliedGrowthCurveID{ nullptr };
74 
75  void getIncrements();
76  void doHalfGrowth() const;
77  void doPeatlandTurnover() const;
78  void updateBiomassPools();
79  void doMidSeasonGrowth() const;
80  bool shouldRun();
81 
82  bool _shouldRun{ false };
83  int _peatlandId{ -1 };
84 
85  // record of the biomass carbon growth increment
86  double sws{ 0 }; // stem wood
87  double swo{ 0 };
88  double swf{ 0 };
89  double hws{ 0 }; // stem wood
90  double hwo{ 0 };
91  double hwf{ 0 };
92  double swcr{ 0 };
93  double swfr{ 0 };
94  double hwcr{ 0 };
95  double hwfr{ 0 };
96 
97  // record of the current biomass and snag pool value
98  double standSoftwoodStem{ 0 };
99  double standSoftwoodOther{ 0 };
100  double standSoftwoodFoliage{ 0 };
101  double standSWCoarseRootsCarbon{ 0 };
102  double standSWFineRootsCarbon{ 0 };
103  double standHardwoodStem{ 0 };
104  double standHardwoodOther{ 0 };
105  double standHardwoodFoliage{ 0 };
106  double standHWCoarseRootsCarbon{ 0 };
107  double standHWFineRootsCarbon{ 0 };
108  double standSoftwoodStemSnag{ 0 };
109  double standSoftwoodBranchSnag{ 0 };
110  double standHardwoodStemSnag{ 0 };
111  double standHardwoodBranchSnag{ 0 };
112 
113  // biomass and snag turnover rate/parameters
114  std::unordered_map<std::tuple<Int64, Int64>, std::shared_ptr<TurnoverRates>> _cachedTurnoverRates;
115  std::shared_ptr<TurnoverRates> _currentTurnoverRates;
116 
117  void getTurnoverRates(int smalltreeGCID, int spuID);
118  void updateParameters();
119 
120  void printRemovals(int standSmallTreeAge,
121  double smallTreeFoliageRemoval,
122  double smallTreeStemSnagRemoval,
123  double smallTreeBranchSnagRemoval,
124  double smallTreeOtherRemovalToWFD,
125  double smallTreeCoarseRootRemoval,
126  double smallTreeFineRootRemoval,
127  double smallTreeOtherToBranchSnag,
128  double smallTreeStemRemoval);
129  };
130 }}}
131 #endif
volumetobiomasscarbongrowth.h
foresttypeconfiguration.h
moja::modules::cbm
Definition: ageclasshelper.cpp:12
moja::modules::cbm::SmallTreeGrowthModule::_cachedTurnoverRates
std::unordered_map< std::tuple< Int64, Int64 >, std::shared_ptr< TurnoverRates > > _cachedTurnoverRates
Definition: smalltreegrowthmodule.h:114
moja::modules::cbm::SmallTreeGrowthModule::SmallTreeGrowthModule
SmallTreeGrowthModule()
Definition: smalltreegrowthmodule.h:22
moja::modules::cbm::SmallTreeGrowthModule
Definition: smalltreegrowthmodule.h:20
moja::modules::cbm::CBMModuleBase
Definition: cbmmodulebase.h:22
peatlands.h
moja::modules::cbm::SmallTreeGrowthModule::_currentTurnoverRates
std::shared_ptr< TurnoverRates > _currentTurnoverRates
Definition: smalltreegrowthmodule.h:115
moja::modules::cbm::SmallTreeGrowthModule::~SmallTreeGrowthModule
virtual ~SmallTreeGrowthModule()
Definition: smalltreegrowthmodule.h:23
moja::modules::cbm::SmallTreeGrowthModule::moduleType
flint::ModuleTypes moduleType() override
Definition: smalltreegrowthmodule.h:28
smalltreegrowthcurve.h
standgrowthcurvefactory.h
standgrowthcurve.h
moja
Definition: ageclasshelper.cpp:10
cbmmodulebase.h
rootbiomassequation.h
turnoverrates.h