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

#include <peatlandturnovermodule.h>

Inheritance diagram for PeatlandTurnoverModule:
Inheritance graph
Collaboration diagram for PeatlandTurnoverModule:
Collaboration graph

Public Member Functions

 PeatlandTurnoverModule ()
 
virtual ~PeatlandTurnoverModule ()=default
 
void doLocalDomainInit () override
 
void doTimingInit () override
 
void doTimingStep () override
 
- Public Member Functions inherited from PeatlandTurnoverModuleBase
 PeatlandTurnoverModuleBase ()
 
virtual ~PeatlandTurnoverModuleBase ()=default
 
void configure (const DynamicObject &config) override
 
void subscribe (NotificationCenter &notificationCenter) override
 
- 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 doWaterTableFlux ()
 
void updateWaterTable ()
 
void updateParameters ()
 
double getModifiedAnnualWTD (std::string modifierStr)
 

Private Attributes

flint::IVariable * _waterTableDepthModifier { nullptr }
 
flint::IVariable * _spinupMossOnly { nullptr }
 
flint::IVariable * _appliedAnnualWTD { nullptr }
 
double _forward_longterm_wtd { 0 }
 
double _forward_previous_annual_wtd { 0 }
 
double _forward_current_annual_wtd { 0 }
 
std::string _forward_wtd_modifier { "" }
 
bool _modifiersFullyAppplied { false }
 

Additional Inherited Members

- Protected Member Functions inherited from PeatlandTurnoverModuleBase
void updatePeatlandLivePoolValue ()
 
void doLivePoolTurnover ()
 
double computeWaterTableDepth (double dc, int peatlandID)
 
double computeCarbonTransfers (double previousAwtd, double currentAwtd, double a, double b)
 
- Protected Attributes inherited from PeatlandTurnoverModuleBase
const flint::IPool * _atmosphere = nullptr
 
const flint::IPool * _woodyFoliageLive = nullptr
 
const flint::IPool * _woodyStemsBranchesLive = nullptr
 
const flint::IPool * _woodyRootsLive = nullptr
 
const flint::IPool * _sedgeFoliageLive = nullptr
 
const flint::IPool * _sedgeRootsLive = nullptr
 
const flint::IPool * _featherMossLive = nullptr
 
const flint::IPool * _sphagnumMossLive = nullptr
 
const flint::IPool * _woodyFineDead = nullptr
 
const flint::IPool * _woodyCoarseDead = nullptr
 
const flint::IPool * _woodyFoliageDead = nullptr
 
const flint::IPool * _woodyRootsDead = nullptr
 
const flint::IPool * _sedgeFoliageDead = nullptr
 
const flint::IPool * _sedgeRootsDead = nullptr
 
const flint::IPool * _feathermossDead = nullptr
 
const flint::IPool * _acrotelm_o = nullptr
 
const flint::IPool * _catotelm_a = nullptr
 
const flint::IPool * _acrotelm_a = nullptr
 
const flint::IPool * _catotelm_o = nullptr
 
flint::IVariable * _regenDelay = nullptr
 
flint::IVariable * _shrubAge = nullptr
 Peatland shrub age variable, which may be very old /summary> More...
 
std::shared_ptr< PeatlandTurnoverParametersturnoverParas = nullptr
 Turnover parameters associated to this peatland unit /summary> More...
 
std::shared_ptr< PeatlandGrowthParametersgrowthParas = nullptr
 Growth parameters associated to this peatland unit /summary> More...
 
DynamicObject baseWTDParameters
 
double woodyFoliageLive { 0 }
 
double woodyStemsBranchesLive { 0 }
 
double woodyRootsLive { 0 }
 
double sedgeFoliageLive { 0 }
 
double sedgeRootsLive { 0 }
 
double featherMossLive { 0 }
 
double sphagnumMossLive { 0 }
 
bool _runPeatland { false }
 
int _peatlandId { -1 }
 

Constructor & Destructor Documentation

◆ PeatlandTurnoverModule()

◆ ~PeatlandTurnoverModule()

virtual ~PeatlandTurnoverModule ( )
virtualdefault

