GCBM
|
#include <smalltreegrowthmodule.h>
Public Member Functions | |
SmallTreeGrowthModule () | |
virtual | ~SmallTreeGrowthModule () |
void | configure (const DynamicObject &config) override |
void | subscribe (NotificationCenter ¬ificationCenter) override |
flint::ModuleTypes | moduleType () override |
void | doLocalDomainInit () override |
void | doTimingInit () override |
void | doTimingStep () override |
void | getYieldCurve () |
Public Member Functions inherited from CBMModuleBase | |
virtual | ~CBMModuleBase ()=default |
void | onSystemInit () override |
void | onSystemShutdown () override |
void | onLocalDomainInit () override |
void | onLocalDomainShutdown () override |
void | onLocalDomainProcessingUnitInit () override |
void | onLocalDomainProcessingUnitShutdown () override |
void | onPreTimingSequence () override |
void | onTimingInit () override |
void | onTimingPrePostInit () override |
void | onTimingPostInit () override |
void | onTimingPostInit2 () override |
void | onTimingShutdown () override |
void | onTimingStep () override |
void | onTimingPreEndStep () override |
void | onTimingEndStep () override |
void | onTimingPostStep () override |
void | onOutputStep () override |
void | onPrePostDisturbanceEvent () override |
void | onPostDisturbanceEvent () override |
void | onPostDisturbanceEvent2 () override |
void | onError (std::string msg) override |
void | onDisturbanceEvent (DynamicVar e) override |
void | onPostNotification (short preMessageSignal) override |
virtual void | doSystemInit () |
virtual void | doSystemShutdown () |
virtual void | doLocalDomainShutdown () |
virtual void | doLocalDomainProcessingUnitInit () |
virtual void | doLocalDomainProcessingUnitShutdown () |
virtual void | doPreTimingSequence () |
virtual void | doTimingPrePostInit () |
virtual void | doTimingPostInit () |
virtual void | doTimingPostInit2 () |
virtual void | doTimingShutdown () |
virtual void | doTimingPreEndStep () |
virtual void | doTimingEndStep () |
virtual void | doTimingPostStep () |
virtual void | doOutputStep () |
virtual void | doError (std::string msg) |
virtual void | doDisturbanceEvent (DynamicVar) |
virtual void | doPrePostDisturbanceEvent () |
virtual void | doPostDisturbanceEvent () |
virtual void | doPostDisturbanceEvent2 () |
virtual void | doPostNotification (short preMessageSignal) |
Private Member Functions | |
void | getIncrements () |
void | doHalfGrowth () const |
void | doPeatlandTurnover () const |
void | updateBiomassPools () |
void | doMidSeasonGrowth () const |
bool | shouldRun () |
void | getTurnoverRates (int smalltreeGCID, int spuID) |
void | updateParameters () |
void | printRemovals (int standSmallTreeAge, double smallTreeFoliageRemoval, double smallTreeStemSnagRemoval, double smallTreeBranchSnagRemoval, double smallTreeOtherRemovalToWFD, double smallTreeCoarseRootRemoval, double smallTreeFineRootRemoval, double smallTreeOtherToBranchSnag, double smallTreeStemRemoval) |
Private Attributes | |
const flint::IPool * | _atmosphere { nullptr } |
std::shared_ptr< SmallTreeGrowthCurve > | _smallTreeGrowthSW = nullptr |
const flint::IPool * | _softwoodStem { nullptr } |
const flint::IPool * | _softwoodOther { nullptr } |
const flint::IPool * | _softwoodFoliage { nullptr } |
const flint::IPool * | _softwoodCoarseRoots { nullptr } |
const flint::IPool * | _softwoodFineRoots { nullptr } |
const flint::IPool * | _softwoodStemSnag { nullptr } |
const flint::IPool * | _softwoodBranchSnag { nullptr } |
std::shared_ptr< SmallTreeGrowthCurve > | _smallTreeGrowthHW { nullptr } |
const flint::IPool * | _hardwoodStem { nullptr } |
const flint::IPool * | _hardwoodOther { nullptr } |
const flint::IPool * | _hardwoodFoliage { nullptr } |
const flint::IPool * | _hardwoodCoarseRoots { nullptr } |
const flint::IPool * | _hardwoodFineRoots { nullptr } |
const flint::IPool * | _hardwoodStemSnag { nullptr } |
const flint::IPool * | _hardwoodBranchSnag { nullptr } |
const flint::IPool * | _woodyFoliageDead { nullptr } |
const flint::IPool * | _woodyFineDead { nullptr } |
const flint::IPool * | _woodyRootsDead { nullptr } |
flint::IVariable * | _turnoverRates { nullptr } |
flint::IVariable * | _spuId { nullptr } |
flint::IVariable * | _smalltreeAge { nullptr } |
flint::IVariable * | _regenDelay { nullptr } |
flint::IVariable * | _spinupMossOnly { nullptr } |
flint::IVariable * | _isForest { nullptr } |
flint::IVariable * | _isDecaying { nullptr } |
flint::IVariable * | _outputRemoval { nullptr } |
flint::IVariable * | _ecoBoundary { nullptr } |
flint::IVariable * | _blackSpruceGCID { nullptr } |
flint::IVariable * | _smallTreeGCParameters { nullptr } |
flint::IVariable * | _appliedGrowthCurveID { nullptr } |
bool | _shouldRun { false } |
int | _peatlandId { -1 } |
double | sws { 0 } |
double | swo { 0 } |
double | swf { 0 } |
double | hws { 0 } |
double | hwo { 0 } |
double | hwf { 0 } |
double | swcr { 0 } |
double | swfr { 0 } |
double | hwcr { 0 } |
double | hwfr { 0 } |
double | standSoftwoodStem { 0 } |
double | standSoftwoodOther { 0 } |
double | standSoftwoodFoliage { 0 } |
double | standSWCoarseRootsCarbon { 0 } |
double | standSWFineRootsCarbon { 0 } |
double | standHardwoodStem { 0 } |
double | standHardwoodOther { 0 } |
double | standHardwoodFoliage { 0 } |
double | standHWCoarseRootsCarbon { 0 } |
double | standHWFineRootsCarbon { 0 } |
double | standSoftwoodStemSnag { 0 } |
double | standSoftwoodBranchSnag { 0 } |
double | standHardwoodStemSnag { 0 } |
double | standHardwoodBranchSnag { 0 } |
std::unordered_map< std::tuple< Int64, Int64 >, std::shared_ptr< TurnoverRates > > | _cachedTurnoverRates |
std::shared_ptr< TurnoverRates > | _currentTurnoverRates |
|
virtual |
|
override |
Configuration function
config | DynamicObject& |
|
private |
Add transfers between pools based on the sum of SmallTreeGrowthModule.sws, SmallTreeGrowthModule.swo, SmallTreeGrowthModule.swf, SmallTreeGrowthModule.swcr, SmallTreeGrowthModule.swfr and their individual values
If SmallTreeGrowthModule._smallTreeGrowthHW is not nullptr, based on the sum of SmallTreeGrowthModule.hws, SmallTreeGrowthModule.hwo, SmallTreeGrowthModule.hwf, SmallTreeGrowthModule.hwcr, SmallTreeGrowthModule.hwfr and the individual values add transfers
Submit and Apply the transfers on _landUnitData
|
overridevirtual |
Invoke SmallTreeGrowthModule.getYieldCurve(), there is only one softwood small tree growth curve
Set the values of pools "Atmosphere", "SoftwoodStemSnag", "SoftwoodBranchSnag", "SoftwoodStem", "SoftwoodFoilage", "SoftwoodOther", "SoftwoodCoarseRoots", "SoftwoodFineRoots", "HardwoodStemSnag", "HardwoodBranchSnag", "HardwoodStem", "HardwoodFoilage", "HardwoodOther", "HardwoodCoarseRoots", "HardwoodFineRoots", "WoodyFoilageDead", "WoodyFineDead", "WoodyRootsDead" from _landUnutData to SmallTreeGrowthModule._atmosphere, SmallTreeGrowthModule._softwoodStemSnag, SmallTreeGrowthModule._softwoodBranchSnag, SmallTreeGrowthModule._softwoodStem, SmallTreeGrowthModule._softwoodFoilage, SmallTreeGrowthModule._softwoodOther, SmallTreeGrowthModule._softwoodCoarseRoots, SmallTreeGrowthModule._softwoodFineRoots, SmallTreeGrowthModule._hardwoodStemSnag, SmallTreeGrowthModule._hardwoodBranchSnag, SmallTreeGrowthModule._hardwoodStem, SmallTreeGrowthModule._hardwoodFoilage, SmallTreeGrowthModule._hardwoodOther, SmallTreeGrowthModule._hardwoodCoarseRoots, SmallTreeGrowthModule._hardwoodFineRoots, SmallTreeGrowthModule._woodyFoilageDead, SmallTreeGrowthModule._woodyFineDead
Set values of variables "peatland_smalltree_age", "regen_delay", "spinup_moss_only", "is_forest", "is_decaying", "spatial_unit_id", "eco_boudary", "smalltree_growth_parameters", "growth_curve_id" to SmallTreeGrowthModule._peatlandSmallTreeAge, SmallTreeGrowthModule._regenDelay, SmallTreeGrowthModule._spinupMossOnly, SmallTreeGrowthModule._isForest, SmallTreeGrowthModule._isDecaying, SmallTreeGrowthModule._spatialUnitId, SmallTreeGrowthModule._ecoBoundary, SmallTreeGrowthModule._smallTreeGrowthParameters, SmallTreeGrowthModule._growthCurveId
If _smallTreeGrowthHW is not nullptr, set the values of pools "HardwoodStemSnag", "HardwoodBranchSnag", "HardwoodStem", "HardwoodFoilage", "HardwoodOther", "HardwoodCoarseRoots", "HardwoodFineRoots" from _landUnutData to SmallTreeGrowthModule._hardwoodStemSnag, SmallTreeGrowthModule._hardwoodBranchSnag, SmallTreeGrowthModule._hardwoodStem, SmallTreeGrowthModule._hardwoodFoilage, SmallTreeGrowthModule._hardwoodOther, SmallTreeGrowthModule._hardwoodCoarseRoots, SmallTreeGrowthModule._hardwoodFineRoots
If variable "output_removal" exists in _landUnitData, set it to SmallTreeGrowthModule._outputRemoval, else set SmallTreeGrowthModule._outputRemoval to nullptr
Reimplemented from CBMModuleBase.
|
private |
Add transfers from the atmospheric pools to softwood and hardwood pools
Record carbon transfers that occur from the atmosphere to softwood and hardwoord pools during mid-season Invoke createStockOperation() on _landUnitData
Add transfers from the atmosphere pool to softwood and hardwood merchantable, foilage, coarse root and fine root pools. Submit the operation to the _landUnitData by invoking submitOperation()
|
private |
Perform snag and biomass turnovers as stock operations
Invoke createStockOperation() on _landUnitData.
Add transfers between softwood snag and branch pools to woody coarse and fine dead pools. If _smallTreeGrowthHW is not null, add transfers between hardwood snag and branch pools to woody coarse and fine dead pools.
Invoke submitStockOperation() on _landUnitData to submit the transfers
Invoke createStockOperation() on _landUnitData . Add transfers between softwood stem, foilage, other, coarse and fine roots to woody coarse, fine foilage and dead pools, softwood snag pools. If _smallTreeGrowthHW is not null, add transfers between hardwood stem, foilage, other, coarse and fine roots to woody coarse, fine foilage and dead pools, hardwood snag pools.
Invoke submitStockOperation() on _landUnitData to submit the transfers and applyOperations() on _landUnitData to apply the transfers
|
overridevirtual |
Reimplemented from CBMModuleBase.
|
overridevirtual |
If SmallTreeGrowthModule._shouldRun is false or SmallTreeGrowthModule._spinupMossOnly is true or value of SmallTreeGrowthModule._regenDelay > 0 , return
Invoke SmallTreeGrowthModule.updateBiomassPools() to get the current values of the biomass pools, SmallTreeGrowthModule.getIncrements() to get and store the biomass carbon growth increments, SmallTreeGrowthModule.doHalfGrowth() to transfer half of the biomass growth increment to the biomass pool, SmallTreeGrowthModule.updateBiomassPools() to update to record the current biomass pool value plus the half increment of biomass, and SmallTreeGrowthModule.doMidSeasonGrowth() where the the foliage and snags that grow and are turned over
Debug to print out the removal from live biomass components through SmallTreeGrowthModule.printRemovals()
Invoke SmallTreeGrowthModule.doPeatlandTurnover() to do biomass and snag turnover, small tree is in treed peatland only,
SmallTreeGrowthModule.doHalfGrowth() to transfer the remaining half increment to the biomass pool
Set the value of SmallTreeGrowthModule._smalltreeAge to the increment of the current value of SmallTreeGrowthModule._smalltreeAge by 1
Reimplemented from CBMModuleBase.
|
private |
If the result of VolumeToBiomassCarbonGrowth.getBiomassCarbonIncrements() on SmallTreeGrowthModule._volumeToBioGrowth, indicating there are increments for the particular _standGrowthCurveID and _standSPUID, assign SmallTreeGrowthModule.swm, SmallTreeGrowthModule.swo, SmallTreeGrowthModule.swf, SmallTreeGrowthModule.swcr, SmallTreeGrowthModule.swfr the Softwood increments, SmallTreeGrowthModule.hwm, SmallTreeGrowthModule.hwo, SmallTreeGrowthModule.hwf, SmallTreeGrowthModule.hwcr, SmallTreeGrowthModule.hwfr Hardwood increments
If SmallTreeGrowthModule._growthMultipliersEnabled is not enabled return
else, check if "Softwood" is found in _growthMultipliers and multiply SmallTreeGrowthModule.swm, SmallTreeGrowthModule.swo, SmallTreeGrowthModule.swf, SmallTreeGrowthModule.swcr, SmallTreeGrowthModule.swfr by the softwood multiplication factor, check if "Hardwood" is found in SmallTreeGrowthModule._growthMultipliers and multiply SmallTreeGrowthModule.hwm, SmallTreeGrowthModule.hwo, SmallTreeGrowthModule.hwf, SmallTreeGrowthModule.hwcr, SmallTreeGrowthModule.hwfr by the hardwood multiplication factor
|
private |
Set the value of the current turnover rate
Set SmallTreeGrowthModule._currentTurnoverRates to the value of the tuple key (smalltreeGCID, spuID) in SmallTreeGrowthModule._cachedTurnoverRates if it exists
Else set SmallTreeGrowthModule._currentTurnoverRates to a shared pointer of TurnoverRates, with the value of SmallTreeGrowthModule._turnoverRates, value of variable "turnover_rates" in _landUnitData
Set the value of the tuple key (smalltreeGCID, spuID) to SmallTreeGrowthModule._currentTurnoverRates
smalltreeGCID | int |
spuID | int |
void getYieldCurve | ( | ) |
Assign SmallTreeGrowthModule._smallTreeGrowthHW as nullptr, SmallTreeGrowthModule._smallTreeGrowthSW a shared pointer of SmallTreeGrowthCurve to get the yield curve
notification | Notification& |
|
override |
|
private |
Log the values of the parameters
standSmallTreeAge | int |
smallTreeFoliageRemoval | double |
smallTreeStemSnagRemoval | double |
smallTreeBranchSnagRemoval | double |
smallTreeOtherRemovalToWFD | double |
smallTreeCoarseRootRemoval | double |
smallTreeFineRootRemoval | double |
smallTreeOtherToBranchSnag | double |
smallTreeStemRemoval | double |
|
private |
Determine if the SmallTreeGrowthModule should run
Always set SmallTreeGrowthModule._shouldRun to false, if value of SmallTreeGrowthModule._spuId is empty, return false
If _landUnitData has variable "enable_peatland", and the value of "peatland_class" in _landUnitData is either Peatlands::TREED_PEATLAND_BOG, Peatlands::TREED_PEATLAND_POORFEN, Peatlands::TREED_PEATLAND_RICHFEN or Peatlands::TREED_PEATLAND_SWAMP, indicating it is a treed-peatland, set SmallTreeGrowthModule._shouldRun to true and return SmallTreeGrowthModule._shouldRun
|
override |
Subscribe to signals LocalDomainInit, TimingInit and TimingStep
notificationCenter | NotificationCenter& |
|
private |
Update the pool variables with the latest values
Set values of SmallTreeGrowthModule._softwoodStem, SmallTreeGrowthModule._softwoodOther, SmallTreeGrowthModule._softwoodFoilage, SmallTreeGrowthModule._softwoodCoarseRoots, SmallTreeGrowthModule._softwoodFineRoots, to SmallTreeGrowthModule.standSoftwoodStem, SmallTreeGrowthModule.standSoftwoodOther, SmallTreeGrowthModule.standSoftwoodFoliage, SmallTreeGrowthModule.standSoftwoodCoarseRoots, SmallTreeGrowthModule.standSoftwoodFineRoots
If _smallTreeGrowthHW is not nullptr, set values of SmallTreeGrowthModule._hardwoodStem, SmallTreeGrowthModule._hardwoodOther, SmallTreeGrowthModule._hardwoodFoilage, SmallTreeGrowthModule._hardwoodCoarseRoots, SmallTreeGrowthModule._hardwoodFineRoots to SmallTreeGrowthModule.standHardwoodStem, SmallTreeGrowthModule.standHardwoodOther, SmallTreeGrowthModule.standHardwoodFoliage, SmallTreeGrowthModule.standHardwoodCoarseRoots, SmallTreeGrowthModule.standHardwoodFineRoots
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |