SORTIE Core C++ Documentation
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clWindstorm Class Reference

Windstorm version 2.0. More...

#include <Windstorm.h>

Inheritance diagram for clWindstorm:
clBehaviorBase clWorkerBase

Public Member Functions

 clWindstorm (clSimManager *p_oSimManager)
 Constructor. More...
 
 ~clWindstorm ()
 Destructor. More...
 
void GetData (xercesc::DOMDocument *p_oDoc)
 Does behavior setup. More...
 
void Action ()
 Does windstorms each timestep. More...
 
- Public Member Functions inherited from clBehaviorBase
virtual float GetBehaviorVersion ()
 Gets the behavior version number. More...
 
 clBehaviorBase (clSimManager *p_oSimManager)
 Constructor. More...
 
virtual ~clBehaviorBase ()
 Destructor. More...
 
virtual short int ValidateVersionNumber (float fTestVersion)
 Makes sure that the version number of a file passed is between the minimum and current version numbers. More...
 
virtual void RegisterTreeDataMembers ()
 Registers tree data members. More...
 
virtual void SetSpeciesTypeCombos (short int iNumCombos, stcSpeciesTypeCombo *p_whatCombos)
 Sets the species/type combos for a behavior. More...
 
virtual void SetNameData (std::string sNameString)
 Sets the string for the parameter file behavior. More...
 
virtual short int GetNewTreeInts ()
 Gets the number of new tree integer data members this behavior wants to register. More...
 
virtual short int GetNewTreeFloats ()
 Gets the number of new tree float data members this behavior wants to register. More...
 
virtual short int GetNewTreeChars ()
 Gets the number of new tree character data members this behavior wants to register. More...
 
virtual short int GetNewTreeBools ()
 Gets the number of new tree bool data members this behavior wants to register. More...
 
virtual short int GetNumSpeciesTypeCombos ()
 Gets the number of species/type combos to which this behavior applies. More...
 
virtual short int GetNumBehaviorSpecies ()
 Gets the number of unique tree species to which this behavior applies. More...
 
struct stcSpeciesTypeCombo GetSpeciesTypeCombo (short int iIndex)
 Gets one of this behavior's type/species combos. More...
 
virtual short int GetBehaviorSpecies (short int iIndex)
 Gets one of the behavior's species. More...
 
short int GetBehaviorListNumber ()
 Gets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list. More...
 
void SetBehaviorListNumber (short int iNumber)
 Sets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list. More...
 
std::string FormatSpeciesTypeQueryString ()
 Formats the string for species/types query. More...
 
virtual DOMElement * GetParentParametersElement (xercesc::DOMDocument *p_oDoc)
 This will get the correct set of parameters for this behavior based on the behavior list position number. More...
 
- Public Member Functions inherited from clWorkerBase
 clWorkerBase (clSimManager *p_oSimManager)
 Constructor. More...
 
virtual ~clWorkerBase ()
 Destructor. More...
 
std::string GetName ()
 Gets the object's namestring. More...
 
clSimManagerGetSimManager ()
 
void DoObjectSetup (xercesc::DOMDocument *p_oDoc, fileType iFileType)
 Triggers the setup process. More...
 
virtual void TimestepCleanup ()
 Performs any necessary cleanup operations at the end of a timestep. More...
 
virtual void EndOfRunCleanup ()
 Performs any necessary cleanup operations at the end of a run. More...
 

Protected Member Functions

void DoGridSetup ()
 Sets up the "Windstorm Results" grid. More...
 
void ReadParFile (xercesc::DOMDocument *p_oDoc, clTreePopulation *p_oPop)
 Reads in parameters from the parameter file. More...
 
void GetDeadCodes (clTreePopulation *p_oPop)
 Gets codes for the "dead" data member for each tree type to which this behavior applies. More...
 
void FormatQueryString (clTreePopulation *p_oPop)
 Formats the string in m_cQuery. More...
 
- Protected Member Functions inherited from clWorkerBase
void AssembleFileCode (int iFileType, int iFileVersion, char *cCode)
 Creates the proper identifying filecode for an XML file. More...
 

Protected Attributes

