Subversion Repositories public iLand

Rev

Rev 227 | Rev 230 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
113 Werner 2
#include "global.h"
3
#include "production3pg.h"
4
 
189 iland 5
#include "resourceunit.h"
113 Werner 6
#include "species.h"
226 werner 7
#include "speciesresponse.h"
8
#include "model.h"
113 Werner 9
 
10
Production3PG::Production3PG()
11
{
226 werner 12
    mResponse=0;
113 Werner 13
}
14
 
146 werner 15
// fake: aggregated response values per month GO to webbrowser!!
133 Werner 16
const double totalResponses[] = {0., 0.05, 0.4, 0.6, 0.8, 0.8, 0.8, 0.5, 0.5, 0.1, 0. ,0. };
113 Werner 17
const double radYear = 3140.; // the sum of radMonth [MJ/m2]
18
 
226 werner 19
/**
20
  This is based on the utilizable photosynthetic active radiation.
21
  @sa http://iland.boku.ac.at/primary+production
227 werner 22
  The resulting radiation is MJ/m2       */
23
inline double Production3PG::calculateUtilizablePAR(const int month) const
226 werner 24
{
25
    // calculate the available radiation
26
 
27
    // there is no production outside of the vegetation period
28
    if (mResponse->absorbedRadiation()[month]==0.)
29
        return 0.;
30
    // see Equation (3)
31
    double response = mResponse->absorbedRadiation()[month] *
32
                      mResponse->vpdResponse()[month] *
33
                      mResponse->soilWaterResponse()[month] *
34
                      mResponse->tempResponse()[month];
35
    return response;
36
}
37
/** calculate the alphac (=photosynthetic efficiency) for the given month.
38
   this is based on a global efficiency, and modified per species.
227 werner 39
   epsilon is in gC/MJ Radiation
226 werner 40
  */
227 werner 41
inline double Production3PG::calculateEpsilon(const int month) const
226 werner 42
{
43
    double epsilon = Model::settings().epsilon; // maximum radiation use efficiency
44
    epsilon *= mResponse->nitrogenResponse() *
45
               mResponse->co2Response();
46
    return epsilon;
47
}
48
 
227 werner 49
inline double Production3PG::abovegroundFraction() const
50
{
51
    double harsh =  1 - 0.8/(1 + 2.5 * mResponse->nitrogenResponse());
52
    return harsh;
53
}
54
 
226 werner 55
/** calculate the alphac (=photosynthetic efficiency) for given month.
56
  @sa http://iland.boku.ac.at/primary+production */
115 Werner 57
double Production3PG::calculate()
113 Werner 58
{
226 werner 59
    Q_ASSERT(mResponse!=0);
60
    // Radiation: sum over all days of each month with foliage
228 werner 61
    double year_raw_gpp_c = 0.;
113 Werner 62
    for (int i=0;i<12;i++) {
228 werner 63
        mGPP[i] = 0.; mUPAR[i]=0.;
226 werner 64
    }
65
    double utilizable_rad, epsilon;
66
    for (int i=0;i<12;i++) {
228 werner 67
        mUPAR[i] = calculateUtilizablePAR(i); // utilizable radiation of the month times ...
226 werner 68
        epsilon = calculateEpsilon(i); // ... photosynthetic efficiency ...
227 werner 69
        mGPP[i] =utilizable_rad * epsilon; // ... results in GPP of the month (gC/m2)
228 werner 70
        year_raw_gpp_c += mGPP[i]; // gC/m2
113 Werner 71
    }
227 werner 72
    // calculate fac
73
    mRootFraction = 1. - abovegroundFraction();
137 Werner 74
 
75
    // global value set?
215 werner 76
    double dbg = GlobalSettings::instance()->settings().paramValue("gpp_per_year",0);
227 werner 77
    if (dbg) {
228 werner 78
        year_raw_gpp_c = dbg * 1000. / 2.; // to g Carbon / m2
227 werner 79
        mRootFraction = 0.4;
80
    }
137 Werner 81
 
228 werner 82
    // year GPP/rad: kg Biomass (Carbon) * 2 / (yearly MJ/m2)
83
    double year_gpp_biomass = year_raw_gpp_c * 2 / 1000.; // conversion from gC/m2 -> kg/m2
84
    mGPPperRad = year_gpp_biomass / radYear;
85
    return mGPPperRad; // kg Biomass/MJ
113 Werner 86
}