clWeibullSnagMort Class Reference

Snag mortality using Weibull function, V 1.1. More...

#include <WeibullSnagMort.h>

Inheritance diagram for clWeibullSnagMort:

clMortalityBase clBehaviorBase clWorkerBase

List of all members.

Public Member Functions

 clWeibullSnagMort (clSimManager *p_oSimManager)
 Constructor.
 ~clWeibullSnagMort ()
 Destructor.
void DoShellSetup (xercesc::DOMDocument *p_oDoc)
 Performs specific setup for this behavior.
deadCode DoMort (clTree *p_oTree, const float &fDbh, const short int &iSpecies)
 Calculates whether a snag lives or dies.

Protected Member Functions

void ReadParameterFile (xercesc::DOMDocument *p_oDoc)
 Reads required data from the parameter file.
void FillDeathProbArray ()
 Declares and populates the mp_fProbabilityOfDeath array.
float CalculateDeathProbability (int iSizeClass, int iSpecies, int iAge)
 Calculates a probability of death for snags of a certain age.
void GetAgeCodes ()
 Gets the data member return codes for the "age" snag data member.
void ValidateTypes ()
 Makes sure that this behavior has only been applied to snags.

Protected Attributes

float *** mp_fProbabilityOfDeath
 Pre-calculated probabilities of death.
float ** mp_fAParameter
 Parameter "a" in Weibull function.
float ** mp_fBParameter
 Parameter "b" in Weibull function.
float ** mp_fSnagSizeClasses
 Upper limit of DBH in each snag size class.
float m_fNumYearsPerTimestep
 Number of years per timestep.
short int * mp_iAgeCodes
 Data member codes for "age" snag member for each behavior species.
short int * mp_iIndexes
 For accessing arrays.
short int m_iMaxPrecalcAge
 Max age, in timesteps, that the probability of death is pre-calculated.
short int m_iNumSizeClasses
 Number of snag size classes for which separate parameters can be defined.


Detailed Description

Snag mortality using Weibull function, V 1.1.

Snags are standing dead trees, and as such "mortality" is something of a misnomer. However, since this behavior fits in with the other mortality behaviors, we will continue to use that naming scheme.

Snag death really means that a snag falls over. The probability that this will happen to any one snag is a function of its age as a snag. The percentage standing of a snag population is:

Percent standing = 100 * e(-(a*Timeb))
where Time is in years.

The rate at which snags fall over changes with snag size. This behavior allows the definition of three snag size classes. Each size class can take a different set of a and b values.

This behavior can only be applied to snags.

The namestring for this behavior is "weibsnagmortshell". The parameter file call string is "weibull snag mortality".

Copyright 2004 Charles D. Canham.

Author:
Lora E. Murphy

Edit history:
-----------------
June 23, 2004 - Created (LEM)
March 8, 2005 - Updated to version 1.1, by making the size classes species-specific. (LEM)
February 8, 2008 - Changed mortality flags from simple booleans to reason codes (LEM)

Constructor & Destructor Documentation

clWeibullSnagMort::clWeibullSnagMort ( clSimManager p_oSimManager  ) 

Constructor.

Sets the namestring and nulls all pointers.

clWeibullSnagMort::~clWeibullSnagMort (  ) 

Destructor.

Frees memory.


Member Function Documentation

void clWeibullSnagMort::DoShellSetup ( xercesc::DOMDocument *  p_oDoc  )  [virtual]

Performs specific setup for this behavior.

  1. Calls ReadParameterFile() in order to get parameter file data.
  2. Calls CalculateDeathProbabilities().
  3. Calls GetAgeCodes().

Parameters:
p_oDoc Parsed DOM tree of parameter file.

Reimplemented from clMortalityBase.

deadCode clWeibullSnagMort::DoMort ( clTree p_oTree,
const float &  fDbh,
const short int &  iSpecies 
) [virtual]

Calculates whether a snag lives or dies.