clGridmp_oResultsGrid
 Windstorm Results grid This grid is named "Windstorm Results" and it contains the data for all storms that happened in the previous timestep. More...
 
int ** mp_iDeadCodes
 Return codes for the "dead" bool tree data member. More...
 
double * mp_fStormProbabilities
 Annual probability of the occurence of a storm of each return interval. More...
 
double * mp_fStormSeverities
 Severity of each storm return interval. More...
 
double * mp_fA
 Storm intercept for tree mortality (a) parameter. More...
 
double * mp_fB
 The "b" parameter for each species. More...
 
double * mp_fC
 The "d" parameter for each species. More...
 
double * mp_fMinDBH
 Minimum DBH for trees to be killed in storms. More...
 
short int * mp_iBa_xCodes
 Return codes for the "ba_x" package float data members of the "Windstorm Results" grid. More...
 
short int * mp_iDensity_xCodes
 Return codes for the "density_x" package float data members of the "Windstorm Results" grid. More...
 
char * m_cQuery
 String to pass to clTreePopulation::Find() in order to get the trees to apply damage to. More...
 
double m_fSSTPeriod
 SST periodicity (Sr) More...
 
double m_fSineD
 Sine function d. More...
 
double m_fSineF
 Sine function f. More...
 
double m_fSineG
 Sine function g. More...
 
double m_fTrendSlopeM
 Trend function slope (m) More...
 
double m_fTrendInterceptI
 Trend function intercept (i) More...
 
int m_iNumReturnIntervals
 The total number of storm return intervals. More...
 
int m_iFirstStormTimestep
 The timestep to start storms. More...
 
int m_iTotalNumSpecies
 Total number of species. More...
 
int m_iSeverityCode
 Return code for the "severity" package float data member of the "Windstorm Results" grid. More...
 
- Protected Attributes inherited from clBehaviorBase
short int m_iNumSpeciesTypeCombos
 How many type/species combos a behavior will act on. More...
 
short int m_iNumBehaviorSpecies
 How many distinct species are in the combo list - important for filling species-specific values from parameter file. More...
 
short int * mp_iWhatSpecies
 List of distinct species - for filling species-specific values from parameter file. More...
 
stcSpeciesTypeCombomp_whatSpeciesTypeCombos
 Array of species/type combos that the behavior will act on. More...
 
short int m_iNewTreeInts
 The number of new tree integer data members this behavior wants to add. More...
 
short int m_iNewTreeFloats
 The number of new tree float data members this behavior wants to add. More...
 
short int m_iNewTreeChars
 The number of new tree character data members this behavior wants to add. More...
 
short int m_iNewTreeBools
 The number of new tree boolean data members this behavior wants to add. More...
 
short int m_iBehaviorListNumber
 The number of this behavior in the behavior list, to differentiate between possible multiple copies of this behavior. More...
 
float m_fVersionNumber
 Version number - this will be rounded to 2 digits after the decimal place. More...
 
std::string m_sXMLRoot
 XML root that encloses the parameters for this behavior. More...
 
float m_fMinimumVersionNumber
 Minimum version number - this behavior will run parameter data for a file marked between this number and the current version number, inclusive. More...
 
- Protected Attributes inherited from clWorkerBase
std::string m_sNameString
 If a behavior has registered a command line command with the sim manager, this allows it to be called. More...
 
clSimManagermp_oSimManager
 Pointer to the simulation manager object. More...
 
int * mp_iAllowedFileTypes
 List of the input file types this object can handle. More...
 
int m_iNumAllowedTypes
 Number of input file types this object can handle. More...
 

Detailed Description

Windstorm version 2.0.

Windstorm creates storm events and kills trees as a result.

Windstorm defines 11 different storm return intervals: 1, 5, 10, 20, 40, 80, 160, 320, 640, 1280, and 2560. (This code was present in pre-6.0 versions of SORTIE as well. At that point, it did not have the 1-year return interval. I added it for testing purposes, and thought others might want access to it as well.) For each return interval, the user provides a storm severity, from 0 (no damage) to 1 (complete devastation).

