#include <Windstorm.h>
Public Member Functions | |
clWindstorm (clSimManager *p_oSimManager) | |
Constructor. | |
~clWindstorm () | |
Destructor. | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Does behavior setup. | |
void | Action () |
Does windstorms each timestep. | |
Protected Member Functions | |
void | DoGridSetup () |
Sets up the "Windstorm Results" grid. | |
void | ReadParFile (xercesc::DOMDocument *p_oDoc, clTreePopulation *p_oPop) |
Reads in parameters from the parameter file. | |
void | GetDeadCodes (clTreePopulation *p_oPop) |
Gets codes for the "dead" data member for each tree type to which this behavior applies. | |
void | FormatQueryString (clTreePopulation *p_oPop) |
Formats the string in m_cQuery. | |
Protected Attributes | |
clGridBase * | 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. | |
int ** | mp_iDeadCodes |
Return codes for the "dead" bool tree data member. | |
float * | mp_fStormProbabilities |
Annual probability of the occurence of a storm of each return interval. | |
float * | mp_fStormSeverities |
Severity of each storm return interval. | |
float * | mp_fA |
Storm intercept for tree mortality (a) parameter. | |
float * | mp_fB |
The "b" parameter for each species. | |
float * | mp_fC |
The "d" parameter for each species. | |
float * | mp_fMinDBH |
Minimum DBH for trees to be killed in storms. | |
short int * | mp_iBa_xCodes |
Return codes for the "ba_x" package float data members of the "Windstorm Results" grid. | |
short int * | mp_iDensity_xCodes |
Return codes for the "density_x" package float data members of the "Windstorm Results" grid. | |
char * | m_cQuery |
String to pass to clTreePopulation::Find() in order to get the trees to apply damage to. | |
float | m_fSSTPeriod |
SST periodicity (Sr). | |
float | m_fSineD |
Sine function d. | |
float | m_fSineF |
Sine function f. | |
float | m_fSineG |
Sine function g. | |
float | m_fTrendSlopeM |
Trend function slope (m). | |
float | m_fTrendInterceptI |
Trend function intercept (i). | |
int | m_iNumReturnIntervals |
The total number of storm return intervals. | |
int | m_iFirstStormTimestep |
The timestep to start storms. | |
int | m_iTotalNumSpecies |
Total number of species. | |
int | m_iSeverityCode |
Return code for the "severity" package float data member of the "Windstorm Results" grid. |
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:
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 true. (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 2006 Charles D. Canham
clWindstorm::clWindstorm | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clWindstorm::~clWindstorm | ( | ) |
Destructor.
Frees memory.
void clWindstorm::GetData | ( | xercesc::DOMDocument * | p_oDoc | ) | [virtual] |
Does behavior setup.
Calls the following functions:
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
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.
Reimplemented from clBehaviorBase.
void clWindstorm::DoGridSetup | ( | ) | [protected] |
Sets up the "Windstorm Results" grid.
Any maps in the parameter file are ignored.
void clWindstorm::ReadParFile | ( | xercesc::DOMDocument * | p_oDoc, | |
clTreePopulation * | p_oPop | |||
) | [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:
|
void clWindstorm::GetDeadCodes | ( | clTreePopulation * | p_oPop | ) | [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. |
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.
p_oPop | Tree population object. |
clGridBase* 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.
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).
float* 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.
float* clWindstorm::mp_fStormSeverities [protected] |
Severity of each storm return interval.
Array size is m_iNumReturnIntervals.
float* clWindstorm::mp_fA [protected] |
Storm intercept for tree mortality (a) parameter.
Array size is total # species.
float* clWindstorm::mp_fB [protected] |
The "b" parameter for each species.
Array size is total # species.
float* clWindstorm::mp_fC [protected] |
The "d" parameter for each species.
Array size is total # species.
float* clWindstorm::mp_fMinDBH [protected] |
Minimum DBH for trees to be killed in storms.
Array size is total # species.
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.
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.
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.
float clWindstorm::m_fSSTPeriod [protected] |
SST periodicity (Sr).
float clWindstorm::m_fSineD [protected] |
Sine function d.
float clWindstorm::m_fSineF [protected] |
Sine function f.
float clWindstorm::m_fSineG [protected] |
Sine function g.
float clWindstorm::m_fTrendSlopeM [protected] |
Trend function slope (m).
float clWindstorm::m_fTrendInterceptI [protected] |
Trend function intercept (i).
int clWindstorm::m_iNumReturnIntervals [protected] |
The total number of storm return intervals.
Hardcoded at 11.
int clWindstorm::m_iFirstStormTimestep [protected] |
The timestep to start storms.
int clWindstorm::m_iTotalNumSpecies [protected] |
Total number of species.
Primarily for the destructor.
int clWindstorm::m_iSeverityCode [protected] |
Return code for the "severity" package float data member of the "Windstorm Results" grid.