Subversion Repositories public iLand

Rev

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

Rev 534 Rev 535
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
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
91
    double snagKyr() const { return mSnagKYR; } ///< decomposition rate for refractory matter (woody) used in soil model
92
92
93
    // hd-values
93
    // hd-values
94
    void hdRange(const double dbh, double &rMinHD, double &rMaxHD) const;
94
    void hdRange(const double dbh, double &rMinHD, double &rMaxHD) const;
95
    // growth
95
    // growth
96
    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)
97
    double density() const { return mWoodDensity; } ///< density of stem wood [kg/m3]
97
    double density() const { return mWoodDensity; } ///< density of stem wood [kg/m3]
98
    double specificLeafArea() const { return mSpecificLeafArea; }
98
    double specificLeafArea() const { return mSpecificLeafArea; }
99
    // mortality
99
    // mortality
100
    double deathProb_intrinsic() const { return mDeathProb_intrinsic; }
100
    double deathProb_intrinsic() const { return mDeathProb_intrinsic; }
101
    inline double deathProb_stress(const double &stress_index) const;
101
    inline double deathProb_stress(const double &stress_index) const;
102
    // aging
102
    // aging
103
    double aging(const float height, const int age) const;
103
    double aging(const float height, const int age) const;
104
    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
105
    // regeneration
105
    // regeneration
106
    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);
107
    void setSeedDispersal(SeedDispersal *seed_dispersal) {mSeedDispersal=seed_dispersal; }
107
    void setSeedDispersal(SeedDispersal *seed_dispersal) {mSeedDispersal=seed_dispersal; }
108
    // environmental responses
108
    // environmental responses
109
    double vpdResponse(const double &vpd) const;
109
    double vpdResponse(const double &vpd) const;
110
    inline double temperatureResponse(const double &delayed_temp) const;
110
    inline double temperatureResponse(const double &delayed_temp) const;
111
    double nitrogenResponse(const double &availableNitrogen) const { return mSet->nitrogenResponse(availableNitrogen, mRespNitrogenClass); }
111
    double nitrogenResponse(const double &availableNitrogen) const { return mSet->nitrogenResponse(availableNitrogen, mRespNitrogenClass); }
112
    double canopyConductance() const { return mMaxCanopyConductance; } ///< maximum canopy conductance in m/s
112
    double canopyConductance() const { return mMaxCanopyConductance; } ///< maximum canopy conductance in m/s
113
    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)
114
    double lightResponse(const double lightResourceIndex) const {return mSet->lightResponse(lightResourceIndex, mLightResponseClass); }
114
    double lightResponse(const double lightResourceIndex) const {return mSet->lightResponse(lightResourceIndex, mLightResponseClass); }
115
    double psiMin() const { return mPsiMin; }
115
    double psiMin() const { return mPsiMin; }
116
    // parameters for seed dispersal
116
    // parameters for seed dispersal
117
    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; }
118
    double fecundity_m2() const { return mFecundity_m2; }
118
    double fecundity_m2() const { return mFecundity_m2; }
119
    double nonSeedYearFraction() const { return mNonSeedYearFraction; }
119
    double nonSeedYearFraction() const { return mNonSeedYearFraction; }
120
    const EstablishmentParameters &establishmentParameters() const { return mEstablishmentParams; }
120
    const EstablishmentParameters &establishmentParameters() const { return mEstablishmentParams; }
121
    const SaplingGrowthParameters &saplingGrowthParameters() const { return mSaplingGrowthParams; }
121
    const SaplingGrowthParameters &saplingGrowthParameters() const { return mSaplingGrowthParams; }
122
122
123
    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);}
124
private:
124
private:
125
    Q_DISABLE_COPY(Species);
125
    Q_DISABLE_COPY(Species);
126
    // helpers during setup
126
    // helpers during setup
127
    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.
128
    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.
129
    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.
130
    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.