The frequency of storms can optionally be cyclical (sinusoidal), with an optional overall trend. The actual probability of any storm that uses a cyclical storm regime is:

P'(Fi) = P(Fi) * ([d*sin(pi(x-g)/(2f))] + [mx + i])

where:

Each timestep, this behavior decides what storms will occur. The probability for each storm is calculated as in the equation above. SORTIE uses independent random number draws for each year of the timestep for each return interval. This means multiple storms can happen per timestep, and if the timestep length is more than one year, multiple storms of the same severity can happen.

A tree's probability of dying in a given storm is:

mort = exp(a + c * s * DBH b)/(1 + exp(a + c * s * DBH b))

where:

Each storm gets a crack at all the trees "independently" of the others. This means that, if two storms happen in one timestep, this behavior will cycle twice through all the trees in the plot and assess each one's mortality for the two storms separately. Of course, the two events cannot be truly independent, because the second storm can only kill trees not killed by the first storm.

Storms of severity below a certain minimum (currently set at 0.1) do not use the equation above; the storm severity is used directly as a mortality probability for trees.

Storms of severity 0 cannot occur. Any return interval with a severity of 0 is skipped.

The user has the option to not start storms at the beginning of the run. They can set a timestep for storms to start. Before this timestep no storms are allowed to occur.

This behavior will not kill trees below a minimum DBH set by the user. Because of the need for DBH, obviously seedlings are ignored. Snags and already-dead trees are ignored as well. All trees that die get their "dead" flags set to "storm". (This flag comes from mortality behaviors and is not added by this behavior.) This behavior then has nothing more to do with these trees.

Storm results are placed in a grid called "Windstorm Results".

This behavior's call string and name string are both "Windstorm".

Copyright 2011 Charles D. Canham

Author
Lora E. Murphy
Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)

Constructor & Destructor Documentation

◆ clWindstorm()

clWindstorm::clWindstorm ( clSimManager p_oSimManager)

Constructor.

Parameters
p_oSimManagerSim Manager object.

◆ ~clWindstorm()

clWindstorm::~clWindstorm ( )

Destructor.

Frees memory.

Member Function Documentation

◆ Action()

void clWindstorm::Action ( )
virtual

Does windstorms each timestep.

If the timestep has not yet reached the value in m_iFirstStormTimestep, then nothing happens. Otherwise: first, the "Windstorm Results" grid is cleared. Then the cyclical portion of storm probability is calculated. Then, a random number is drawn for each year of the timestep for each storm return interval. If the random number is less than the probability of that storm, then that storm occurs. For each storm that occurs, this will fetch all trees that can be killed in storms, and each that is not already dead has its probability of dying in the current storm calculated. A random number is compared to this probability to see if the tree dies. Those trees that die have their "dead" flag set to "storm".

Reimplemented from clBehaviorBase.

◆ DoGridSetup()

void clWindstorm::DoGridSetup ( )
protected

Sets up the "Windstorm Results" grid.

Any maps in the parameter file are ignored.

◆ FormatQueryString()

void clWindstorm::FormatQueryString ( clTreePopulation p_oPop)
protected

Formats the string in m_cQuery.

This value will be used in Action() to pass to clTreePopulation::Find() in order to get the trees to act on.

Parameters
p_oPopTree population object.

◆ GetData()

void clWindstorm::GetData ( xercesc::DOMDocument *  p_oDoc)
virtual

Does behavior setup.

Calls the following functions:

  1. ReadParFile()
  2. DoGridSetup()
  3. GetDeadCodes()
  4. FormatQueryString()
Parameters
p_oDocDOM tree of parsed input file.

Implements clWorkerBase.

◆ GetDeadCodes()

void clWindstorm::GetDeadCodes ( clTreePopulation p_oPop)
protected

Gets codes for the "dead" data member for each tree type to which this behavior applies.

Parameters
p_oPopTree population object.
Exceptions
modelErrif the codes are not available for every tree type to which this behavior is applied, or if this behavior is applied to seedlings.

◆ ReadParFile()

void clWindstorm::ReadParFile ( xercesc::DOMDocument *  p_oDoc,
clTreePopulation p_oPop 
)
protected

