Subversion Repositories public iLand

Rev

Rev 528 | Rev 535 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 528 Rev 534
1
Redirecting to URL 'https://iland.boku.ac.at/svn/iland/tags/release_1.0/src/core/species.h':
1
Redirecting to URL 'https://iland.boku.ac.at/svn/iland/tags/release_1.0/src/core/species.h':
2
#ifndef SPECIES_H
2
#ifndef SPECIES_H
3
#define SPECIES_H
3
#define SPECIES_H
4
4
5
5
6
#include "expression.h"
6
#include "expression.h"
7
#include "globalsettings.h"
7
#include "globalsettings.h"
8
#include "speciesset.h"
8
#include "speciesset.h"
9
9
10
class StampContainer; // forwards
10
class StampContainer; // forwards
11
class Stamp;
11
class Stamp;
12
12
13
13
14
/// parameters for establishment
14
/// parameters for establishment
15
struct EstablishmentParameters
15
struct EstablishmentParameters
16
{
16
{
17
    double min_temp; //degC
17
    double min_temp; //degC
18
    int chill_requirement; // days of chilling requirement
18
    int chill_requirement; // days of chilling requirement
19
    int GDD_min, GDD_max; // GDD thresholds
19
    int GDD_min, GDD_max; // GDD thresholds
20
    double GDD_baseTemperature; // for GDD-calc: GDD=sum(T - baseTemp)
20
    double GDD_baseTemperature; // for GDD-calc: GDD=sum(T - baseTemp)
21
    int bud_birst; // GDDs needed until bud burst
21
    int bud_birst; // GDDs needed until bud burst
22
    int frost_free; // minimum number of annual frost-free days required
22
    int frost_free; // minimum number of annual frost-free days required
23
    double frost_tolerance; //factor in growing season frost tolerance calculation
23
    double frost_tolerance; //factor in growing season frost tolerance calculation
24
    EstablishmentParameters(): min_temp(-37), chill_requirement(56), GDD_min(177), GDD_max(3261), GDD_baseTemperature(3.4),
24
    EstablishmentParameters(): min_temp(-37), chill_requirement(56), GDD_min(177), GDD_max(3261), GDD_baseTemperature(3.4),
25
                               bud_birst(255), frost_free(65), frost_tolerance(0.5) {}
25
                               bud_birst(255), frost_free(65), frost_tolerance(0.5) {}
26
};
26
};
27
27
28
/// parameters for sapling growth
28
/// parameters for sapling growth
29
struct SaplingGrowthParameters
29
struct SaplingGrowthParameters
30
{
30
{
31
    Expression heightGrowthPotential; ///< formula that expresses height growth potential
31
    Expression heightGrowthPotential; ///< formula that expresses height growth potential
32
    int maxStressYears; ///< trees die, if they are "stressed" for this number of consectuive years
32
    int maxStressYears; ///< trees die, if they are "stressed" for this number of consectuive years
33
    double stressThreshold; ///< tree is considered as "stressed" if f_env_yr is below that threhold
33
    double stressThreshold; ///< tree is considered as "stressed" if f_env_yr is below that threhold
34
    float hdSapling; ///< fixed height-diameter ratio used for saplings
34
    float hdSapling; ///< fixed height-diameter ratio used for saplings
35
    double ReinekesR; ///< Reinekes R, i.e. maximum stem number for a dg of 25cm
35
    double ReinekesR; ///< Reinekes R, i.e. maximum stem number for a dg of 25cm
36
    double referenceRatio; ///< f_ref (eq. 3) -> ratio reference site / optimum site
36
    double referenceRatio; ///< f_ref (eq. 3) -> ratio reference site / optimum site
37
    SaplingGrowthParameters(): maxStressYears(3), stressThreshold(0.1), hdSapling(80.f), ReinekesR(1450.), referenceRatio(1.) {}
37
    SaplingGrowthParameters(): maxStressYears(3), stressThreshold(0.1), hdSapling(80.f), ReinekesR(1450.), referenceRatio(1.) {}
38
    /// represented stem number by one cohort (using Reinekes Law):
38
    /// represented stem number by one cohort (using Reinekes Law):
39
    double representedStemNumber(const double dbh) const { return ReinekesR*pow(dbh/25., -1.605) / double(cPxPerHectare); }
39
    double representedStemNumber(const double dbh) const { return ReinekesR*pow(dbh/25., -1.605) / double(cPxPerHectare); }
40
};
40
};
41
41
42
42
43
class Species
43
class Species
44
{
44
{
45
public:
45
public:
46
    Species(SpeciesSet *set) { mSet = set; mIndex=set->count(); mSeedDispersal=0; mRandomGenerator=0; }
46
    Species(SpeciesSet *set) { mSet = set; mIndex=set->count(); mSeedDispersal=0; mRandomGenerator=0; }
47
    ~Species();
47
    ~Species();
48
    // maintenance
48
    // maintenance
49
    void setup();
49
    void setup();
50
    void newYear();
50
    void newYear();
51
    // getter for a thread-local random number generator object. if setRandomGenerator() is used, this saves some overhead
51
    // getter for a thread-local random number generator object. if setRandomGenerator() is used, this saves some overhead
52
    MTRand &randomGenerator() const { if (mRandomGenerator) return *mRandomGenerator; else return GlobalSettings::instance()->randomGenerator(); }
52
    MTRand &randomGenerator() const { if (mRandomGenerator) return *mRandomGenerator; else return GlobalSettings::instance()->randomGenerator(); }
53
    void setRandomGenerator() { mRandomGenerator = &GlobalSettings::instance()->randomGenerator(); } // fetch random generator of the current thread
53
    void setRandomGenerator() { mRandomGenerator = &GlobalSettings::instance()->randomGenerator(); } // fetch random generator of the current thread
54
54
55
55
56
    const SpeciesSet *speciesSet() const { return mSet; }
56
    const SpeciesSet *speciesSet() const { return mSet; }
57
    // properties
57
    // properties
58
    SeedDispersal *seedDispersal() const { return mSeedDispersal; }
58
    SeedDispersal *seedDispersal() const { return mSeedDispersal; }
59
    /// @property id 4-character unique identification of the tree species
59
    /// @property id 4-character unique identification of the tree species
60
    const QString &id() const { return mId; }
60
    const QString &id() const { return mId; }
61
    /// the full name (e.g. Picea Abies) of the species
61
    /// the full name (e.g. Picea Abies) of the species
62
    const QString &name() const { return mName; }
62
    const QString &name() const { return mName; }
63
    const QColor displayColor() const { return mDisplayColor; }
63
    const QColor displayColor() const { return mDisplayColor; }
64
    int index() const { return mIndex; } ///< unique index of species within current set
64
    int index() const { return mIndex; } ///< unique index of species within current set
65
    bool active() const { return true; } ///< active??? todo!
65
    bool active() const { return true; } ///< active??? todo!
66
    int phenologyClass() const { return mPhenologyClass; } ///< phenology class defined in project file. class 0 = evergreen
66
    int phenologyClass() const { return mPhenologyClass; } ///< phenology class defined in project file. class 0 = evergreen
67
    bool isConiferous() const { return mConiferous; }
67
    bool isConiferous() const { return mConiferous; }
68
    bool isEvergreen() const { return mEvergreen; }
68
    bool isEvergreen() const { return mEvergreen; }
69
    bool isSeedYear() const { return mIsSeedYear; }
69
    bool isSeedYear() const { return mIsSeedYear; }
70
70
71
71
72
    // calculations: allometries
72
    // calculations: allometries
73
    double biomassFoliage(const double dbh) const;
73
    double biomassFoliage(const double dbh) const;
74
    double biomassWoody(const double dbh) const;
74
    double biomassWoody(const double dbh) const;
75
    double biomassRoot(const double dbh) const;
75
    double biomassRoot(const double dbh) const;
76
    double biomassBranch(const double dbh) const;
76
    double biomassBranch(const double dbh) const;
77
    double allometricRatio_wf() const { return mWoody_b / mFoliage_b; }
77
    double allometricRatio_wf() const { return mWoody_b / mFoliage_b; }
78
    double allometricFractionStem(const double dbh) const;
78
    double allometricFractionStem(const double dbh) const;
79
    double finerootFoliageRatio() const { return mFinerootFoliageRatio; } ///< ratio of fineroot mass (kg) to foliage mass (kg)
79
    double finerootFoliageRatio() const { return mFinerootFoliageRatio; } ///< ratio of fineroot mass (kg) to foliage mass (kg)
80
    // cn ratios
80
    // cn ratios
81
    double cnFoliage() const { return mCNFoliage; }
81
    double cnFoliage() const { return mCNFoliage; }
82
    double cnFineroot() const { return mCNFineroot; }
82
    double cnFineroot() const { return mCNFineroot; }
83
    double cnWood() const { return mCNWood; }
83
    double cnWood() const { return mCNWood; }
84
    // turnover rates
84
    // turnover rates
85
    double turnoverLeaf() const { return mTurnoverLeaf; }
85
    double turnoverLeaf() const { return mTurnoverLeaf; }
86
    double turnoverRoot() const { return mTurnoverRoot; }
86
    double turnoverRoot() const { return mTurnoverRoot; }
87
    // snags
87
    // snags
88
    double snagKSW() const { return mSnagKSW; }
-
 
-
 
88
    double snagKsw() const { return mSnagKSW; }
89
    double snagHalflife() const { return mSnagHalflife; }
89
    double snagHalflife() const { return mSnagHalflife; }
-
 
90
    double snagKyl() const { return mSnagKYL; } ///< decomposition rate for labile matter (litter) used in soil model
-
 
91
    double snagKyr() const { return mSnagKYR; } ///< decomposition rate for refractory matter (woody) used in soil model
-
 
92
90
    // hd-values
93
    // hd-values
91
    void hdRange(const double dbh, double &rMinHD, double &rMaxHD) const;
94
    void hdRange(const double dbh, double &rMinHD, double &rMaxHD) const;
92
    // growth
95
    // growth
93
    double volumeFactor() const { return mVolumeFactor; } ///< factor for volume calculation: V = factor * D^2*H (incorporates density and the form of the bole)
96
    double volumeFactor() const { return mVolumeFactor; } ///< factor for volume calculation: V = factor * D^2*H (incorporates density and the form of the bole)
94
    double density() const { return mWoodDensity; } ///< density of stem wood [kg/m3]
97
    double density() const { return mWoodDensity; } ///< density of stem wood [kg/m3]
95
    double specificLeafArea() const { return mSpecificLeafArea; }
98
    double specificLeafArea() const { return mSpecificLeafArea; }
96
    // mortality
99
    // mortality
97
    double deathProb_intrinsic() const { return mDeathProb_intrinsic; }
100
    double deathProb_intrinsic() const { return mDeathProb_intrinsic; }
98
    inline double deathProb_stress(const double &stress_index) const;
101
    inline double deathProb_stress(const double &stress_index) const;
99
    // aging
102
    // aging
100
    double aging(const float height, const int age) const;
103
    double aging(const float height, const int age) const;
101
    int estimateAge(const float height) const;///< estimate age for a tree with the current age
104
    int estimateAge(const float height) const;///< estimate age for a tree with the current age
102
    // regeneration
105
    // regeneration
103
    void seedProduction(const int age, const float height, const QPoint &position_index);
106
    void seedProduction(const int age, const float height, const QPoint &position_index);
104
    void setSeedDispersal(SeedDispersal *seed_dispersal) {mSeedDispersal=seed_dispersal; }
107
    void setSeedDispersal(SeedDispersal *seed_dispersal) {mSeedDispersal=seed_dispersal; }
105
    // environmental responses
108
    // environmental responses
106
    double vpdResponse(const double &vpd) const;
109
    double vpdResponse(const double &vpd) const;
107
    inline double temperatureResponse(const double &delayed_temp) const;
110
    inline double temperatureResponse(const double &delayed_temp) const;
108
    double nitrogenResponse(const double &availableNitrogen) const { return mSet->nitrogenResponse(availableNitrogen, mRespNitrogenClass); }
111
    double nitrogenResponse(const double &availableNitrogen) const { return mSet->nitrogenResponse(availableNitrogen, mRespNitrogenClass); }
109
    double canopyConductance() const { return mMaxCanopyConductance; } ///< maximum canopy conductance in m/s
112
    double canopyConductance() const { return mMaxCanopyConductance; } ///< maximum canopy conductance in m/s
110
    inline double soilwaterResponse(const double &psi_kPa) const; ///< input: matrix potential (kPa) (e.g. -15)
113
    inline double soilwaterResponse(const double &psi_kPa) const; ///< input: matrix potential (kPa) (e.g. -15)
111
    double lightResponse(const double lightResourceIndex) const {return mSet->lightResponse(lightResourceIndex, mLightResponseClass); }
114
    double lightResponse(const double lightResourceIndex) const {return mSet->lightResponse(lightResourceIndex, mLightResponseClass); }
112
    double psiMin() const { return mPsiMin; }
115
    double psiMin() const { return mPsiMin; }
113
    // parameters for seed dispersal
116
    // parameters for seed dispersal
114
    void treeMigKernel(double &ras1, double &ras2, double &ks) const { ras1=mTM_as1; ras2=mTM_as2; ks=mTM_ks; }
117
    void treeMigKernel(double &ras1, double &ras2, double &ks) const { ras1=mTM_as1; ras2=mTM_as2; ks=mTM_ks; }
115
    double fecundity_m2() const { return mFecundity_m2; }
118
    double fecundity_m2() const { return mFecundity_m2; }
116
    double nonSeedYearFraction() const { return mNonSeedYearFraction; }
119
    double nonSeedYearFraction() const { return mNonSeedYearFraction; }
117
    const EstablishmentParameters &establishmentParameters() const { return mEstablishmentParams; }
120
    const EstablishmentParameters &establishmentParameters() const { return mEstablishmentParams; }
118
    const SaplingGrowthParameters &saplingGrowthParameters() const { return mSaplingGrowthParams; }
121
    const SaplingGrowthParameters &saplingGrowthParameters() const { return mSaplingGrowthParams; }
119
122
120
    const Stamp* stamp(const float dbh, const float height) const { return mLIPs.stamp(dbh, height);}
123
    const Stamp* stamp(const float dbh, const float height) const { return mLIPs.stamp(dbh, height);}
121
private:
124
private:
122
    Q_DISABLE_COPY(Species);
125
    Q_DISABLE_COPY(Species);
123
    // helpers during setup
126
    // helpers during setup
124
    bool boolVar(const QString s) { return mSet->var(s).toBool(); } ///< during setup: get value of variable @p s as a boolean variable.
127
    bool boolVar(const QString s) { return mSet->var(s).toBool(); } ///< during setup: get value of variable @p s as a boolean variable.
125
    double doubleVar(const QString s) { return mSet->var(s).toDouble(); }///< during setup: get value of variable @p s as a double.
128
    double doubleVar(const QString s) { return mSet->var(s).toDouble(); }///< during setup: get value of variable @p s as a double.
126
    int intVar(const QString s) { return mSet->var(s).toInt(); } ///< during setup: get value of variable @p s as an integer.
129
    int intVar(const QString s) { return mSet->var(s).toInt(); } ///< during setup: get value of variable @p s as an integer.
127
    QString stringVar(const QString s) { return mSet->var(s).toString(); } ///< during setup: get value of variable @p s as a string.
130
    QString stringVar(const QString s) { return mSet->var(s).toString(); } ///< during setup: get value of variable @p s as a string.
128
    MTRand *mRandomGenerator;
131
    MTRand *mRandomGenerator;
129
132
130
    SpeciesSet *mSet; ///< ptr. to the "parent" set
133
    SpeciesSet *mSet; ///< ptr. to the "parent" set
131
    StampContainer mLIPs; ///< ptr to the container of the LIP-pattern
134
    StampContainer mLIPs; ///< ptr to the container of the LIP-pattern
132
    QString mId;
135
    QString mId;
133
    QString mName;
136
    QString mName;
134
    QColor mDisplayColor;
137
    QColor mDisplayColor;
135
    int mIndex; ///< internal index within the SpeciesSet
138
    int mIndex; ///< internal index within the SpeciesSet
136
    bool mConiferous; ///< true if confierous species (vs. broadleaved)
139
    bool mConiferous; ///< true if confierous species (vs. broadleaved)
137
    bool mEvergreen; ///< true if evergreen species
140
    bool mEvergreen; ///< true if evergreen species
138
    // biomass allometries:
141
    // biomass allometries:
139
    double mFoliage_a, mFoliage_b;  ///< allometry (biomass = a * dbh^b) for foliage
142
    double mFoliage_a, mFoliage_b;  ///< allometry (biomass = a * dbh^b) for foliage
140
    double mWoody_a, mWoody_b; ///< allometry (biomass = a * dbh^b) for woody compartments aboveground
143
    double mWoody_a, mWoody_b; ///< allometry (biomass = a * dbh^b) for woody compartments aboveground
141
    double mRoot_a, mRoot_b; ///< allometry (biomass = a * dbh^b) for roots (compound, fine and coarse roots as one pool)
144
    double mRoot_a, mRoot_b; ///< allometry (biomass = a * dbh^b) for roots (compound, fine and coarse roots as one pool)
142
    double mBranch_a, mBranch_b; ///< allometry (biomass = a * dbh^b) for branches
145
    double mBranch_a, mBranch_b; ///< allometry (biomass = a * dbh^b) for branches
143
    // cn-ratios
146
    // cn-ratios
144
    double mCNFoliage, mCNFineroot, mCNWood; ///< CN-ratios for various tissue types; stem, branches and coarse roots are pooled as 'wood'
147
    double mCNFoliage, mCNFineroot, mCNWood; ///< CN-ratios for various tissue types; stem, branches and coarse roots are pooled as 'wood'
145
148
146
    double mSpecificLeafArea; ///< conversion factor from kg OTS to m2 LeafArea
149
    double mSpecificLeafArea; ///< conversion factor from kg OTS to m2 LeafArea
147
    // turnover rates
150
    // turnover rates
148
    double mTurnoverLeaf; ///< yearly turnover rate leafs
151
    double mTurnoverLeaf; ///< yearly turnover rate leafs
149
    double mTurnoverRoot; ///< yearly turnover rate root
152
    double mTurnoverRoot; ///< yearly turnover rate root
150
    double mFinerootFoliageRatio; ///< ratio of fineroot mass (kg) to foliage mass (kg)
153
    double mFinerootFoliageRatio; ///< ratio of fineroot mass (kg) to foliage mass (kg)
151
    // height-diameter-relationships
154
    // height-diameter-relationships
152
    Expression mHDlow; ///< minimum HD-relation as f(d) (open grown tree)
155
    Expression mHDlow; ///< minimum HD-relation as f(d) (open grown tree)
153
    Expression mHDhigh; ///< maximum HD-relation as f(d)
156
    Expression mHDhigh; ///< maximum HD-relation as f(d)
154
    // stem density and taper
157
    // stem density and taper
155
    double mWoodDensity; ///< density of the wood [kg/m3]
158
    double mWoodDensity; ///< density of the wood [kg/m3]
156
    double mFormFactor; ///< taper form factor of the stem [-] used for volume / stem-mass calculation calculation
159
    double mFormFactor; ///< taper form factor of the stem [-] used for volume / stem-mass calculation calculation
157
    double mVolumeFactor; ///< factor for volume calculation
160
    double mVolumeFactor; ///< factor for volume calculation
158
    // snag dynamics
161
    // snag dynamics
159
    double mSnagKSW; ///< standing woody debris (swd) decomposition rate
162
    double mSnagKSW; ///< standing woody debris (swd) decomposition rate
-
 
163
    double mSnagKYL; ///< decomposition rate for labile matter (litter) used in soil model
-
 
164
    double mSnagKYR; ///< decomposition rate for refractory matter (woody) used in soil model
160
    double mSnagHalflife; ///< half-life-period of standing snags (years)
165
    double mSnagHalflife; ///< half-life-period of standing snags (years)
161
    // mortality
166
    // mortality
162
    double mDeathProb_intrinsic;  ///< prob. of intrinsic death per year [0..1]
167
    double mDeathProb_intrinsic;  ///< prob. of intrinsic death per year [0..1]
163
    double mDeathProb_stress; ///< max. prob. of death per year when tree suffering maximum stress
168
    double mDeathProb_stress; ///< max. prob. of death per year when tree suffering maximum stress
164
    // Aging
169
    // Aging
165
    double mMaximumAge; ///< maximum age of species (years)
170
    double mMaximumAge; ///< maximum age of species (years)
166
    double mMaximumHeight; ///< maximum height of species (m) for aging
171
    double mMaximumHeight; ///< maximum height of species (m) for aging
167
    Expression mAging;
172
    Expression mAging;
168
    // environmental responses
173
    // environmental responses
169
    double mRespVpdExponent; ///< exponent in vpd response calculation (Mäkela 2008)
174
    double mRespVpdExponent; ///< exponent in vpd response calculation (Mäkela 2008)
170
    double mRespTempMin; ///< temperature response calculation offset
175
    double mRespTempMin; ///< temperature response calculation offset
171
    double mRespTempMax; ///< temperature response calculation: saturation point for temp. response
176
    double mRespTempMax; ///< temperature response calculation: saturation point for temp. response
172
    double mRespNitrogenClass; ///< nitrogen response class (1..3). fractional values (e.g. 1.2) are interpolated.
177
    double mRespNitrogenClass; ///< nitrogen response class (1..3). fractional values (e.g. 1.2) are interpolated.
173
    double mPsiMin; ///< minimum water potential (MPa), i.e. wilting point (is below zero!)
178
    double mPsiMin; ///< minimum water potential (MPa), i.e. wilting point (is below zero!)
174
    // water
179
    // water
175
    double mMaxCanopyConductance; ///< maximum canopy conductance for transpiration (m/s)
180
    double mMaxCanopyConductance; ///< maximum canopy conductance for transpiration (m/s)
176
    int mPhenologyClass;
181
    int mPhenologyClass;
177
    double mLightResponseClass; ///< light response class (1..5) (1=shade intolerant)
182
    double mLightResponseClass; ///< light response class (1..5) (1=shade intolerant)
178
    // regeneration
183
    // regeneration
179
    SeedDispersal *mSeedDispersal; ///< link to the seed dispersal map of the species
184
    SeedDispersal *mSeedDispersal; ///< link to the seed dispersal map of the species
180
    int mMaturityYears; ///< a tree produces seeds if it is older than this parameter
185
    int mMaturityYears; ///< a tree produces seeds if it is older than this parameter
181
    double mSeedYearProbability; ///< probability that a year is a seed year (=1/avg.timespan between seedyears)
186
    double mSeedYearProbability; ///< probability that a year is a seed year (=1/avg.timespan between seedyears)
182
    bool mIsSeedYear; ///< true, if current year is a seed year. see also:
187
    bool mIsSeedYear; ///< true, if current year is a seed year. see also:
183
    double mNonSeedYearFraction;  ///< fraction of the seed production in non-seed-years
188
    double mNonSeedYearFraction;  ///< fraction of the seed production in non-seed-years
184
    // regeneration - seed dispersal
189
    // regeneration - seed dispersal
185
    double mFecundity_m2; ///< "surviving seeds" (cf. Moles et al) per m2, see also http://iland.boku.ac.at/fecundity
190
    double mFecundity_m2; ///< "surviving seeds" (cf. Moles et al) per m2, see also http://iland.boku.ac.at/fecundity
186
    double mTM_as1; ///< seed dispersal paramaters (treemig)
191
    double mTM_as1; ///< seed dispersal paramaters (treemig)
187
    double mTM_as2; ///< seed dispersal paramaters (treemig)
192
    double mTM_as2; ///< seed dispersal paramaters (treemig)
188
    double mTM_ks; ///< seed dispersal paramaters (treemig)
193
    double mTM_ks; ///< seed dispersal paramaters (treemig)
189
    EstablishmentParameters mEstablishmentParams; ///< collection of parameters used for establishment
194
    EstablishmentParameters mEstablishmentParams; ///< collection of parameters used for establishment
190
    SaplingGrowthParameters mSaplingGrowthParams; ///< collection of parameters for sapling growth
195
    SaplingGrowthParameters mSaplingGrowthParams; ///< collection of parameters for sapling growth
191
196
192
};
197
};
193
198
194
199
195
// inlined functions...
200
// inlined functions...
196
inline void Species::hdRange(const double dbh, double &rLowHD, double &rHighHD) const
201
inline void Species::hdRange(const double dbh, double &rLowHD, double &rHighHD) const
197
{
202
{
198
    rLowHD = mHDlow.calculate(dbh);
203
    rLowHD = mHDlow.calculate(dbh);
199
    rHighHD = mHDhigh.calculate(dbh);
204
    rHighHD = mHDhigh.calculate(dbh);
200
}
205
}
201
/** vpdResponse calculates response on vpd.
206
/** vpdResponse calculates response on vpd.
202
    Input: vpd [kPa]*/