131
    MTRand *mRandomGenerator;
131
    MTRand *mRandomGenerator;
132
132
133
    SpeciesSet *mSet; ///< ptr. to the "parent" set
133
    SpeciesSet *mSet; ///< ptr. to the "parent" set
134
    StampContainer mLIPs; ///< ptr to the container of the LIP-pattern
134
    StampContainer mLIPs; ///< ptr to the container of the LIP-pattern
135
    QString mId;
135
    QString mId;
136
    QString mName;
136
    QString mName;
137
    QColor mDisplayColor;
137
    QColor mDisplayColor;
138
    int mIndex; ///< internal index within the SpeciesSet
138
    int mIndex; ///< internal index within the SpeciesSet
139
    bool mConiferous; ///< true if confierous species (vs. broadleaved)
139
    bool mConiferous; ///< true if confierous species (vs. broadleaved)
140
    bool mEvergreen; ///< true if evergreen species
140
    bool mEvergreen; ///< true if evergreen species
141
    // biomass allometries:
141
    // biomass allometries:
142
    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
143
    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
144
    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)
145
    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
146
    // cn-ratios
146
    // cn-ratios
147
    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'
148
148
149
    double mSpecificLeafArea; ///< conversion factor from kg OTS to m2 LeafArea
149
    double mSpecificLeafArea; ///< conversion factor from kg OTS to m2 LeafArea
150
    // turnover rates
150
    // turnover rates
151
    double mTurnoverLeaf; ///< yearly turnover rate leafs
151
    double mTurnoverLeaf; ///< yearly turnover rate leafs
152
    double mTurnoverRoot; ///< yearly turnover rate root
152
    double mTurnoverRoot; ///< yearly turnover rate root
153
    double mFinerootFoliageRatio; ///< ratio of fineroot mass (kg) to foliage mass (kg)
153
    double mFinerootFoliageRatio; ///< ratio of fineroot mass (kg) to foliage mass (kg)
154
    // height-diameter-relationships
154
    // height-diameter-relationships
155
    Expression mHDlow; ///< minimum HD-relation as f(d) (open grown tree)
155
    Expression mHDlow; ///< minimum HD-relation as f(d) (open grown tree)
156
    Expression mHDhigh; ///< maximum HD-relation as f(d)
156
    Expression mHDhigh; ///< maximum HD-relation as f(d)
157
    // stem density and taper
157
    // stem density and taper
158
    double mWoodDensity; ///< density of the wood [kg/m3]
158
    double mWoodDensity; ///< density of the wood [kg/m3]
159
    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
160
    double mVolumeFactor; ///< factor for volume calculation
160
    double mVolumeFactor; ///< factor for volume calculation
161
    // snag dynamics
161
    // snag dynamics
162
    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
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
164
    double mSnagKYR; ///< decomposition rate for refractory matter (woody) used in soil model
165
    double mSnagHalflife; ///< half-life-period of standing snags (years)
165
    double mSnagHalflife; ///< half-life-period of standing snags (years)
166
    // mortality
166
    // mortality
167
    double mDeathProb_intrinsic;  ///< prob. of intrinsic death per year [0..1]
167
    double mDeathProb_intrinsic;  ///< prob. of intrinsic death per year [0..1]
168
    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
169
    // Aging
169
    // Aging
170
    double mMaximumAge; ///< maximum age of species (years)
170
    double mMaximumAge; ///< maximum age of species (years)
171
    double mMaximumHeight; ///< maximum height of species (m) for aging
171
    double mMaximumHeight; ///< maximum height of species (m) for aging
172
    Expression mAging;
172
    Expression mAging;
173
    // environmental responses
173
    // environmental responses
174
    double mRespVpdExponent; ///< exponent in vpd response calculation (Mäkela 2008)
174
    double mRespVpdExponent; ///< exponent in vpd response calculation (Mäkela 2008)
