GCBM
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SmallTreeGrowthModule Class Reference

#include <smalltreegrowthmodule.h>

Inheritance diagram for SmallTreeGrowthModule:
Inheritance graph
Collaboration diagram for SmallTreeGrowthModule:
Collaboration graph

Public Member Functions

 SmallTreeGrowthModule ()
 
virtual ~SmallTreeGrowthModule ()
 
void configure (const DynamicObject &config) override
 
void subscribe (NotificationCenter &notificationCenter) 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
 

Constructor & Destructor Documentation

◆ SmallTreeGrowthModule()

◆ ~SmallTreeGrowthModule()

virtual ~SmallTreeGrowthModule ( )
virtual

Member Function Documentation

◆ configure()

void configure ( const DynamicObject &  config)
override

Configuration function

Parameters
configDynamicObject&
Returns
void

◆ doHalfGrowth()

void doHalfGrowth ( ) const
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

Returns
void

◆ doLocalDomainInit()

void doLocalDomainInit ( )
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

Returns
void

Reimplemented from CBMModuleBase.

◆ doMidSeasonGrowth()

void doMidSeasonGrowth ( ) const
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()

Returns
void

◆ doPeatlandTurnover()

void doPeatlandTurnover ( ) const
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

Returns
void

◆ doTimingInit()

void doTimingInit ( )
overridevirtual

Reimplemented from CBMModuleBase.

◆ doTimingStep()

void doTimingStep ( )
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

Returns
void

Reimplemented from CBMModuleBase.

◆ getIncrements()

void getIncrements ( )
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

Returns
void

◆ getTurnoverRates()

void getTurnoverRates ( int  smalltreeGCID,
int  spuID 
)
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

Parameters
smalltreeGCIDint
spuIDint
Returns
void

◆ getYieldCurve()

void getYieldCurve ( )

Assign SmallTreeGrowthModule._smallTreeGrowthHW as nullptr, SmallTreeGrowthModule._smallTreeGrowthSW a shared pointer of SmallTreeGrowthCurve to get the yield curve

Parameters
notificationNotification&
Returns
void

◆ moduleType()

flint::ModuleTypes moduleType ( )
override

◆ printRemovals()

void printRemovals ( int  standSmallTreeAge,
double  smallTreeFoliageRemoval,
double  smallTreeStemSnagRemoval,
double  smallTreeBranchSnagRemoval,
double  smallTreeOtherRemovalToWFD,
double  smallTreeCoarseRootRemoval,
double  smallTreeFineRootRemoval,
double  smallTreeOtherToBranchSnag,
double  smallTreeStemRemoval 
)
private

Log the values of the parameters

Parameters
standSmallTreeAgeint
smallTreeFoliageRemovaldouble
smallTreeStemSnagRemovaldouble
smallTreeBranchSnagRemovaldouble
smallTreeOtherRemovalToWFDdouble
smallTreeCoarseRootRemovaldouble
smallTreeFineRootRemovaldouble
smallTreeOtherToBranchSnagdouble
smallTreeStemRemovaldouble
Returns
void

◆ shouldRun()

bool shouldRun ( )
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

Returns
bool

◆ subscribe()

void subscribe ( NotificationCenter &  notificationCenter)
override

Subscribe to signals LocalDomainInit, TimingInit and TimingStep

Parameters
notificationCenterNotificationCenter&
Returns
void

◆ updateBiomassPools()

void updateBiomassPools ( )
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

Returns
void

◆ updateParameters()

void updateParameters ( )
private

Member Data Documentation

◆ _appliedGrowthCurveID

flint::IVariable* _appliedGrowthCurveID { nullptr }
private

◆ _atmosphere

const flint::IPool* _atmosphere { nullptr }
private

◆ _blackSpruceGCID

flint::IVariable* _blackSpruceGCID { nullptr }
private

◆ _cachedTurnoverRates

std::unordered_map<std::tuple<Int64, Int64>, std::shared_ptr<TurnoverRates> > _cachedTurnoverRates
private

◆ _currentTurnoverRates

std::shared_ptr<TurnoverRates> _currentTurnoverRates
private

◆ _ecoBoundary

flint::IVariable* _ecoBoundary { nullptr }
private

◆ _hardwoodBranchSnag

const flint::IPool* _hardwoodBranchSnag { nullptr }
private

◆ _hardwoodCoarseRoots

const flint::IPool* _hardwoodCoarseRoots { nullptr }
private

