GCBM
|
#include <yieldtablegrowthmodule.h>
Public Member Functions | |
YieldTableGrowthModule (std::shared_ptr< StandGrowthCurveFactory > gcFactory, std::shared_ptr< VolumeToBiomassCarbonGrowth > volumeToBioGrowth) | |
virtual | ~YieldTableGrowthModule () |
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 () |
std::shared_ptr< StandGrowthCurve > | createStandGrowthCurve (Int64 standGrowthCurveID, Int64 spuID) const |
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 | getTurnoverRates () |
void | initPeatland () |
void | doHalfGrowth () const |
void | doTurnover () const |
void | updateBiomassPools () |
void | doMidSeasonGrowth () const |
bool | shouldRun () const |
void | switchTurnover () const |
void | doPeatlandTurnover () const |
void | switchHalfGrowth () const |
void | doPeatlandHalfGrowth () const |
void | printRemovals (int standAge, double standFoliageRemoval, double standStemSnagRemoval, double standBranchSnagRemoval, double standOtherRemovalToWFD, double standCoarseRootsRemoval, double standFineRootsRemoval, double standOtherRemovalToBranchSnag) const |
Private Attributes | |
const flint::IPool * | _softwoodMerch = nullptr |
const flint::IPool * | _softwoodOther = nullptr |
const flint::IPool * | _softwoodFoliage = nullptr |
const flint::IPool * | _softwoodCoarseRoots = nullptr |
const flint::IPool * | _softwoodFineRoots = nullptr |
const flint::IPool * | _hardwoodMerch = nullptr |
const flint::IPool * | _hardwoodOther = nullptr |
const flint::IPool * | _hardwoodFoliage = nullptr |
const flint::IPool * | _hardwoodCoarseRoots = nullptr |
const flint::IPool * | _hardwoodFineRoots = nullptr |
const flint::IPool * | _aboveGroundVeryFastSoil = nullptr |
const flint::IPool * | _aboveGroundFastSoil = nullptr |
const flint::IPool * | _belowGroundVeryFastSoil = nullptr |
const flint::IPool * | _belowGroundFastSoil = nullptr |
const flint::IPool * | _softwoodStemSnag = nullptr |
const flint::IPool * | _softwoodBranchSnag = nullptr |
const flint::IPool * | _hardwoodStemSnag = nullptr |
const flint::IPool * | _hardwoodBranchSnag = nullptr |
const flint::IPool * | _mediumSoil = nullptr |
const flint::IPool * | _atmosphere = nullptr |
const flint::IPool * | _woodyFoliageDead = nullptr |
const flint::IPool * | _woodyFineDead = nullptr |
const flint::IPool * | _woodyCoarseDead = nullptr |
const flint::IPool * | _woodyRootsDead = nullptr |
flint::IVariable * | _age = nullptr |
flint::IVariable * | _gcId = nullptr |
flint::IVariable * | _spuId = nullptr |
flint::IVariable * | _turnoverRates = nullptr |
flint::IVariable * | _regenDelay = nullptr |
flint::IVariable * | _spinupMossOnly = nullptr |
flint::IVariable * | _isForest = nullptr |
flint::IVariable * | _isDecaying = nullptr |
flint::IVariable * | _growthMultipliers = nullptr |
flint::IVariable * | _output_removal = nullptr |
bool | _growthMultipliersEnabled = true |
bool | _smootherEnabled = true |
bool | _debuggingEnabled = false |
std::string | _debuggingOutputPath = "." |
Int64 | _standGrowthCurveID { -1 } |
Int64 | _standSPUID { -1 } |
std::shared_ptr< VolumeToBiomassCarbonGrowth > | _volumeToBioGrowth = nullptr |
std::shared_ptr< StandGrowthCurveFactory > | _gcFactory = nullptr |
bool | _skipForPeatland { false } |
bool | _runForForestedPeatland { false } |
int | _peatlandId { -1 } |
std::unordered_map< std::tuple< Int64, Int64 >, std::shared_ptr< TurnoverRates > > | _cachedTurnoverRates |
std::shared_ptr< TurnoverRates > | _currentTurnoverRates |
double | swm = 0 |
double | swo = 0 |
double | swf = 0 |
double | hwm = 0 |
double | hwo = 0 |
double | hwf = 0 |
double | swcr = 0 |
double | swfr = 0 |
double | hwcr = 0 |
double | hwfr = 0 |
double | standSoftwoodMerch = 0 |
double | standSoftwoodOther = 0 |
double | standSoftwoodFoliage = 0 |
double | standSWCoarseRootsCarbon = 0 |
double | standSWFineRootsCarbon = 0 |
double | standHardwoodMerch = 0 |
double | standHardwoodOther = 0 |
double | standHardwoodFoliage = 0 |
double | standHWCoarseRootsCarbon = 0 |
double | standHWFineRootsCarbon = 0 |
double | softwoodStemSnag = 0 |
double | softwoodBranchSnag = 0 |
double | hardwoodStemSnag = 0 |
double | hardwoodBranchSnag = 0 |
YieldTableGrowthModule | ( | std::shared_ptr< StandGrowthCurveFactory > | gcFactory, |
std::shared_ptr< VolumeToBiomassCarbonGrowth > | volumeToBioGrowth | ||
) |
|
virtual |
|
override |
Configuration function
Assign YieldTableGrowthModule._smootherEnabled, YieldTableGrowthModule._debuggingEnabled, YieldTableGrowthModule._debuggingOutputPath values of "smoother_enabled", "debugging_enabled", "debugging_output_path" in parameter config.
Invoke VolumeToBiomassConverter.setSmoothing() with the value of YieldTableGrowthModule._smootherEnabled.
config | DynamicObject& |
std::shared_ptr< StandGrowthCurve > createStandGrowthCurve | ( | Int64 | standGrowthCurveID, |
Int64 | spuID | ||
) | const |
Return a shared pointer to an object StandGrowthCurve with parameters standGrowthCurveID and spuID
standGrowthCurveID | Int64 |
spuID | Int64 |
|
private |
|
overridevirtual |
If _landUnitData has variables "current_growth_multipliers", "output_removal ", assign it to YieldTableGrowthModule._growthMultipliers, YieldTableGrowthModule._output_removal
Initialise pools YieldTableGrowthModule._softwoodStemSnag, YieldTableGrowthModule._softwoodBranchSnag, YieldTableGrowthModule._softwoodMerch, YieldTableGrowthModule._softwoodFoliage, YieldTableGrowthModule._softwoodOther, YieldTableGrowthModule._softwoodCoarseRoots, YieldTableGrowthModule._softwoodFineRoots, YieldTableGrowthModule._hardwoodStemSnag, YieldTableGrowthModule._hardwoodBranchSnag, YieldTableGrowthModule._hardwoodMerch, YieldTableGrowthModule._hardwoodFoliage, YieldTableGrowthModule._hardwoodOther, YieldTableGrowthModule._hardwoodCoarseRoots, YieldTableGrowthModule._hardwoodFineRoots, YieldTableGrowthModule._aboveGroundVeryFastSoil YieldTableGrowthModule._aboveGroundFastSoil, YieldTableGrowthModule._belowGroundVeryFastSoil, YieldTableGrowthModule._belowGroundFastSoil, YieldTableGrowthModule._mediumSoil, YieldTableGrowthModule._atmosphere values of "SoftwoodStemSnag", "SoftwoodBranchSnag", "SoftwoodMerch", "SoftwoodFoilage", "SoftwoodOther", "SoftwoodCoarseRoots", "SoftwoodFineRoots", "HardwoodStemSnag", "HardwoodBranchSnag", "HardwoodMerch", "HardwoodFoilage", "HardwoodOther", "HardwoodCoarseRoots", "HardwoodFineRoots", "AboveGroundVeryFastSoil", "AboveGroundFastSoil", "BelowGroundVeryFastSoil", "BelowGroundFastSoil" "MediumSoil", "Atmosphere" in _landUnitData.
If the value of variable "enable_peatland" exists in _landUnitData and it is true, initialise pools _woodyFineDead , _woodyCoarseDead, _woodyFoliageDead, _woodyRootsDead values of "WoodyFineDead", "WoodyCoarseDead", "WoodyFoliageDead", "WoodyRootsDead" in _landUnitData.
Set values of variables "age", "growth_curve_id", "spatial_unit_id", "turnover_rates", "regen_delay", "spinup_moss_only", "is_forest", "is_decaying" in _landUnitData to YieldTableGrowthModule._age, YieldTableGrowthModule._gcId, YieldTableGrowthModule._spuId, YieldTableGrowthModule._turnoverRates, YieldTableGrowthModule._regenDelay, YieldTableGrowthModule._spinupMossOnly, YieldTableGrowthModule._isForest, YieldTableGrowthModule._isDecaying.
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 |
|
private |
Perform dead organic matter and biomass turnovers as stock operations
If the value of variable "peatland_class" in _landUnitData is not empty, invoke createStockOperation() on _landUnitData . Add transfers between softwood and 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 and hardwood merchantable, foilage, other, coarse and fine roots to woody coarse, fine foilage and dead pools, softwood and harwood snag pools. Invoke submitStockOperation() on _landUnitData to submit the transfers and applyOperations() on _landUnitData to apply the transfers
|
overridevirtual |
Assign YieldTableGrowthModule._standSPUID value of YieldTableGrowthModule._spuId. Invoke YieldTableGrowthModule.initPeatland()
Reimplemented from CBMModuleBase.
|
overridevirtual |
If YieldTableGrowthModule._regenDelay > 0, set its value to the decrement of the current value of YieldTableGrowthModule._regenDelay and return
If YieldTableGrowthModule._skipForPeatland is true, return
If YieldTableGrowthModule.spinupMossOnly us true, the moss module is spinning up, and there is nothing to grow, turnover and decay, return
Invoke YieldTableGrowthModule.getYieldCurve(), invoke YieldTableGrowthModule.updateBiomassPools() to get the current biomass pool values. Set YieldTableGrowthModule.softwoodStemSnag, YieldTableGrowthModule.softwoodBranchSnag, YieldTableGrowthModule.hardwoodStemSnag, YieldTableGrowthModule.hardwoodStemSnag to the current values of YieldTableGrowthModule._softwoodStemSnag, YieldTableGrowthModule._softwoodBranchSnag, YieldTableGrowthModule._hardwoodStemSnag, YieldTableGrowthModule._hardwoodBranchSnag
If _landUnitData has the variable "delay" and the value of variable "run_delay" is true, the last rotation is done, and the delay is defined, do turnover and following decay, invoke YieldTableGrowthModule.getTurnoverRates(), YieldTableGrowthModule.updateBiomassPools(), YieldTableGrowthModule.doMidSeasonGrowth(), YieldTableGrowthModule.switchTurnover()
As there should be no growth in the delay period, return
If _landUnitData does not have the variable "delay", and YieldTableGrowthModule.shouldRun() is false, return
Else, invoke YieldTableGrowthModule.getIncrements() to get and store the biomass carbon growth increments, YieldTableGrowthModule.getTurnoverRates() to get and store the ecoboundary/genus-specific turnover rates, YieldTableGrowthModule.switchHalfGrowth() to transfer half of the biomass growth increment to the biomass pool, YieldTableGrowthModule.updateBiomassPools() to update to record the current biomass pool value plus the half increment of biomass, YieldTableGrowthModule.doMidSeasonGrowth() to the foliage and snags that grow and are turned over, YieldTableGrowthModule.switchTurnover() to switch to do biomass and snag turnover for peatland or regular forest land YieldTableGrowthModule.switchHalfGrowth() to transfer the remaining half increment to the biomass pool
Set the value of YieldTableGrowthModule._age to the increment of the current value of YieldTableGrowthModule._age by 1
Reimplemented from CBMModuleBase.
|
private |
Perform snag and biomass turnovers as stock operations
Invoke createStockOperation() on _landUnitData . Add transfers between softwood and hardwood branch and snag pools to medium and above ground fast soil pools. Invoke submitStockOperation() on _landUnitData to submit the transfers
Invoke createStockOperation() on _landUnitData . Add transfers between softwood and hardwood merchantable, foilage, other, coarse and fine roots to softwood and hardwood stem and branch snag pools, above and below ground fast and slow pools. Invoke submitStockOperation() on _landUnitData to submit the transfers
|
private |
If the result of VolumeToBiomassCarbonGrowth.getBiomassCarbonIncrements() on YieldTableGrowthModule._volumeToBioGrowth, indicating there are increments for the particular _standGrowthCurveID and _standSPUID, assign YieldTableGrowthModule.swm, YieldTableGrowthModule.swo, YieldTableGrowthModule.swf, YieldTableGrowthModule.swcr, YieldTableGrowthModule.swfr the Softwood increments, YieldTableGrowthModule.hwm, YieldTableGrowthModule.hwo, YieldTableGrowthModule.hwf, YieldTableGrowthModule.hwcr, YieldTableGrowthModule.hwfr Hardwood increments
If YieldTableGrowthModule._growthMultipliersEnabled is not enabled return
else, check if "Softwood" is found in _growthMultipliers and multiply YieldTableGrowthModule.swm, YieldTableGrowthModule.swo, YieldTableGrowthModule.swf, YieldTableGrowthModule.swcr, YieldTableGrowthModule.swfr by the softwood multiplication factor, check if "Hardwood" is found in YieldTableGrowthModule._growthMultipliers and multiply YieldTableGrowthModule.hwm, YieldTableGrowthModule.hwo, YieldTableGrowthModule.hwf, YieldTableGrowthModule.hwcr, YieldTableGrowthModule.hwfr by the hardwood multiplication factor
|
private |
Set the value of the current turnover rate
Set YieldTableGrowthModule._currentTurnoverRates to the value of the tuple key (YieldTableGrowthModule._standGrowthCurveID, YieldTableGrowthModule._standSPUID) in YieldTableGrowthModule._cachedTurnoverRates if it exists
Else set YieldTableGrowthModule._currentTurnoverRates to a shared pointer of TurnoverRates, with the value of YieldTableGrowthModule._turnoverRates, a nullptr. Set the value of the tuple key (YieldTableGrowthModule._standGrowthCurveID, YieldTableGrowthModule._standSPUID) to YieldTableGrowthModule._currentTurnoverRates
void getYieldCurve | ( | ) |
If the value of YieldTableGrowthModule._gcId is not empty, set YieldTableGrowthModule._standGrowthCurveID as value of _gcId, else to -1
If the value of YieldTableGrowthModule._standGrowthCurveID is -1, set YieldTableGrowthModule._isDecaying to false
Try to get the stand growth curve and related yield table data from memory, if the result of VolumeToBiomassConverter.isBiomassCarbonCurveAvailable() on YieldTableGrowthModule._volumeToBioGrowth with parameter YieldTableGrowthModule._standGrowthCurveID and YieldTableGrowthModule._standSPUID true, indicating that the carbon curve is found, call the stand growth curve factory to create the stand growth curve, invoke StandGrowthCurveFactory.createStandGrowthCurve() on YieldTableGrowthModule._gcFactory with parameter YieldTableGrowthModule._standGrowthCurveID, YieldTableGrowthModule._standSPUID and _landUnitData
Process and convert yield volume to carbon curves, invoke VolumeToBiomassCarbonGrowth.generateBiomassCarbonCurve() on YieldTableGrowthModule._volumeToBioGrowth with argument as the generated stand growth curve
|
private |
For each pixel set the YieldTableGrowthModule._skipPeatland, YieldTableGrowthModule._runForForestedPeatland to false.
If _landUnitData has the variable "enable_peatland" and the value of the variable is true, if the value of variable "peatland_class" in _landUnitData is either Peatlands::FOREST_PEATLAND_BOG, Peatlands::FOREST_PEATLAND_POORFEN, Peatlands::FOREST_PEATLAND_RICHFEN or Peatlands::FOREST_PEATLAND_SWAMP, set _runForForestedPeatland to true.
Skip growth and turnover when running peatland on non-forest peatland stand
|
override |
|
private |
Log the parameters standAge, standFoilageRemoval, standStemSnagRemoval, standBranchSnagRemoval, standOtherRemovalToWFD, standCoarseRootRemoval, standFineRootRemoval and standOtherRemovalToBranchSnag
standAge | int |
standFoilageRemoval | double |
standStemSnagRemoval | double |
standBranchSnagRemoval | double |
standOtherRemovalToWFD | double |
standCoarseRootRemoval | double |
standFineRootRemoval | double |
standOtherRemovalToBranchSnag | double |
|
private |
Determine if the YieldTableGrowthModule should run
Return true if YieldTableGrowthModule._isForest is true and YieldTableGrowthModule._standGrowthCurveID is not -1, else return false.
|
override |
Subscribe to the signals LocalDomainInit, TimingInit and TimingStep
notificationCenter | NotificationCenter& |
|
private |
If YieldTableGrowthModule._runForForestedPeatland is true, invoke the YieldTableGrowthModule.doPeatlandHalfGrowth(), else invoke YieldTableGrowthModule.doHalfGrowth()
|
private |
If YieldTableGrowthModule._runForForestedPeatland is true, and YieldTableGrowthModule._output_removal is not null, invoke YieldTableGrowthModule.printRemovals() to log all the removals from the stand. Invoke YieldTableGrowthModule.doPeatlandTurnover() to calculate the turnover If YieldTableGrowthModule._runForForestedPeatland is true, invoke YieldTableGrowthModule.doTurnover()
|
private |
Update the biomass and snag pool variables with the latest values
Set values of YieldTableGrowthModule._softwoodMerch, YieldTableGrowthModule._softwoodOther, YieldTableGrowthModule._softwoodFoilage, YieldTableGrowthModule._softwoodCoarseRoots, YieldTableGrowthModule._softwoodFineRoots, YieldTableGrowthModule._hardwoodMerch, YieldTableGrowthModule._hardwoodOther, YieldTableGrowthModule._hardwoodFoilage, YieldTableGrowthModule._hardwoodCoarseRoots, YieldTableGrowthModule._hardwoodFineRoots to YieldTableGrowthModule.standSoftwoodMerch, YieldTableGrowthModule.standSoftwoodOther, YieldTableGrowthModule.standSoftwoodFoliage, YieldTableGrowthModule.standSoftwoodCoarseRoots, YieldTableGrowthModule.standSoftwoodFineRoots, YieldTableGrowthModule.standHardwoodMerch, YieldTableGrowthModule.standHardwoodOther, YieldTableGrowthModule.standHardwoodFoliage, YieldTableGrowthModule.standHardwoodCoarseRoots, YieldTableGrowthModule.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 |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |