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

#include <peatlanddecaymodule.h>

Inheritance diagram for PeatlandDecayModule:
Inheritance graph
Collaboration diagram for PeatlandDecayModule:
Collaboration graph

Public Member Functions

 PeatlandDecayModule ()
 
virtual ~PeatlandDecayModule ()=default
 
void configure (const DynamicObject &config) override
 
void subscribe (NotificationCenter &notificationCenter) override
 
void doLocalDomainInit () override
 
void doTimingInit () override
 
void doTimingStep () 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 doDeadPoolTurnover (double turnoverRate)
 
void doPeatlandDecay (double turnoverRate, double awtd)
 
void doPeatlandNewCH4ModelDecay (double turnoverRate)
 
void allocateCh4CO2 (double awtd)
 
void updateParameters ()
 
double getCurrentYearWaterTable ()
 
double getToCO2Rate (double rate, double turnoverRate, double awtd)
 
double getToCH4Rate (double rate, double turnoverRate, double awtd)
 
double computeWaterTableDepth (double dc, int peatlandID)
 

Private Attributes

const flint::IPool * _woodyFoliageDead { nullptr }
 
const flint::IPool * _woodyFineDead { nullptr }
 
const flint::IPool * _woodyCoarseDead { 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 }
 
const flint::IPool * _co2 { nullptr }
 
const flint::IPool * _ch4 { nullptr }
 
const flint::IPool * _tempCarbon { nullptr }
 
flint::IVariable * _spinupMossOnly { nullptr }
 
flint::IVariable * _appliedAnnualWTD { nullptr }
 
double _meanAnnualTemperature { 0 }
 
int _peatlandId { -1 }
 
bool _runPeatland { false }
 
std::shared_ptr< PeatlandDecayParametersdecayParas { nullptr }
 Decay parameters associated with this peatland unit More...
 
std::shared_ptr< PeatlandTurnoverParametersturnoverParas { nullptr }
 Turnover parameters associated with this peatland unit More...
 
std::shared_ptr< PeatlandWTDBaseFCH4ParameterswtdFch4Paras { nullptr }
 Wtd-base and fch4 parameters More...
 
DynamicObject baseWTDParameters
 

Constructor & Destructor Documentation

◆ PeatlandDecayModule()

◆ ~PeatlandDecayModule()

virtual ~PeatlandDecayModule ( )
virtualdefault

Member Function Documentation

◆ allocateCh4CO2()

void allocateCh4CO2 ( double  awtd)
private

Get the CO2 an CH4 portions and perform transfers from temporary carbon pool

Create a variable ch4Portion with initial value 0.0, if parameter awtd is greater than PeatlandWTDBaseFCH4Parameters.OptCH4WTD() on PeatlandDecayModule.wtdFch4Paras, set ch4Portion to FCH4max * pow(F10r, ((OptCH4WTD - awtd) / 10.0)), else to FCH4max * pow(F10d, ((OptCH4WTD - awtd) / 10.0)), where FCH4max is the result of PeatlandWTDBaseFCH4Parameters.FCH4_max(), F10d is the result of PeatlandWTDBaseFCH4Parameters.F10d(), F10r is the result of PeatlandWTDBaseFCH4Parameters.F10r(), OptCH4WTD is the result of PeatlandWTDBaseFCH4Parameters.OptCH4WTD() on PeatlandDecayModule.wtdFch4Paras
A variable co2Portion is assgined the difference of PeatlandDecayModule._tempCarbon and variable ch4Portion
If variables ch4Portion, co2Portion and PeatlandDecayModule._tempCarbon are greater than 0.0, create a proportionalOperation() on _landUnitData and add a transfer of ch4Portion from source PeatlandDecayModule._tempCarbon to sink PeatlandDecayModule._ch4, \ and a transfer of co2Portion from source PeatlandDecayModule._tempCarbon to sink PeatlandDecayModule._co2 Submit the proportionalOperation() on _landUnitData and applyOperations() to apply the transfers.

Parameters
awtddouble
Returns
void

◆ computeWaterTableDepth()

double computeWaterTableDepth ( double  dc,
int  peatlandID 
)
private

Get the water table depth corresponding to the peatlandID

Return -0.045 * dc + base water table depth in PeatlandDecayModule.baseWTDParameters for parameter peatlandID

Parameters
dcdouble
peatlandIdint
Returns
double

◆ configure()

void configure ( const DynamicObject &  config)
override

Configuration function

Parameters
configconst DynamicObject&
Returns
void

◆ doDeadPoolTurnover()

