Rev 477 | Rev 522 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 477 | Rev 490 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | #include "snag.h"
|
2 | #include "snag.h"
|
3 | #include "tree.h"
|
3 | #include "tree.h"
|
4 | #include "species.h"
|
4 | #include "species.h"
|
5 | #include "globalsettings.h"
|
5 | #include "globalsettings.h"
|
6 | #include "expression.h"
|
6 | #include "expression.h"
|
- | 7 | // for calculation of climate decomposition
|
|
- | 8 | #include "resourceunit.h"
|
|
- | 9 | #include "watercycle.h"
|
|
- | 10 | #include "climate.h"
|
|
7 | 11 | ||
8 | /** @class Snag
|
12 | /** @class Snag
|
9 | Snag deals with carbon / nitrogen fluxes from the forest until the reach soil pools.
|
13 | Snag deals with carbon / nitrogen fluxes from the forest until the reach soil pools.
|
10 | Snag lives on the level of |
14 | Snag lives on the level of the ResourceUnit; carbon fluxes from trees enter Snag, and parts of the biomass of snags
|
11 | is subsequently forwarded to the soil sub model.
|
15 | is subsequently forwarded to the soil sub model.
|
12 | 16 | ||
13 | */
|
17 | */
|
14 | // static variables
|
18 | // static variables
|
15 | double Snag::mDBHLower = 10.; |
19 | double Snag::mDBHLower = 10.; |
Line 30... | Line 34... | ||
30 | } soilparams; |
34 | } soilparams; |
31 | 35 | ||
32 | 36 | ||
33 | Snag::Snag() |
37 | Snag::Snag() |
34 | {
|
38 | {
|
- | 39 | mRU = 0; |
|
35 | soilparams.pDWDformula.setExpression("1-1/(1+exp(-6.78+0.262*tsd))"); |
40 | soilparams.pDWDformula.setExpression("1-1/(1+exp(-6.78+0.262*tsd))"); |
36 | CNPool::setCFraction(biomassCFraction); |
41 | CNPool::setCFraction(biomassCFraction); |
37 | }
|
42 | }
|
38 | 43 | ||
39 | void Snag::setup() |
44 | void Snag::setup( const ResourceUnit *ru) |
40 | {
|
45 | {
|
- | 46 | mRU = ru; |
|
- | 47 | mClimateFactor = 0.; |
|
41 | // branches
|
48 | // branches
|
42 | mBranchCounter=0; |
49 | mBranchCounter=0; |
43 | for (int i=0;i<3;i++) { |
50 | for (int i=0;i<3;i++) { |
44 | mTimeSinceDeath[i] = 0.; |
51 | mTimeSinceDeath[i] = 0.; |
45 | mNumberOfSnags[i] = 0.; |
52 | mNumberOfSnags[i] = 0.; |
Line 82... | Line 89... | ||
82 | mRefractoryFlux.clear(); |
89 | mRefractoryFlux.clear(); |
83 | mTotalToAtm.clear(); |
90 | mTotalToAtm.clear(); |
84 | mTotalToExtern.clear(); |
91 | mTotalToExtern.clear(); |
85 | mTotalIn.clear(); |
92 | mTotalIn.clear(); |
86 | mSWDtoSoil.clear(); |
93 | mSWDtoSoil.clear(); |
- | 94 | }
|
|
- | 95 | ||
- | 96 | /// calculate the dynamic climate modifier for decomposition 're'
|
|
- | 97 | double Snag::calculateClimateFactors() |
|
- | 98 | {
|
|
- | 99 | double rel_wc; |
|
- | 100 | double ft, fw; |
|
- | 101 | double f_sum = 0.; |
|
- | 102 | for (const ClimateDay *day=mRU->climate()->begin(); day!=mRU->climate()->end(); ++day) |
|
- | 103 | {
|
|
- | 104 | rel_wc = mRU->waterCycle()->relContent(day->day); // relative water content (0..1) of the day |
|
- | 105 | ft = exp(308.56*(1./56.02-1./((273.+day->temperature)-227.13))); // empirical variable Q10 model of Lloyd and Taylor (1994), see also Adair et al. (2008) |
|
- | 106 | fw = pow(1.-exp(-0.2*rel_wc),5.); // # see Standcarb for the 'stable soil' pool |
|
- | 107 | f_sum += ft*fw; |
|
- | 108 | }
|
|
- | 109 | // the climate factor is defined as the arithmentic annual mean value
|
|
- | 110 | mClimateFactor = f_sum / double(mRU->climate()->daysOfYear()); |
|
- | 111 | return mClimateFactor; |
|
87 | }
|
112 | }
|
88 | 113 | ||
89 | // do the yearly calculation
|
114 | // do the yearly calculation
|
90 | // see http://iland.boku.ac.at/snag+dynamics
|
115 | // see http://iland.boku.ac.at/snag+dynamics
|
91 | void Snag::processYear() |
116 | void Snag::processYear() |
Line 102... | Line 127... | ||
102 | 127 | ||
103 | mSWDtoSoil.clear(); |
128 | mSWDtoSoil.clear(); |
104 | // process standing snags.
|
129 | // process standing snags.
|
105 | // the input of the current year is in the mToSWD-Pools
|
130 | // the input of the current year is in the mToSWD-Pools
|
106 | double tsd; |
131 | double tsd; |
107 | const double climate_factor_re = |
132 | const double climate_factor_re = calculateClimateFactors(); |
108 | for (int i=0;i<3;i++) { |
133 | for (int i=0;i<3;i++) { |
109 | // calculate 'tsd', i.e. time-since-death (see SnagDecay.xls for calculation details)
|
134 | // calculate 'tsd', i.e. time-since-death (see SnagDecay.xls for calculation details)
|
110 | // time_since_death = tsd_last_year*state_before / (state_before+input) + 1
|
135 | // time_since_death = tsd_last_year*state_before / (state_before+input) + 1
|
111 | if (mSWD[i].C>0.) |
136 | if (mSWD[i].C>0.) |
112 | tsd = mTimeSinceDeath[i]*mSWD[i].C / (mSWD[i].C+mToSWD[i].C) + 1.; |
137 | tsd = mTimeSinceDeath[i]*mSWD[i].C / (mSWD[i].C+mToSWD[i].C) + 1.; |