175
    double mRespTempMin; ///< temperature response calculation offset
175
    double mRespTempMin; ///< temperature response calculation offset
176
    double mRespTempMax; ///< temperature response calculation: saturation point for temp. response
176
    double mRespTempMax; ///< temperature response calculation: saturation point for temp. response
177
    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.
178
    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!)
179
    // water
179
    // water
180
    double mMaxCanopyConductance; ///< maximum canopy conductance for transpiration (m/s)
180
    double mMaxCanopyConductance; ///< maximum canopy conductance for transpiration (m/s)
181
    int mPhenologyClass;
181
    int mPhenologyClass;
182
    double mLightResponseClass; ///< light response class (1..5) (1=shade intolerant)
182
    double mLightResponseClass; ///< light response class (1..5) (1=shade intolerant)
183
    // regeneration
183
    // regeneration
184
    SeedDispersal *mSeedDispersal; ///< link to the seed dispersal map of the species
184
    SeedDispersal *mSeedDispersal; ///< link to the seed dispersal map of the species
185
    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
186
    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)
187
    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:
188
    double mNonSeedYearFraction;  ///< fraction of the seed production in non-seed-years
188
    double mNonSeedYearFraction;  ///< fraction of the seed production in non-seed-years
189
    // regeneration - seed dispersal
189
    // regeneration - seed dispersal
190
    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
191
    double mTM_as1; ///< seed dispersal paramaters (treemig)
191
    double mTM_as1; ///< seed dispersal paramaters (treemig)
192
    double mTM_as2; ///< seed dispersal paramaters (treemig)
192
    double mTM_as2; ///< seed dispersal paramaters (treemig)
193
    double mTM_ks; ///< seed dispersal paramaters (treemig)
193
    double mTM_ks; ///< seed dispersal paramaters (treemig)
194
    EstablishmentParameters mEstablishmentParams; ///< collection of parameters used for establishment
194
    EstablishmentParameters mEstablishmentParams; ///< collection of parameters used for establishment
195
    SaplingGrowthParameters mSaplingGrowthParams; ///< collection of parameters for sapling growth
195
    SaplingGrowthParameters mSaplingGrowthParams; ///< collection of parameters for sapling growth
196
196
197
};
197
};
198
198
199
199
200
// inlined functions...
200
// inlined functions...
201
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
202
{
202
{
203
    rLowHD = mHDlow.calculate(dbh);
203
    rLowHD = mHDlow.calculate(dbh);
204
    rHighHD = mHDhigh.calculate(dbh);
204
    rHighHD = mHDhigh.calculate(dbh);
205
}
205
}
206
/** vpdResponse calculates response on vpd.
206
/** vpdResponse calculates response on vpd.
207
    Input: vpd [kPa]*/
207
    Input: vpd [kPa]*/
208
inline double Species::vpdResponse(const double &vpd) const
208
inline double Species::vpdResponse(const double &vpd) const
209
{
209
{
210
    return exp(mRespVpdExponent * vpd);
210
    return exp(mRespVpdExponent * vpd);
211
}
211
}
212
212
213
/** temperatureResponse calculates response on delayed daily temperature.
213
/** temperatureResponse calculates response on delayed daily temperature.
214
    Input: average temperature [°C]
214
    Input: average temperature [°C]
215
    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
216
          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)
217
*/
217
*/
218
inline double Species::temperatureResponse(const double &delayed_temp) const
218
inline double Species::temperatureResponse(const double &delayed_temp) const
219
{
219
{
220
    double x = qMax(delayed_temp-mRespTempMin, 0.);
220
    double x = qMax(delayed_temp-mRespTempMin, 0.);
221
    x = qMin(x/(mRespTempMax-mRespTempMin), 1.);
221
    x = qMin(x/(mRespTempMax-mRespTempMin), 1.);
222
    return x;
222
    return x;
223
}
223
}
224
/** 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.
225

225

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