Rev 445 | Rev 449 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | |||
90 | Werner | 2 | #ifndef SPECIES_H |
3 | #define SPECIES_H |
||
38 | Werner | 4 | |
103 | Werner | 5 | |
91 | Werner | 6 | #include "expression.h" |
7 | |||
103 | Werner | 8 | #include "speciesset.h" |
102 | Werner | 9 | |
91 | Werner | 10 | class StampContainer; // forwards |
38 | Werner | 11 | class Stamp; |
91 | Werner | 12 | |
103 | Werner | 13 | |
446 | werner | 14 | /// parameters for establishment |
15 | struct EstablishmentParameters |
||
16 | { |
||
17 | double min_temp; //degC |
||
18 | int chill_requirement; // days of chilling requirement |
||
19 | int GDD_min, GDD_max; // GDD thresholds |
||
20 | double GDD_baseTemperature; // for GDD-calc: GDD=sum(T - baseTemp) |
||
21 | int bud_birst; // GDDs needed until bud burst |
||
22 | int frost_free; // minimum number of annual frost-free days required |
||
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), |
||
25 | bud_birst(255), frost_free(65), frost_tolerance(0.5) {} |
||
26 | }; |
||
27 | |||
28 | |||
90 | Werner | 29 | class Species |
38 | Werner | 30 | { |
31 | public: |
||
387 | werner | 32 | Species(SpeciesSet *set) { mSet = set; mIndex=set->count(); mSeedDispersal=0; } |
391 | werner | 33 | ~Species(); |
34 | // maintenance |
||
35 | void setup(); |
||
415 | werner | 36 | void newYear(); |
391 | werner | 37 | |
226 | werner | 38 | const SpeciesSet *speciesSet() const { return mSet; } |
91 | Werner | 39 | // properties |
391 | werner | 40 | SeedDispersal *seedDispersal() const { return mSeedDispersal; } |
91 | Werner | 41 | /// @property id 4-character unique identification of the tree species |
111 | Werner | 42 | const QString &id() const { return mId; } |
91 | Werner | 43 | /// the full name (e.g. Picea Abies) of the species |
111 | Werner | 44 | const QString &name() const { return mName; } |
145 | Werner | 45 | int index() const { return mIndex; } ///< unique index of species within current set |
179 | werner | 46 | bool active() const { return true; } ///< active??? todo! |
236 | werner | 47 | int phenologyClass() const { return mPhenologyClass; } ///< phenology class defined in project file. class 0 = evergreen |
48 | bool isConiferous() const { return mConiferous; } |
||
49 | bool isEvergreen() const { return mEvergreen; } |
||
415 | werner | 50 | bool isSeedYear() const { return mIsSeedYear; } |
136 | Werner | 51 | |
391 | werner | 52 | |
91 | Werner | 53 | // calculations: allometries |
145 | Werner | 54 | double biomassFoliage(const double dbh) const; |
55 | double biomassWoody(const double dbh) const; |
||
56 | double biomassRoot(const double dbh) const; |
||
57 | double allometricRatio_wf() const { return mWoody_b / mFoliage_b; } |
||
58 | double allometricFractionStem(const double dbh) const; |
||
276 | werner | 59 | double finerootFoliageRatio() const { return mFinerootFoliageRatio; } ///< ratio of fineroot mass (kg) to foliage mass (kg) |
136 | Werner | 60 | |
116 | Werner | 61 | // turnover rates |
145 | Werner | 62 | double turnoverLeaf() const { return mTurnoverLeaf; } |
63 | double turnoverRoot() const { return mTurnoverRoot; } |
||
119 | Werner | 64 | // hd-values |
425 | werner | 65 | void hdRange(const double dbh, double &rMinHD, double &rMaxHD) const; |
125 | Werner | 66 | // growth |
145 | Werner | 67 | double volumeFactor() const { return mVolumeFactor; } ///< factor for volume calculation: V = factor * D^2*H (incorporates density and the form of the bole) |
68 | double density() const { return mWoodDensity; } ///< density of stem wood [kg/m3] |
||
69 | double specificLeafArea() const { return mSpecificLeafArea; } |
||
159 | werner | 70 | // mortality |
71 | double deathProb_intrinsic() const { return mDeathProb_intrinsic; } |
||
308 | werner | 72 | inline double deathProb_stress(const double &stress_index) const; |
169 | werner | 73 | // aging |
425 | werner | 74 | double aging(const float height, const int age) const; |
388 | werner | 75 | int estimateAge(const float height) const;///< estimate age for a tree with the current age |
387 | werner | 76 | // regeneration |
445 | werner | 77 | void seedProduction(const int age, const QPoint &position_index); |
387 | werner | 78 | void setSeedDispersal(SeedDispersal *seed_dispersal) {mSeedDispersal=seed_dispersal; } |
209 | werner | 79 | // environmental responses |
80 | double vpdResponse(const double &vpd) const; |
||
266 | werner | 81 | inline double temperatureResponse(const double &delayed_temp) const; |
209 | werner | 82 | double nitrogenResponse(const double &availableNitrogen) const { return mSet->nitrogenResponse(availableNitrogen, mRespNitrogenClass); } |
236 | werner | 83 | double canopyConductance() const { return mMaxCanopyConductance; } ///< maximum canopy conductance in m/s |
266 | werner | 84 | inline double soilwaterResponse(const double &psi_kPa) const; ///< input: matrix potential (kPa) (e.g. -15) |
274 | werner | 85 | double lightResponse(const double lightResourceIndex) {return mSet->lightResponse(lightResourceIndex, mLightResponseClass); } |
304 | werner | 86 | double psiMin() const { return mPsiMin; } |
445 | werner | 87 | // parameters for seed dispersal |
88 | void treeMigKernel(double &ras1, double &ras2, double &ks) const { ras1=mTM_as1; ras2=mTM_as2; ks=mTM_ks; } |
||
89 | double fecundity_m2() const { return mFecundity_m2; } |
||
90 | double nonSeedYearFraction() const { return mNonSeedYearFraction; } |
||
446 | werner | 91 | const EstablishmentParameters &establishmentParameters() const { return mEstablishmentParams; } |
110 | Werner | 92 | |
136 | Werner | 93 | const Stamp* stamp(const float dbh, const float height) const { return mLIPs.stamp(dbh, height);} |
38 | Werner | 94 | private: |
90 | Werner | 95 | Q_DISABLE_COPY(Species); |
136 | Werner | 96 | // helpers during setup |
236 | werner | 97 | bool boolVar(const QString s) { return mSet->var(s).toBool(); } ///< during setup: get value of variable @p s as a boolean variable. |
136 | Werner | 98 | double doubleVar(const QString s) { return mSet->var(s).toDouble(); }///< during setup: get value of variable @p s as a double. |
236 | werner | 99 | int intVar(const QString s) { return mSet->var(s).toInt(); } ///< during setup: get value of variable @p s as an integer. |
136 | Werner | 100 | QString stringVar(const QString s) { return mSet->var(s).toString(); } ///< during setup: get value of variable @p s as a string. |
101 | |||
91 | Werner | 102 | SpeciesSet *mSet; ///< ptr. to the "parent" set |
136 | Werner | 103 | StampContainer mLIPs; ///< ptr to the container of the LIP-pattern |
91 | Werner | 104 | QString mId; |
105 | QString mName; |
||
111 | Werner | 106 | int mIndex; ///< internal index within the SpeciesSet |
236 | werner | 107 | bool mConiferous; ///< true if confierous species (vs. broadleaved) |
108 | bool mEvergreen; ///< true if evergreen species |
||
136 | Werner | 109 | // biomass allometries: |
110 | double mFoliage_a, mFoliage_b; ///< allometry (biomass = a * dbh^b) for foliage |
||
111 | double mWoody_a, mWoody_b; ///< allometry (biomass = a * dbh^b) for woody compartments aboveground |
||
112 | double mRoot_a, mRoot_b; ///< allometry (biomass = a * dbh^b) for roots (compound, fine and coarse roots as one pool) |
||
113 | double mBranch_a, mBranch_b; ///< allometry (biomass = a * dbh^b) for branches |
||
114 | |||
110 | Werner | 115 | double mSpecificLeafArea; ///< conversion factor from kg OTS to m2 LeafArea |
116 | Werner | 116 | // turnover rates |
117 | double mTurnoverLeaf; ///< yearly turnover rate leafs |
||
118 | double mTurnoverRoot; ///< yearly turnover rate root |
||
276 | werner | 119 | double mFinerootFoliageRatio; ///< ratio of fineroot mass (kg) to foliage mass (kg) |
119 | Werner | 120 | // height-diameter-relationships |
121 | Expression mHDlow; ///< minimum HD-relation as f(d) (open grown tree) |
||
122 | Expression mHDhigh; ///< maximum HD-relation as f(d) |
||
125 | Werner | 123 | // stem density and taper |
124 | double mWoodDensity; ///< density of the wood [kg/m3] |
||
125 | double mFormFactor; ///< taper form factor of the stem [-] used for volume / stem-mass calculation calculation |
||
126 | double mVolumeFactor; ///< factor for volume calculation |
||
159 | werner | 127 | // mortality |
128 | double mDeathProb_intrinsic; ///< prob. of intrinsic death per year [0..1] |
||
129 | double mDeathProb_stress; ///< max. prob. of death per year when tree suffering maximum stress |
||
169 | werner | 130 | // Aging |
131 | double mMaximumAge; ///< maximum age of species (years) |
||
132 | double mMaximumHeight; ///< maximum height of species (m) for aging |
||
214 | werner | 133 | Expression mAging; |
209 | werner | 134 | // environmental responses |
135 | double mRespVpdExponent; ///< exponent in vpd response calculation (Mäkela 2008) |
||
136 | double mRespTempMin; ///< temperature response calculation offset |
||
137 | double mRespTempMax; ///< temperature response calculation: saturation point for temp. response |
||
138 | double mRespNitrogenClass; ///< nitrogen response class (1..3). fractional values (e.g. 1.2) are interpolated. |
||
304 | werner | 139 | double mPsiMin; ///< minimum water potential (MPa), i.e. wilting point (is below zero!) |
236 | werner | 140 | // water |
141 | double mMaxCanopyConductance; ///< maximum canopy conductance for transpiration (m/s) |
||
226 | werner | 142 | int mPhenologyClass; |
274 | werner | 143 | double mLightResponseClass; ///< light response class (1..5) (1=shade intolerant) |
387 | werner | 144 | // regeneration |
145 | SeedDispersal *mSeedDispersal; ///< link to the seed dispersal map of the species |
||
445 | werner | 146 | int mMaturityYears; ///< a tree produces seeds if it is older than this parameter |
415 | werner | 147 | double mSeedYearProbability; ///< probability that a year is a seed year (=1/avg.timespan between seedyears) |
148 | bool mIsSeedYear; ///< true, if current year is a seed year. see also: |
||
445 | werner | 149 | double mNonSeedYearFraction; ///< fraction of the seed production in non-seed-years |
150 | // regeneration - seed dispersal |
||
151 | double mFecundity_m2; ///< "surviving seeds" (cf. Moles et al) per m2, see also http://iland.boku.ac.at/fecundity |
||
152 | double mTM_as1; ///< seed dispersal paramaters (treemig) |
||
153 | double mTM_as2; ///< seed dispersal paramaters (treemig) |
||
154 | double mTM_ks; ///< seed dispersal paramaters (treemig) |
||
446 | werner | 155 | EstablishmentParameters mEstablishmentParams; |
445 | werner | 156 | |
38 | Werner | 157 | }; |
158 | |||
40 | Werner | 159 | |
119 | Werner | 160 | // inlined functions... |
425 | werner | 161 | inline void Species::hdRange(const double dbh, double &rLowHD, double &rHighHD) const |
119 | Werner | 162 | { |
163 | rLowHD = mHDlow.calculate(dbh); |
||
164 | rHighHD = mHDhigh.calculate(dbh); |
||
165 | } |
||
209 | werner | 166 | /** vpdResponse calculates response on vpd. |
167 | Input: vpd [kPa]*/ |
||
168 | inline double Species::vpdResponse(const double &vpd) const |
||
169 | { |
||
170 | return exp(mRespVpdExponent * vpd); |
||
171 | } |
||
119 | Werner | 172 | |
209 | werner | 173 | /** temperatureResponse calculates response on delayed daily temperature. |
174 | Input: average temperature [°C] |
||
175 | Note: slightly different from Mäkela 2008: the maximum parameter (Sk) in iLand is interpreted as the absolute |
||
176 | temperature yielding a response of 1; in Mäkela 2008, Sk is the width of the range (relative to the lower threhold) |
||
177 | */ |
||
178 | inline double Species::temperatureResponse(const double &delayed_temp) const |
||
179 | { |
||
180 | double x = qMax(delayed_temp-mRespTempMin, 0.); |
||
181 | x = qMin(x/(mRespTempMax-mRespTempMin), 1.); |
||
182 | return x; |
||
183 | } |
||
266 | werner | 184 | /** soilwaterResponse is a function of the current matrix potential of the soil. |
209 | werner | 185 | |
266 | werner | 186 | */ |
187 | inline double Species::soilwaterResponse(const double &psi_kPa) const |
||
188 | { |
||
189 | const double psi_mpa = psi_kPa / 1000.; // convert to MPa |
||
304 | werner | 190 | double result = limit( 1. - psi_mpa / mPsiMin, 0., 1.); |
266 | werner | 191 | return result; |
192 | } |
||
193 | |||
308 | werner | 194 | /** calculate probabilty of death based on the current stress index. */ |
195 | inline double Species::deathProb_stress(const double &stress_index) const |
||
196 | { |
||
197 | if (stress_index==0) |
||
198 | return 0.; |
||
199 | double result = 1. - exp(-mDeathProb_stress*stress_index); |
||
200 | return result; |
||
201 | } |
||
202 | |||
90 | Werner | 203 | #endif // SPECIES_H |