void doDeadPoolTurnover ( double  deadPoolTurnoverRate)
private

Invoke createProportionalOperation() on _landUnitData
Add all the transfers from source to sink pools
Invoke submitOperation() on _landUnitData to submit the transfers, and applyOperations() to apply the transfers.

Parameters
deadPoolTurnoverRatedouble
Returns
void

◆ doLocalDomainInit()

void doLocalDomainInit ( )
overridevirtual

Initialise PeatlandDecayModule._woodyFoliageDead, PeatlandDecayModule._woodyFineDead, PeatlandDecayModule._woodyCoarseDead, PeatlandDecayModule._woodyRootsDead, PeatlandDecayModule._sedgeFoliageDead, PeatlandDecayModule._sedgeRootsDead, PeatlandDecayModule._feathermossDead, PeatlandDecayModule._acrotelm_o, PeatlandDecayModule._catotelm_a, PeatlandDecayModule._acrotelm_a, PeatlandDecayModule._catotelm_o, PeatlandDecayModule._co2, PeatlandDecayModule._ch4, PeatlandDecayModule._tempCarbon with the pools "WoodyFoliageDead", "WoodyFineDead", "WoodyCoarseDead", "WoodyRootsDead", "SedgeFoliageDead", "SedgeRootsDead", "FeathermossDead", "Acrotelm_o", "Catotelm_a", "Acrotelm_a", "Catotelm_o", "CO2", "CH4", "TempCarbon" in _landUnitData
Initialise PeatlandDecayModule._spinupMossOnly, PeatlandDecayModule.baseWTDParameters, PeatlandDecayModule._appliedAnnualWTD value of variables "spinup_moss_only", "base_wtd_parameters", "applied_annual_wtd" in _landUnitData

Returns
void

Reimplemented from CBMModuleBase.

◆ doPeatlandDecay()

void doPeatlandDecay ( double  deadPoolTurnoverRate,
double  awtd 
)
private

Invoke createProportionalOperation() on _landUnitData
Add all the transfers from source to sink pools
Invoke submitOperation() on _landUnitData to submit the transfers, and applyOperations() to apply the transfers.

Parameters
deadPoolTurnoverRatedouble
awtddouble
Returns
void

◆ doPeatlandNewCH4ModelDecay()

void doPeatlandNewCH4ModelDecay ( double  deadPoolTurnoverRate)
private

Invoke createProportionalOperation() on _landUnitData
Add all the transfers from source to sink pools
Invoke submitOperation() on _landUnitData to submit the transfers, and applyOperations() to apply the transfers.

Parameters
deadPoolTurnoverRatedouble
Returns
void

◆ doTimingInit()

void doTimingInit ( )
overridevirtual

Set the value of PeatlandDecayModule._runPeatland to false
If the value of variable "peatland_class" in _landUnitData is > 0, set PeatlandDecayModule._runPeatland as true.
Create a variable meanAnnualTemperature, set it to the value of variable "mean_annual_temperature" in _landUnitData if not empty, else to the value of variable "default_mean_annual_temperature" in _landUnitData
Assign value of variables "peatland_decay_parameters", "peatland_turnover_parameters" in _landUnitData to PeatlandDecayModule.decayParas, a shared pointer of type PeatlandDecayParameters, PeatlandDecayModule.turnoverParas, a shared pointer of type PeatlandTurnoverParameters
Invoke PeatlandDecayParameters.updateAppliedDecayParameters() on PeatlandDecayModule.decayParas with argument as variable meanAnnualTemperature
Assign a shared pointer of type PeatlandWTDBaseFCH4Parameters to PeatlandDecayModule.wtdFch4Paras, invoke PeatlandWTDBaseFCH4Parameters.setValue() with argument as value of variable "peatland_wtd_base_parameters" in _landUnitData
PeatlandWTDBaseFCH4Parameters.setFCH4Value() with argument as value of variable "peatland_fch4_max_parameters" in _landUnitData

Returns
void

Reimplemented from CBMModuleBase.

◆ doTimingStep()

void doTimingStep ( )
overridevirtual

If PeatlandDecayModule._runPeatland is false or _spinupMossOnly is true, return
Else, invoke PeatlandDecayModule.doDeadPoolTurnover(), PeatlandDecayModule.doPeatlandNewCH4ModelDecay() with argument as the result of PeatlandDecayParameters.Pt() on PeatlandDecayModule.decayParas
, PeatlandDecayModule.allocateCh4CO2() with argument as the current value of the water table given by the value of PeatlandDecayModule._appliedAnnualWTD

