Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
671 werner 2
/********************************************************************************************
3
**    iLand - an individual based forest landscape and disturbance model
4
**    http://iland.boku.ac.at
5
**    Copyright (C) 2009-  Werner Rammer, Rupert Seidl
6
**
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
9
**    the Free Software Foundation, either version 3 of the License, or
10
**    (at your option) any later version.
11
**
12
**    This program is distributed in the hope that it will be useful,
13
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
**    GNU General Public License for more details.
16
**
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/>.
19
********************************************************************************************/
20
 
211 werner 21
#ifndef PHENOLOGY_H
22
#define PHENOLOGY_H
214 werner 23
class Climate;
211 werner 24
 
25
class Phenology
26
{
27
public:
436 werner 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;}
255 werner 29
    Phenology(const int id, const Climate* climate, const double minVpd, const double maxVpd,
211 werner 30
              const double minDayLength, const double maxDayLength,
214 werner 31
              const double minTemp, const double maxTemp): mId(id), mClimate(climate), mMinVpd(minVpd), mMaxVpd(maxVpd),
434 werner 32
                                mMinDayLength(minDayLength), mMaxDayLength(maxDayLength), mMinTemp(minTemp), mMaxTemp(maxTemp),mChillDaysAfter(0),mChillDaysAfterLastYear(0) {}
211 werner 33
    // access
486 werner 34
    int id() const { return mId; }
211 werner 35
    /// calculate the phenology for the current year
36
    void calculate();
226 werner 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)
211 werner 38
    const double *month() const { return mPhenoFraction; }
226 werner 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
41
    int vegetationPeriodEnd() const { return mDayEnd; } ///< day of year when vegeation period stops
434 werner 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
44
    int chillingDays() const { return mChillDaysBefore + mChillDaysAfterLastYear; }
45
    int chillingDaysLastYear() const { return mChillDaysAfterLastYear; }
211 werner 46
 
47
 
48
private:
49
    int mId; ///< identifier of this Phenology group
255 werner 50
    const Climate *mClimate; ///< link to relevant climate source
211 werner 51
    double mMinVpd; ///< minimum vpd [kPa]
52
    double mMaxVpd; ///< maximum vpd [kPa]
53
    double mMinDayLength; ///< minimum daylength [hours]
54
    double mMaxDayLength; ///< maximum daylength [hours]
1057 werner 55
    double mMinTemp; ///< minimum temperature [deg]
56
    double mMaxTemp; ///< maximum temperature [deg]
211 werner 57
    double mPhenoFraction[12]; ///< fraction [0..1] of month i [0..11] to are inside the vegetation period, i.e. have leafs
226 werner 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)
434 werner 60
    // some special calculations used for establishment
436 werner 61
    void calculateChillDays(const int end_of_season=-1);
1103 werner 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
434 werner 63
    int mChillDaysAfterLastYear; ///< chilling days of the last years autumn/winter
211 werner 64
};
65
 
66
#endif // PHENOLOGY_H