Subversion Repositories public iLand

Rev

Rev 215 | Rev 227 | 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
22
  The resulting radiation is per m2!       */
23
inline double Production3PG::calculateUtilizablePAR(const int month)
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.
39
   epsilon is in gC/MMOl??!?!?!?
40
  */
41
inline double Production3PG::calculateEpsilon(const int month)
42
{
43
    double epsilon = Model::settings().epsilon; // maximum radiation use efficiency
44
    epsilon *= mResponse->nitrogenResponse() *
45
               mResponse->co2Response();
46
    return epsilon;
47
}
48
 
49
/** calculate the alphac (=photosynthetic efficiency) for given month.
50
  @sa http://iland.boku.ac.at/primary+production */
115 Werner 51
double Production3PG::calculate()
113 Werner 52
{
226 werner 53
    Q_ASSERT(mResponse!=0);
54
    // Radiation: sum over all days of each month with foliage
113 Werner 55
    double year_raw_gpp = 0.;
56
    for (int i=0;i<12;i++) {
226 werner 57
        mAlphaC[i] = 0.; mGPP[i] = 0.;  mNPP[i] = 0.;
58
    }
59
    double utilizable_rad, epsilon;
60
    for (int i=0;i<12;i++) {
61
        utilizable_rad = calculateUtilizablePAR(i); // utilizable radiation of the month times ...
62
        epsilon = calculateEpsilon(i); // ... photosynthetic efficiency ...
63
        mGPP[i] =utilizable_rad * epsilon; // ... results in GPP of the month
113 Werner 64
        year_raw_gpp += month_gpp[i];
65
    }
115 Werner 66
    // calculate harshness factor
170 werner 67
    mHarshness = 0.4; // fake
137 Werner 68
 
69
    // global value set?
215 werner 70
    double dbg = GlobalSettings::instance()->settings().paramValue("gpp_per_year",0);
137 Werner 71
    if (dbg)
72
        year_raw_gpp = dbg;
73
 
215 werner 74
    // year GPP/rad: kg Biomass / (yearly MJ/m2)
115 Werner 75
    mGPPperRad = year_raw_gpp / radYear;
76
    return mGPPperRad;
113 Werner 77
}