SORTIE Core C++ Documentation
|
Windstorm version 2.0. More...
#include <Windstorm.h>
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... | |
clSimManager * | GetSimManager () |
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 | |
clGrid * | mp_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... | |
stcSpeciesTypeCombo * | mp_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... | |
clSimManager * | mp_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... | |
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:
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:
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
clWindstorm::clWindstorm | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clWindstorm::~clWindstorm | ( | ) |
Destructor.
Frees memory.
|
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.
|
protected |
Sets up the "Windstorm Results" grid.
Any maps in the parameter file are ignored.
|
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.
p_oPop | Tree population object. |
|
virtual |
Does behavior setup.
Calls the following functions:
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
|
protected |
Gets codes for the "dead" data member for each tree type to which this behavior applies.
p_oPop | Tree population object. |
modelErr | if the codes are not available for every tree type to which this behavior is applied, or if this behavior is applied to seedlings. |
|
protected |
Reads in parameters from the parameter file.
This also calculates baseline storm probabilities.
p_oDoc | DOM tree of parsed input file. |
p_oPop | Tree population object. |
modelErr | if:
|
|
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.
|
protected |
Sine function d.
|
protected |
Sine function f.
|
protected |
Sine function g.
|
protected |
SST periodicity (Sr)
|
protected |
Trend function intercept (i)
|
protected |
Trend function slope (m)
|
protected |
The timestep to start storms.
|
protected |
The total number of storm return intervals.
Hardcoded at 11.
|
protected |
Return code for the "severity" package float data member of the "Windstorm Results" grid.
|
protected |
Total number of species.
Primarily for the destructor.
|
protected |
Storm intercept for tree mortality (a) parameter.
Array size is total # species.
|
protected |
The "b" parameter for each species.
Array size is total # species.
|
protected |
The "d" parameter for each species.
Array size is total # species.
|
protected |
Minimum DBH for trees to be killed in storms.
Array size is total # species.
|
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.
|
protected |
Severity of each storm return interval.
Array size is m_iNumReturnIntervals.
|
protected |
Return codes for the "ba_x" package float data members of the "Windstorm Results" grid.
Array size is total # species.
|
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).
|
protected |
Return codes for the "density_x" package float data members of the "Windstorm Results" grid.
Array size is total # species.
|
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.