207
    Input: vpd [kPa]*/
203
inline double Species::vpdResponse(const double &vpd) const
208
inline double Species::vpdResponse(const double &vpd) const
204
{
209
{
205
    return exp(mRespVpdExponent * vpd);
210
    return exp(mRespVpdExponent * vpd);
206
}
211
}
207
212
208
/** temperatureResponse calculates response on delayed daily temperature.
213
/** temperatureResponse calculates response on delayed daily temperature.
209
    Input: average temperature [°C]
214
    Input: average temperature [°C]
210
    Note: slightly different from Mäkela 2008: the maximum parameter (Sk) in iLand is interpreted as the absolute
215
    Note: slightly different from Mäkela 2008: the maximum parameter (Sk) in iLand is interpreted as the absolute
211
          temperature yielding a response of 1; in Mäkela 2008, Sk is the width of the range (relative to the lower threhold)
216
          temperature yielding a response of 1; in Mäkela 2008, Sk is the width of the range (relative to the lower threhold)
212
*/
217
*/
213
inline double Species::temperatureResponse(const double &delayed_temp) const
218
inline double Species::temperatureResponse(const double &delayed_temp) const
214
{
219
{
215
    double x = qMax(delayed_temp-mRespTempMin, 0.);
220
    double x = qMax(delayed_temp-mRespTempMin, 0.);
216
    x = qMin(x/(mRespTempMax-mRespTempMin), 1.);
221
    x = qMin(x/(mRespTempMax-mRespTempMin), 1.);
217
    return x;
222
    return x;
218
}
223
}
219
/** soilwaterResponse is a function of the current matrix potential of the soil.
224
/** soilwaterResponse is a function of the current matrix potential of the soil.
220

225

221
  */
226
  */
222
inline double Species::soilwaterResponse(const double &psi_kPa) const
227
inline double Species::soilwaterResponse(const double &psi_kPa) const
223
{
228
{
224
    const double psi_mpa = psi_kPa / 1000.; // convert to MPa
229
    const double psi_mpa = psi_kPa / 1000.; // convert to MPa
225
    double result = limit( 1. - psi_mpa / mPsiMin, 0., 1.);
230
    double result = limit( 1. - psi_mpa / mPsiMin, 0., 1.);
226
    return result;
231
    return result;
227
}
232
}
228
233
229
/** calculate probabilty of death based on the current stress index. */
234
/** calculate probabilty of death based on the current stress index. */
230
inline double Species::deathProb_stress(const double &stress_index) const
235
inline double Species::deathProb_stress(const double &stress_index) const
231
{
236
{
232
    if (stress_index==0)
237
    if (stress_index==0)
233
        return 0.;
238
        return 0.;
234
    double result = 1. - exp(-mDeathProb_stress*stress_index);
239
    double result = 1. - exp(-mDeathProb_stress*stress_index);
235
    return result;
240
    return result;
236
}
241
}
237
242
238
#endif // SPECIES_H
243
#endif // SPECIES_H
239
 
244