Returns
void

Reimplemented from CBMModuleBase.

◆ getCurrentYearWaterTable()

double getCurrentYearWaterTable ( )
private

Get the current water table depth

Assign a variable annualDroughtCode, value of variable "annual_drought_class" in _landUnitData else, value of variable "default_annual_drought_class" in _landUnitData
Assign a variable newCurrentYearWtd, compute the water table depth to be used in current step, the result of PeatlandDecayModule.computeWaterTableDepth() with arguments as annualDroughtCode, PeatlandDecayModule._peatlandId
If there is a valid modified annual WTD for forward run only, if value of PeatlandDecayModule._appliedAnnualWTD < 0, assign it to newCurrentYearWtd
Return newCurrentYearWtd

Returns
double

◆ getToCH4Rate()

double getToCH4Rate ( double  rate,
double  deadPoolTurnoverRate,
double  awtd 
)
private

Get the total CH4 production rate for the given parameters.

Return, rate * (1 - deadPoolTurnoverRate) * (awtd * decayParas->c() + decayParas->d()), where rate, deadPoolTurnoverRate, and awtd are parameters, PeatlandDecayParameters.c(), PeatlandDecayParameters.d() are invoked on PeatlandDecayModule.decayParas

Parameters
ratedouble
deadPoolTurnoverRatedouble
awtddouble
Returns
double

◆ getToCO2Rate()

double getToCO2Rate ( double  rate,
double  deadPoolTurnoverRate,
double  awtd 
)
private

Get the total CO2 production rate for the given parameters.

Return, rate * (1 - deadPoolTurnoverRate) * (1 - (awtd * decayParas->c() + decayParas->d())), where rate, deadPoolTurnoverRate, and awtd are parameters, PeatlandDecayParameters.c(), PeatlandDecayParameters.d() are invoked on PeatlandDecayModule.decayParas

Parameters
ratedouble
deadPoolTurnoverRatedouble
awtddouble
Returns
double

◆ subscribe()

void subscribe ( NotificationCenter &  notificationCenter)
override

Subscribe to the signals LocalDomainInit, TimingInit and TimingStep

Parameters
notificationCenterNotificationCenter&
Returns
void

◆ updateParameters()

void updateParameters ( )
private

Member Data Documentation

◆ _acrotelm_a

const flint::IPool* _acrotelm_a { nullptr }
private

◆ _acrotelm_o

const flint::IPool* _acrotelm_o { nullptr }
private

◆ _appliedAnnualWTD

flint::IVariable* _appliedAnnualWTD { nullptr }
private

◆ _catotelm_a

const flint::IPool* _catotelm_a { nullptr }
private

◆ _catotelm_o

const flint::IPool* _catotelm_o { nullptr }
private

◆ _ch4

const flint::IPool* _ch4 { nullptr }
private

◆ _co2

const flint::IPool* _co2 { nullptr }
private

◆ _feathermossDead

const flint::IPool* _feathermossDead { nullptr }
private

◆ _meanAnnualTemperature

double _meanAnnualTemperature { 0 }
private

◆ _peatlandId

int _peatlandId { -1 }
private

◆ _runPeatland

bool _runPeatland { false }
private

◆ _sedgeFoliageDead

const flint::IPool* _sedgeFoliageDead { nullptr }
private

◆ _sedgeRootsDead

const flint::IPool* _sedgeRootsDead { nullptr }
private

◆ _spinupMossOnly

flint::IVariable* _spinupMossOnly { nullptr }
private

◆ _tempCarbon

const flint::IPool* _tempCarbon { nullptr }
private

◆ _woodyCoarseDead

const flint::IPool* _woodyCoarseDead { nullptr }
private

◆ _woodyFineDead

const flint::IPool* _woodyFineDead { nullptr }
private

◆ _woodyFoliageDead

const flint::IPool* _woodyFoliageDead { nullptr }
private

◆ _woodyRootsDead

const flint::IPool* _woodyRootsDead { nullptr }
private

◆ baseWTDParameters

DynamicObject baseWTDParameters
private

◆ decayParas

std::shared_ptr<PeatlandDecayParameters> decayParas { nullptr }
private

Decay parameters associated with this peatland unit

◆ turnoverParas

std::shared_ptr<PeatlandTurnoverParameters> turnoverParas { nullptr }
private

Turnover parameters associated with this peatland unit

◆ wtdFch4Paras

std::shared_ptr<PeatlandWTDBaseFCH4Parameters> wtdFch4Paras { nullptr }
private

Wtd-base and fch4 parameters


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