Subversion Repositories public iLand

Rev

Rev 671 | Rev 698 | Go to most recent revision | 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
 
113 Werner 21
#include "global.h"
22
#include "production3pg.h"
23
 
189 iland 24
#include "resourceunit.h"
113 Werner 25
#include "species.h"
226 werner 26
#include "speciesresponse.h"
27
#include "model.h"
113 Werner 28
 
29
Production3PG::Production3PG()
30
{
226 werner 31
    mResponse=0;
440 werner 32
    mEnvYear = 0.;
113 Werner 33
}
34
 
226 werner 35
/**
36
  This is based on the utilizable photosynthetic active radiation.
37
  @sa http://iland.boku.ac.at/primary+production
227 werner 38
  The resulting radiation is MJ/m2       */
39
inline double Production3PG::calculateUtilizablePAR(const int month) const
226 werner 40
{
327 werner 41
    // calculate the available radiation. This is done at SpeciesResponse-Level
226 werner 42
    // see Equation (3)
273 werner 43
    // multiplicative approach: responses are averaged one by one and multiplied on a monthly basis
44
//    double response = mResponse->absorbedRadiation()[month] *
45
//                      mResponse->vpdResponse()[month] *
46
//                      mResponse->soilWaterResponse()[month] *
47
//                      mResponse->tempResponse()[month];
48
    // minimum approach: for each day the minimum aof vpd, temp, soilwater is calculated, then averaged for each month
327 werner 49
    //double response = mResponse->absorbedRadiation()[month] *
50
    //                  mResponse->minimumResponses()[month];
51
    double response = mResponse->utilizableRadiation()[month];
273 werner 52
 
226 werner 53
    return response;
54
}
55
/** calculate the alphac (=photosynthetic efficiency) for the given month.
56
   this is based on a global efficiency, and modified per species.
227 werner 57
   epsilon is in gC/MJ Radiation
226 werner 58
  */
227 werner 59
inline double Production3PG::calculateEpsilon(const int month) const
226 werner 60
{
61
    double epsilon = Model::settings().epsilon; // maximum radiation use efficiency
62
    epsilon *= mResponse->nitrogenResponse() *
300 werner 63
               mResponse->co2Response()[month];
226 werner 64
    return epsilon;
65
}
66
 
227 werner 67
inline double Production3PG::abovegroundFraction() const
68
{
536 werner 69
    double utilized_frac = 1.;
70
    if (Model::settings().usePARFractionBelowGroundAllocation) {
71
        utilized_frac = mResponse->totalUtilizedRadiation() / mResponse->yearlyRadiation();
72
    }
73
    double harsh =  1 - 0.8/(1 + 2.5 * mResponse->nitrogenResponse() * utilized_frac);
227 werner 74
    return harsh;
75
}
76
 
369 werner 77
void Production3PG::clear()
78
{
79
    for (int i=0;i<12;i++) {
80
        mGPP[i] = 0.; mUPAR[i]=0.;
81
    }
440 werner 82
    mEnvYear = 0.;
369 werner 83
}
84
 
697 werner 85
/** calculate the stand-level NPP
86
  @ingroup core
87
  Standlevel (i.e. ResourceUnit-level) production (NPP) following the 3PG approach from Landsberg and Waring.
226 werner 88
  @sa http://iland.boku.ac.at/primary+production */
115 Werner 89
double Production3PG::calculate()
113 Werner 90
{
226 werner 91
    Q_ASSERT(mResponse!=0);
92
    // Radiation: sum over all days of each month with foliage
230 werner 93
    double year_raw_gpp = 0.;
369 werner 94
    clear();
226 werner 95
    double utilizable_rad, epsilon;
230 werner 96
    // conversion from gC to kg Biomass: C/Biomass=0.5
485 werner 97
    const double gC_to_kg_biomass = 1. / (biomassCFraction * 1000.);
226 werner 98
    for (int i=0;i<12;i++) {
513 werner 99
        utilizable_rad = calculateUtilizablePAR(i); // utilizable radiation of the month times ... (MJ/m2)
100
        epsilon = calculateEpsilon(i); // ... photosynthetic efficiency ... (gC/MJ)
230 werner 101
        mUPAR[i] = utilizable_rad ;
102
        mGPP[i] =utilizable_rad * epsilon * gC_to_kg_biomass; // ... results in GPP of the month kg Biomass/m2 (converted from gC/m2)
251 werner 103
        year_raw_gpp += mGPP[i]; // kg Biomass/m2
113 Werner 104
    }
436 werner 105
 
106
    // calculate f_env,yr: see http://iland.boku.ac.at/sapling+growth+and+competition
107
    double f_sum = 0.;
108
    for (int i=0;i<12;i++)
437 werner 109
        f_sum += mGPP[i] / gC_to_kg_biomass; // == uAPar * epsilon_eff
436 werner 110
 
467 werner 111
    //  the factor f_ref: parameter that scales response values to the range 0..1 (1 for best growth conditions) (species parameter)
112
    const double perf_factor = mResponse->species()->saplingGrowthParameters().referenceRatio;
485 werner 113
    // f_env,yr=(uapar*epsilon_eff) / (APAR * epsilon_0 * fref)
436 werner 114
    mEnvYear = f_sum / (Model::settings().epsilon * mResponse->yearlyRadiation() * perf_factor);
480 werner 115
    if (mEnvYear > 1.) {
483 werner 116
        qDebug() << "ERROR: fEnvYear > 1 for " << mResponse->species()->id() << mEnvYear << "f_sum, epsilon, yearlyRad, perf_factor" <<  f_sum << Model::settings().epsilon <<  mResponse->yearlyRadiation() << perf_factor;
485 werner 117
        mEnvYear = 1.;
480 werner 118
    }
436 werner 119
 
120
    // calculate fraction for belowground biomass
227 werner 121
    mRootFraction = 1. - abovegroundFraction();
137 Werner 122
 
123
    // global value set?
215 werner 124
    double dbg = GlobalSettings::instance()->settings().paramValue("gpp_per_year",0);
227 werner 125
    if (dbg) {
280 werner 126
        year_raw_gpp = dbg;
227 werner 127
        mRootFraction = 0.4;
128
    }
137 Werner 129
 
230 werner 130
    // year GPP/rad: kg Biomass/m2
131
    mGPPperArea = year_raw_gpp;
132
    return mGPPperArea; // yearly GPP in kg Biomass/m2
113 Werner 133
}