Member Function Documentation

◆ doLocalDomainInit()

void doLocalDomainInit ( )
overridevirtual

Set the value of the pools "Atmosphere", "WoodyFoilageLive", "WoodyStemsBranchesLive", "WoodyRootsLive", "SedgeFoliageLive", "SedgeRootsLive", "SphagnumMossLive", "FeatherMossLive", "WoodyFoliageDead", "WoodyFineDead", "WoodyCoarseDead", "WoodyRootsDead", "SedgeFoliageDead", "SedgeRootsDead", "FeathermossDead", "Acrotelm_O", "Catotelm_A", "Acrotelm_A", "Catotelm_O" from _landUnitData to PeatlandTurnoverModule._atmosphere, PeatlandTurnoverModule._woodyFoliageLive, PeatlandTurnoverModule._woodyStemsBranchesLive, PeatlandTurnoverModule._sedgeFoliageLive, PeatlandTurnoverModule._sedgeRootsLive, PeatlandTurnoverModule._sphagnumMossLive, PeatlandTurnoverModule._featherMossLive, PeatlandTurnoverModule._woodyFoliageDead, PeatlandTurnoverModule._woodyFineDead, PeatlandTurnoverModule._woodyCoarseDead, PeatlandTurnoverModule._woodyRootsDead, PeatlandTurnoverModule._sedgeFoliageDead, PeatlandTurnoverModule._sedgeRootsDead, PeatlandTurnoverModule._feathermossDead, PeatlandTurnoverModule._acrotelm_O, PeatlandTurnoverModule._catotelm_A, PeatlandTurnoverModule._acrotelm_A, PeatlandTurnoverModule._catotelm_O

Set value of variables "spinup_moss_only", "regen_delay", "base_wtd_parameters", "applied_annual_wtd" from _landUnitData to PeatlandTurnoverModule._spinupMossOnly, PeatlandTurnoverModule._regenDelay, PeatlandTurnoverModule.baseWTDParameters, PeatlandTurnoverModule._appliedAnnualWTD

Returns
void

Reimplemented from CBMModuleBase.

◆ doTimingInit()

void doTimingInit ( )
overridevirtual

Set PeatlandTurnoverModule._runPeatland and PeatlandTurnoverModule._modifiersFullyAppplied to false, PeatlandTurnoverModule._appliedAnnualWTD is reset
If value of variable "load_peatpool_initials" in _landUnitData is not null, invoke PeatlandTurnoverModule.loadPeatlandInitialPoolValues()
If the value of "peatland_class" in _landUnitData is not empty, assign turnoverParas a shared pointer of PeatlandGrowthParameters and set it to "peatland_turnover_parameters" in _landUnitData
assign growthParas a shared pointer of PeatlandGrowthParameters ans set it to "peatland_growth_parameters" in _landUnitData
Set the result of PeatlandTurnoverModule.computeWaterTableDepth() to the three water table depths PeatlandTurnoverModule._forward_longterm_wtd, PeatlandTurnoverModule._forward_previous_annual_wtd and PeatlandTurnoverModule._forward_current_annual_wtd

Returns
void

Reimplemented from CBMModuleBase.

◆ doTimingStep()

void doTimingStep ( )
overridevirtual

If spinupMossOnly is true return
If PeatlandTurnoverModule._runPeatland is true and value of PeatlandTurnoverModule._regenDelay > 0, indicating delay period, there is no growth, invoke PeatlandTurnoverModule.doWaterTableFlux() to perform transfers between pools catotelm and acrotelm
If PeatlandTurnoverModule._runPeatland is true and value of PeatlandTurnoverModule._regenDelay <= 0, invoke PeatlandTurnoverModule.updatePeatlandLivePoolValue() to update the current pool values, PeatlandTurnoverModule.doLivePoolTurnover() to turnover on live pools and PeatlandTurnoverModule.doWaterTableFlux() to perform transfers between pools catotelm and acrotelm

Returns
void

Reimplemented from CBMModuleBase.

◆ doWaterTableFlux()

void doWaterTableFlux ( )
private

