Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
671 | werner | 1 | /******************************************************************************************** |
2 | ** iLand - an individual based forest landscape and disturbance model |
||
3 | ** http://iland.boku.ac.at |
||
4 | ** Copyright (C) 2009- Werner Rammer, Rupert Seidl |
||
5 | ** |
||
6 | ** This program is free software: you can redistribute it and/or modify |
||
7 | ** it under the terms of the GNU General Public License as published by |
||
8 | ** the Free Software Foundation, either version 3 of the License, or |
||
9 | ** (at your option) any later version. |
||
10 | ** |
||
11 | ** This program is distributed in the hope that it will be useful, |
||
12 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
13 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
14 | ** GNU General Public License for more details. |
||
15 | ** |
||
16 | ** You should have received a copy of the GNU General Public License |
||
17 | ** along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
18 | ********************************************************************************************/ |
||
19 | |||
211 | werner | 20 | #ifndef PHENOLOGY_H |
21 | #define PHENOLOGY_H |
||
214 | werner | 22 | class Climate; |
211 | werner | 23 | |
24 | class Phenology |
||
25 | { |
||
26 | public: |
||
436 | werner | 27 | Phenology(const Climate* climate) {mClimate=climate; mId=0; mMinVpd=mMaxVpd=mMinDayLength=mMaxDayLength=mMinTemp=mMaxTemp=0.; mDayStart=0;mDayEnd=365;mChillDaysBefore=-1; mChillDaysAfter=0;mChillDaysAfterLastYear=0;} |
255 | werner | 28 | Phenology(const int id, const Climate* climate, const double minVpd, const double maxVpd, |
211 | werner | 29 | const double minDayLength, const double maxDayLength, |
214 | werner | 30 | const double minTemp, const double maxTemp): mId(id), mClimate(climate), mMinVpd(minVpd), mMaxVpd(maxVpd), |
434 | werner | 31 | mMinDayLength(minDayLength), mMaxDayLength(maxDayLength), mMinTemp(minTemp), mMaxTemp(maxTemp),mChillDaysAfter(0),mChillDaysAfterLastYear(0) {} |
211 | werner | 32 | // access |
486 | werner | 33 | int id() const { return mId; } |
211 | werner | 34 | /// calculate the phenology for the current year |
35 | void calculate(); |
||
226 | werner | 36 | /// get result of phenology calcualtion for this year (a pointer to a array of 12 values between 0..1: 0: no days with foliage) |
211 | werner | 37 | const double *month() const { return mPhenoFraction; } |
226 | werner | 38 | int vegetationPeriodLength() const { return mDayEnd - mDayStart; } ///< length of vegetation period in days, returs 365 for evergreens |
39 | int vegetationPeriodStart() const { return mDayStart; } ///< day of year when vegeation period starts |
||
40 | int vegetationPeriodEnd() const { return mDayEnd; } ///< day of year when vegeation period stops |
||
434 | werner | 41 | // chilling days |
42 | /// get days of year that meet chilling requirements: the days in the autumn of the last year + the days of this spring season |
||
43 | int chillingDays() const { return mChillDaysBefore + mChillDaysAfterLastYear; } |
||
44 | int chillingDaysLastYear() const { return mChillDaysAfterLastYear; } |
||
211 | werner | 45 | |
46 | |||
47 | private: |
||
48 | int mId; ///< identifier of this Phenology group |
||
255 | werner | 49 | const Climate *mClimate; ///< link to relevant climate source |
211 | werner | 50 | double mMinVpd; ///< minimum vpd [kPa] |
51 | double mMaxVpd; ///< maximum vpd [kPa] |
||
52 | double mMinDayLength; ///< minimum daylength [hours] |
||
53 | double mMaxDayLength; ///< maximum daylength [hours] |
||
1057 | werner | 54 | double mMinTemp; ///< minimum temperature [deg] |
55 | double mMaxTemp; ///< maximum temperature [deg] |
||
211 | werner | 56 | double mPhenoFraction[12]; ///< fraction [0..1] of month i [0..11] to are inside the vegetation period, i.e. have leafs |
226 | werner | 57 | int mDayStart; ///< start of vegetation period (in day of year) |
58 | int mDayEnd; ///< end of vegetation period (in days of year, 1.1. = 0) |
||
434 | werner | 59 | // some special calculations used for establishment |
436 | werner | 60 | void calculateChillDays(const int end_of_season=-1); |
1103 | werner | 61 | int mChillDaysBefore, mChillDaysAfter; ///< number of days that meet chilling requirements (>-5 deg C, <+5 deg C) before and after the vegetation period in this yeaer |
434 | werner | 62 | int mChillDaysAfterLastYear; ///< chilling days of the last years autumn/winter |
211 | werner | 63 | }; |
64 | |||
65 | #endif // PHENOLOGY_H |