If the snag age in timesteps is less than m_iMaxPrecalcAge, then a random number is compared to the appropriate value in mp_fProbabilityOfDeath. If it is greater than that age, then its probability of death is calculated directly from the Weibull function. In each case, if the random number is less than or equal to the probability of death, then the snag dies.

Parameters:
fDbh DBH of tree being evaluated
p_oTree Tree being evaluated
iSpecies Species of the tree being evaluated
Returns:

natural if the tree is to "die", notdead if it "lives".

Implements clMortalityBase.

void clWeibullSnagMort::ReadParameterFile ( xercesc::DOMDocument *  p_oDoc  )  [protected]

Reads required data from the parameter file.

Parameters:
p_oDoc Parsed DOM tree of parameter file.
Exceptions:
modelErr if:
  • any of the parameters are missing
  • the size classes overlap
  • any value for "a" is zero (this will cause a math error if true)
  • any value for "a" is negative, if "b" is not a whole number (this will cause a math error if true)
Because of the need for backward compatibility with version 1.0, this will accept the size class definitions as single values if they are written this way.

void clWeibullSnagMort::FillDeathProbArray (  )  [protected]

Declares and populates the mp_fProbabilityOfDeath array.

For each timestep t, it calculates the probability of mortality between t and t-1 using CalculateDeathProbability().

float clWeibullSnagMort::CalculateDeathProbability ( int  iSizeClass,
int  iSpecies,
int  iAge 
) [protected]

Calculates a probability of death for snags of a certain age.

The probability is calculated as since the last timestep. If Ft is the value of the function above at timestep t, then the probability Pt of mortality between timesteps t-1 and t is:

Pt = (1-(1-Ft)/(1-Ft-1))
Any probability value greater than 1 - 1.0E-5 is returned as one, and less than 1.0E-05 is returned as 0. This function will handle conversions of ages from years to timesteps.

If the age is within the first timestep, then the probability is the value of the function at time t.

Parameters:
iSizeClass Size class number, as 0, 1, or 2. THIS NUMBER IS NOT CHECKED FOR VALIDITY.
iSpecies Species number. NOT species index, just plain old species.
iAge Age in years.
Returns:
Probability of death, between 0 and 1 inclusive.

void clWeibullSnagMort::GetAgeCodes (  )  [protected]

Gets the data member return codes for the "age" snag data member.

Return codes are captured in the mp_iAgeCodes array.

void clWeibullSnagMort::ValidateTypes (  )  [protected]

Makes sure that this behavior has only been applied to snags.

Exceptions:
modelErr if any tree type besides snags has been applied to this behavior.


Member Data Documentation

Pre-calculated probabilities of death.

Array is m_iNumSizeClasses by number of behavior species by m_iMaxPrecalcAge.

float** clWeibullSnagMort::mp_fAParameter [protected]

Parameter "a" in Weibull function.

Array size is m_iNumSizeClasses by number of behavior species.

float** clWeibullSnagMort::mp_fBParameter [protected]

Parameter "b" in Weibull function.

Array size is m_iNumSizeClasses by number of behavior species.

Upper limit of DBH in each snag size class.

This array is sized m_iNumSizeClasses by number of behavior species. The value in the third size class bucket for each species is ignored since it is always effectively infinity.

Number of years per timestep.

short int* clWeibullSnagMort::mp_iAgeCodes [protected]

Data member codes for "age" snag member for each behavior species.

short int* clWeibullSnagMort::mp_iIndexes [protected]

For accessing arrays.

One per species.

short int clWeibullSnagMort::m_iMaxPrecalcAge [protected]

Max age, in timesteps, that the probability of death is pre-calculated.

short int clWeibullSnagMort::m_iNumSizeClasses [protected]

Number of snag size classes for which separate parameters can be defined.


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

Generated on Tue Apr 19 13:56:19 2011 for SORTIE Core C++ Documentation by  doxygen 1.5.6