◆ _hardwoodFineRoots

const flint::IPool* _hardwoodFineRoots { nullptr }
private

◆ _hardwoodFoliage

const flint::IPool* _hardwoodFoliage { nullptr }
private

◆ _hardwoodOther

const flint::IPool* _hardwoodOther { nullptr }
private

◆ _hardwoodStem

const flint::IPool* _hardwoodStem { nullptr }
private

◆ _hardwoodStemSnag

const flint::IPool* _hardwoodStemSnag { nullptr }
private

◆ _isDecaying

flint::IVariable* _isDecaying { nullptr }
private

◆ _isForest

flint::IVariable* _isForest { nullptr }
private

◆ _outputRemoval

flint::IVariable* _outputRemoval { nullptr }
private

◆ _peatlandId

int _peatlandId { -1 }
private

◆ _regenDelay

flint::IVariable* _regenDelay { nullptr }
private

◆ _shouldRun

bool _shouldRun { false }
private

◆ _smalltreeAge

flint::IVariable* _smalltreeAge { nullptr }
private

◆ _smallTreeGCParameters

flint::IVariable* _smallTreeGCParameters { nullptr }
private

◆ _smallTreeGrowthHW

std::shared_ptr<SmallTreeGrowthCurve> _smallTreeGrowthHW { nullptr }
private

◆ _smallTreeGrowthSW

std::shared_ptr<SmallTreeGrowthCurve> _smallTreeGrowthSW = nullptr
private

◆ _softwoodBranchSnag

const flint::IPool* _softwoodBranchSnag { nullptr }
private

◆ _softwoodCoarseRoots

const flint::IPool* _softwoodCoarseRoots { nullptr }
private

◆ _softwoodFineRoots

const flint::IPool* _softwoodFineRoots { nullptr }
private

◆ _softwoodFoliage

const flint::IPool* _softwoodFoliage { nullptr }
private

◆ _softwoodOther

const flint::IPool* _softwoodOther { nullptr }
private

◆ _softwoodStem

const flint::IPool* _softwoodStem { nullptr }
private

◆ _softwoodStemSnag

const flint::IPool* _softwoodStemSnag { nullptr }
private

◆ _spinupMossOnly

flint::IVariable* _spinupMossOnly { nullptr }
private

◆ _spuId

flint::IVariable* _spuId { nullptr }
private

◆ _turnoverRates

flint::IVariable* _turnoverRates { nullptr }
private

◆ _woodyFineDead

const flint::IPool* _woodyFineDead { nullptr }
private

◆ _woodyFoliageDead

const flint::IPool* _woodyFoliageDead { nullptr }
private

◆ _woodyRootsDead

const flint::IPool* _woodyRootsDead { nullptr }
private

◆ hwcr

double hwcr { 0 }
private

◆ hwf

double hwf { 0 }
private

◆ hwfr

double hwfr { 0 }
private

◆ hwo

double hwo { 0 }
private

◆ hws

double hws { 0 }
private

◆ standHardwoodBranchSnag

double standHardwoodBranchSnag { 0 }
private

◆ standHardwoodFoliage

double standHardwoodFoliage { 0 }
private

◆ standHardwoodOther

double standHardwoodOther { 0 }
private

◆ standHardwoodStem

double standHardwoodStem { 0 }
private

◆ standHardwoodStemSnag

double standHardwoodStemSnag { 0 }
private

◆ standHWCoarseRootsCarbon

double standHWCoarseRootsCarbon { 0 }
private

◆ standHWFineRootsCarbon

double standHWFineRootsCarbon { 0 }
private

◆ standSoftwoodBranchSnag

double standSoftwoodBranchSnag { 0 }
private

◆ standSoftwoodFoliage

double standSoftwoodFoliage { 0 }
private

◆ standSoftwoodOther

double standSoftwoodOther { 0 }
private

◆ standSoftwoodStem

double standSoftwoodStem { 0 }
private

◆ standSoftwoodStemSnag

double standSoftwoodStemSnag { 0 }
private

◆ standSWCoarseRootsCarbon

double standSWCoarseRootsCarbon { 0 }
private

◆ standSWFineRootsCarbon

double standSWFineRootsCarbon { 0 }
private

◆ swcr

double swcr { 0 }
private

◆ swf

double swf { 0 }
private

◆ swfr

double swfr { 0 }
private

◆ swo

double swo { 0 }
private

◆ sws

double sws { 0 }
private

The documentation for this class was generated from the following files: