Subversion Repositories public iLand

Rev

Rev 1221 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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