Reads in parameters from the parameter file.

This also calculates baseline storm probabilities.

Parameters
p_oDocDOM tree of parsed input file.
p_oPopTree population object.
Exceptions
modelErrif:
  • A value in the minimum DBH is less than 0
  • The timestep to start storms is less than 0
  • The storm severity for any return interval is not between 0 and 1
  • The storm periodicity is 0

Member Data Documentation

◆ m_cQuery

char* clWindstorm::m_cQuery
protected

String to pass to clTreePopulation::Find() in order to get the trees to apply damage to.

This will instigate a species/type search for all the species and types to which this behavior applies.

◆ m_fSineD

double clWindstorm::m_fSineD
protected

Sine function d.

◆ m_fSineF

double clWindstorm::m_fSineF
protected

Sine function f.

◆ m_fSineG

double clWindstorm::m_fSineG
protected

Sine function g.

◆ m_fSSTPeriod

double clWindstorm::m_fSSTPeriod
protected

SST periodicity (Sr)

◆ m_fTrendInterceptI

double clWindstorm::m_fTrendInterceptI
protected

Trend function intercept (i)

◆ m_fTrendSlopeM

double clWindstorm::m_fTrendSlopeM
protected

Trend function slope (m)

◆ m_iFirstStormTimestep

int clWindstorm::m_iFirstStormTimestep
protected

The timestep to start storms.

◆ m_iNumReturnIntervals

int clWindstorm::m_iNumReturnIntervals
protected

The total number of storm return intervals.

Hardcoded at 11.

◆ m_iSeverityCode

int clWindstorm::m_iSeverityCode
protected

Return code for the "severity" package float data member of the "Windstorm Results" grid.

◆ m_iTotalNumSpecies

int clWindstorm::m_iTotalNumSpecies
protected

Total number of species.

Primarily for the destructor.

◆ mp_fA

double* clWindstorm::mp_fA
protected

Storm intercept for tree mortality (a) parameter.

Array size is total # species.

◆ mp_fB

double* clWindstorm::mp_fB
protected

The "b" parameter for each species.

Array size is total # species.

◆ mp_fC

double* clWindstorm::mp_fC
protected

The "d" parameter for each species.

Array size is total # species.

◆ mp_fMinDBH

double* clWindstorm::mp_fMinDBH
protected

Minimum DBH for trees to be killed in storms.

Array size is total # species.

◆ mp_fStormProbabilities

double* clWindstorm::mp_fStormProbabilities
protected

Annual probability of the occurence of a storm of each return interval.

If the user has set the storm severity of a given return interval to 0, its probability is also set to 0. Array size is m_iNumReturnIntervals.

◆ mp_fStormSeverities

double* clWindstorm::mp_fStormSeverities
protected

Severity of each storm return interval.

Array size is m_iNumReturnIntervals.

◆ mp_iBa_xCodes

short int* clWindstorm::mp_iBa_xCodes
protected

Return codes for the "ba_x" package float data members of the "Windstorm Results" grid.

Array size is total # species.

◆ mp_iDeadCodes

int** clWindstorm::mp_iDeadCodes
protected

Return codes for the "dead" bool tree data member.

Array index one is sized m_iTotalNumSpecies; array index two is sized 2 (for saplings and adults).

◆ mp_iDensity_xCodes

short int* clWindstorm::mp_iDensity_xCodes
protected

Return codes for the "density_x" package float data members of the "Windstorm Results" grid.

Array size is total # species.

◆ mp_oResultsGrid

clGrid* clWindstorm::mp_oResultsGrid
protected

Windstorm Results grid This grid is named "Windstorm Results" and it contains the data for all storms that happened in the previous timestep.

There is one grid cell per plot, and this is not user-changeable.

Each storm gets one package. The packages occur in the order than the storms occurred in the timestep. Each package contains the following data members: One float called "severity", which holds the severity of the storm as a value from 0 to 1. Then there is one float per species called "ba_x", where x is the species number. This holds the amount of basal area per hectare killed in the storm for that species. Then there is another float per species called "density_x", where x is the species number. This holds the density per hectare killed in the storm for that species.


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