Add transfers between the pools PeatlandTurnoverModule._catotelm_o, PeatlandTurnoverModule._catotelm_a, PeatlandTurnoverModule._acrotelm_o, PeatlandTurnoverModule._acrotelm_a based on the values of current annual water table depth PeatlandTurnoverModule._spinup_current_annual_wtd, previous annual water table depth PeatlandTurnoverModule._spinup_previous_annual_wtd and long term annual water table depth PeatlandTurnoverModule._spinup_longterm_wtd
Invoke createStockOperation() on _landUnitData, compute the flux using PeatlandTurnoverModule.computeCarbonTransfers()
Submit the stock operation to the LandUnitData and apply the stock operation to the _landUnitData

Returns
void

◆ getModifiedAnnualWTD()

double getModifiedAnnualWTD ( std::string  modifierStr)
private

Extract the value of the current year from the argument modifierStr, if years > 0 decrement the value of year by 1. After the decrement, if year is 0, set PeatlandTurnoverModule._forward_wtd_modifier to empty string and PeatlandTurnoverModule._modifiersFullyAppplied to true. Else if year != 0, then set PeatlandTurnoverModule._forward_wtd_modifier to the concatenation of the value of the current year and the value of the modifier from argument modifierStr

Parameters
modifierStrstring
Returns
double

◆ updateParameters()

void updateParameters ( )
private

◆ updateWaterTable()

void updateWaterTable ( )
private

Update the water table

Set the value of variable "annual_drought_class" in _landUnitData to the current annual drought code if it is not empty, else set it to the value of variable "default_annual_drought_class" in _landUnitData
Invoke PeatlandTurnoverModule.computeWaterTableDepth() to compute the water table depth parameter to be used in current step with parameters as annual drought code and PeatlandTurnoverModule._peatlandId
If PeatlandTurnoverModule._modifiersFullyAppplied is false, apply the water table depth modifier and update the current year water table depth
if the local modifier, PeatlandTurnoverModule._forward_wtd_modifier, is empty, it means it is never set before, then check if there is a valid WTD modifer, PeatlandTurnoverModule._waterTableDepthModifier, trigged in the event.If there is a WTD modifier, get the valid WTD value for current step and update the modifiers accordingly, set the new water table depth to the result of PeatlandTurnoverModule.getModifiedAnnualWTD() with parameter as PeatlandTurnoverModule._waterTableDepthModifier
Else, if the forward WTD modifier, PeatlandTurnoverModule._forward_wtd_modifier, is already set, get the valid WTD value and update remaining modifiers accordingly, set the result of PeatlandTurnoverModule.getModifiedAnnualWTD() with parameter as PeatlandTurnoverModule._forward_wtd_modifier to the new water table depth
Set the previous annual WTD, PeatlandTurnoverModule._forward_previous_annual_wtd, with the old value (not updated) current water table value PeatlandTurnoverModule._forward_current_annual_wtd, update the current WTD, PeatlandTurnoverModule._forward_current_annual_wtd with the newly computed WTD value, post the updated PeatlandTurnoverModule._forward_current_annual_wtd as applied annual WTD by setting the value of PeatlandTurnoverModule._appliedAnnualWTD to PeatlandTurnoverModule._forward_current_annual_wtd

Returns
void

Member Data Documentation

◆ _appliedAnnualWTD

flint::IVariable* _appliedAnnualWTD { nullptr }
private

◆ _forward_current_annual_wtd

double _forward_current_annual_wtd { 0 }
private

◆ _forward_longterm_wtd

double _forward_longterm_wtd { 0 }
private

◆ _forward_previous_annual_wtd

double _forward_previous_annual_wtd { 0 }
private

◆ _forward_wtd_modifier

std::string _forward_wtd_modifier { "" }
private

◆ _modifiersFullyAppplied

bool _modifiersFullyAppplied { false }
private

◆ _spinupMossOnly

flint::IVariable* _spinupMossOnly { nullptr }
private

◆ _waterTableDepthModifier

flint::IVariable* _waterTableDepthModifier { nullptr }
private

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