1 #ifndef MOJA_MODULES_CBM_YIELDTABLEGROWTHMODULE_H_
2 #define MOJA_MODULES_CBM_YIELDTABLEGROWTHMODULE_H_
4 #include "moja/modules/cbm/_modules.cbm_exports.h"
21 YieldTableGrowthModule(std::shared_ptr<StandGrowthCurveFactory> gcFactory, std::shared_ptr<VolumeToBiomassCarbonGrowth> volumeToBioGrowth)
22 : _gcFactory(gcFactory), _volumeToBioGrowth(volumeToBioGrowth) {};
26 void configure(
const DynamicObject& config)
override;
27 void subscribe(NotificationCenter& notificationCenter)
override;
29 flint::ModuleTypes
moduleType()
override {
return flint::ModuleTypes::Model; };
31 void doLocalDomainInit()
override;
32 void doTimingInit()
override;
33 void doTimingStep()
override;
36 std::shared_ptr<StandGrowthCurve> createStandGrowthCurve(
37 Int64 standGrowthCurveID, Int64 spuID)
const;
40 const flint::IPool* _softwoodMerch =
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;
46 const flint::IPool* _hardwoodMerch =
nullptr;
47 const flint::IPool* _hardwoodOther =
nullptr;
48 const flint::IPool* _hardwoodFoliage =
nullptr;
49 const flint::IPool* _hardwoodCoarseRoots =
nullptr;
50 const flint::IPool* _hardwoodFineRoots =
nullptr;
52 const flint::IPool* _aboveGroundVeryFastSoil =
nullptr;
53 const flint::IPool* _aboveGroundFastSoil =
nullptr;
54 const flint::IPool* _belowGroundVeryFastSoil =
nullptr;
55 const flint::IPool* _belowGroundFastSoil =
nullptr;
56 const flint::IPool* _softwoodStemSnag =
nullptr;
57 const flint::IPool* _softwoodBranchSnag =
nullptr;
58 const flint::IPool* _hardwoodStemSnag =
nullptr;
59 const flint::IPool* _hardwoodBranchSnag =
nullptr;
60 const flint::IPool* _mediumSoil =
nullptr;
61 const flint::IPool* _atmosphere =
nullptr;
63 const flint::IPool* _woodyFoliageDead =
nullptr;
64 const flint::IPool* _woodyFineDead =
nullptr;
65 const flint::IPool* _woodyCoarseDead =
nullptr;
66 const flint::IPool* _woodyRootsDead =
nullptr;
68 flint::IVariable* _age =
nullptr;
69 flint::IVariable* _gcId =
nullptr;
70 flint::IVariable* _spuId =
nullptr;
71 flint::IVariable* _turnoverRates =
nullptr;
72 flint::IVariable* _regenDelay =
nullptr;
73 flint::IVariable* _spinupMossOnly =
nullptr;
74 flint::IVariable* _isForest =
nullptr;
75 flint::IVariable* _isDecaying =
nullptr;
76 flint::IVariable* _growthMultipliers =
nullptr;
77 flint::IVariable* _output_removal =
nullptr;
79 bool _growthMultipliersEnabled =
true;
80 bool _smootherEnabled =
true;
81 bool _debuggingEnabled =
false;
82 std::string _debuggingOutputPath =
".";
84 Int64 _standGrowthCurveID{ -1 };
85 Int64 _standSPUID{ -1 };
87 std::shared_ptr<VolumeToBiomassCarbonGrowth> _volumeToBioGrowth =
nullptr;
88 std::shared_ptr<StandGrowthCurveFactory> _gcFactory =
nullptr;
91 void getTurnoverRates();
93 void doHalfGrowth()
const;
94 void doTurnover()
const;
95 void updateBiomassPools();
96 void doMidSeasonGrowth()
const;
97 bool shouldRun()
const;
99 void switchTurnover()
const;
100 void doPeatlandTurnover()
const;
101 void switchHalfGrowth()
const;
102 void doPeatlandHalfGrowth()
const;
104 bool _skipForPeatland{
false };
105 bool _runForForestedPeatland{
false };
106 int _peatlandId{ -1 };
125 double standSoftwoodMerch = 0;
126 double standSoftwoodOther = 0;
127 double standSoftwoodFoliage = 0;
128 double standSWCoarseRootsCarbon = 0;
129 double standSWFineRootsCarbon = 0;
130 double standHardwoodMerch = 0;
131 double standHardwoodOther = 0;
132 double standHardwoodFoliage = 0;
133 double standHWCoarseRootsCarbon = 0;
134 double standHWFineRootsCarbon = 0;
135 double softwoodStemSnag = 0;
136 double softwoodBranchSnag = 0;
137 double hardwoodStemSnag = 0;
138 double hardwoodBranchSnag = 0;
140 void printRemovals(
int standAge,
141 double standFoliageRemoval,
142 double standStemSnagRemoval,
143 double standBranchSnagRemoval,
144 double standOtherRemovalToWFD,
145 double standCoarseRootsRemoval,
146 double standFineRootsRemoval,
147 double standOtherRemovalToBranchSnag)
const;