Subversion Repositories public iLand

Rev

Rev 532 | Rev 540 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 532 Rev 534
Line 21... Line 21...
21
// static variables
21
// static variables
22
double Snag::mDBHLower = -1.;
22
double Snag::mDBHLower = -1.;
23
double Snag::mDBHHigher = 0.;
23
double Snag::mDBHHigher = 0.;
24
double Snag::mCarbonThreshold[] = {0., 0., 0.};
24
double Snag::mCarbonThreshold[] = {0., 0., 0.};
25
25
26
double CNPool::biomassCFraction = biomassCFraction; // get global from globalsettings.h
-
 
-
 
26
double CNPair::biomassCFraction = biomassCFraction; // get global from globalsettings.h
-
 
27
-
 
28
/// add biomass and weigh the parameter_value with the current C-content of the pool
-
 
29
void CNPool::addBiomass(const double biomass, const double CNratio, const double parameter_value)
-
 
30
{
-
 
31
    if (biomass==0.)
-
 
32
        return;
-
 
33
    double new_c = biomass*biomassCFraction;
-
 
34
    double p_old = C / (new_c + C);
-
 
35
    mParameter = mParameter*p_old + parameter_value*(1.-p_old);
-
 
36
    CNPair::addBiomass(biomass, CNratio);
-
 
37
}
-
 
38
-
 
39
// increase pool (and weigh the value)
-
 
40
void CNPool::operator+=(const CNPool &s)
-
 
41
{
-
 
42
    if (s.C==0.)
-
 
43
        return;
-
 
44
    mParameter = parameter(s); // calculate weighted parameter
-
 
45
    C+=s.C;
-
 
46
    N+=s.N;
-
 
47
}
-
 
48
-
 
49
double CNPool::parameter(const CNPool &s) const
-
 
50
{
-
 
51
    if (s.C==0.)
-
 
52
        return parameter();
-
 
53
    double p_old = C / (s.C + C);
-
 
54
    double result =  mParameter*p_old + s.parameter()*(1.-p_old);
-
 
55
    return result;
-
 
56
}
-
 
57
27
58
28
void Snag::setupThresholds(const double lower, const double upper)
59
void Snag::setupThresholds(const double lower, const double upper)
29
{
60
{
30
    if (mDBHLower == lower)
61
    if (mDBHLower == lower)
31
        return;
62
        return;
Line 43... Line 74...
43
74
44
75
45
Snag::Snag()
76
Snag::Snag()
46
{
77
{
47
    mRU = 0;
78
    mRU = 0;
48
    CNPool::setCFraction(biomassCFraction);
-
 
-
 
79
    CNPair::setCFraction(biomassCFraction);
49
}
80
}
50
81
51
void Snag::setup( const ResourceUnit *ru)
82
void Snag::setup( const ResourceUnit *ru)
52
{
83
{
53
    mRU = ru;
84
    mRU = ru;
Line 219... Line 250...
219
}
250
}
220
251
221
/// foliage and fineroot litter is transferred during tree growth.
252
/// foliage and fineroot litter is transferred during tree growth.
222
void Snag::addTurnoverLitter(const Tree *tree, const double litter_foliage, const double litter_fineroot)
253
void Snag::addTurnoverLitter(const Tree *tree, const double litter_foliage, const double litter_fineroot)
223
{
254
{
224
    mLabileFlux.addBiomass(litter_foliage, tree->species()->cnFoliage());
-
 
225
    mLabileFlux.addBiomass(litter_fineroot, tree->species()->cnFineroot());
-
 
-
 
255
    mLabileFlux.addBiomass(litter_foliage, tree->species()->cnFoliage(), tree->species()->snagKyl());
-
 
256
    mLabileFlux.addBiomass(litter_fineroot, tree->species()->cnFineroot(), tree->species()->snagKyl());
226
}
257
}
227
258
228
/// after the death of the tree the five biomass compartments are processed.
259
/// after the death of the tree the five biomass compartments are processed.
229
void Snag::addMortality(const Tree *tree)
260
void Snag::addMortality(const Tree *tree)
230
{
261
{
231
    const Species *species = tree->species();
262
    const Species *species = tree->species();
232
263
233
    // immediate flows: 100% of foliage, 100% of fine roots: they go to the labile pool
264
    // immediate flows: 100% of foliage, 100% of fine roots: they go to the labile pool
234
    // 100% of coarse root biomass: that goes to the refractory pool
265
    // 100% of coarse root biomass: that goes to the refractory pool
235
    mLabileFlux.addBiomass(tree->biomassFoliage(), species->cnFoliage());
-
 
236
    mLabileFlux.addBiomass(tree->biomassFineRoot(), species->cnFineroot());
-
 
237
    mRefractoryFlux.addBiomass(tree->biomassCoarseRoot(), species->cnWood());
-
 
-
 
266
    mLabileFlux.addBiomass(tree->biomassFoliage(), species->cnFoliage(), tree->species()->snagKyl());
-
 
267
    mLabileFlux.addBiomass(tree->biomassFineRoot(), species->cnFineroot(), tree->species()->snagKyl());
-
 
268
    mRefractoryFlux.addBiomass(tree->biomassCoarseRoot(), species->cnWood(), tree->species()->snagKyr());
238
269
239
    // branches are equally distributed over five years:
270
    // branches are equally distributed over five years:
240
    double biomass_branch = tree->biomassBranch() * 0.2;
271
    double biomass_branch = tree->biomassBranch() * 0.2;
241
    for (int i=0;i<5; i++)
272
    for (int i=0;i<5; i++)
242
        mBranches[i].addBiomass(biomass_branch, species->cnWood());
-
 
-
 
273
        mBranches[i].addBiomass(biomass_branch, species->cnWood(), tree->species()->snagKyr());
243
274
244
    // just for book-keeping: keep track of all inputs into branches / swd
275
    // just for book-keeping: keep track of all inputs into branches / swd
245
    mTotalIn.addBiomass(tree->biomassBranch() + tree->biomassStem(), species->cnWood());
276
    mTotalIn.addBiomass(tree->biomassBranch() + tree->biomassStem(), species->cnWood());
246
    // stem biomass is transferred to the standing woody debris pool (SWD), increase stem number of pool
277
    // stem biomass is transferred to the standing woody debris pool (SWD), increase stem number of pool
247
    int pi = poolIndex(tree->dbh()); // get right transfer pool
278
    int pi = poolIndex(tree->dbh()); // get right transfer pool
Line 260... Line 291...
260
    // aggregate all trees that die in the current year (and save weighted decay rates to CurrentKSW)
291
    // aggregate all trees that die in the current year (and save weighted decay rates to CurrentKSW)
261
    if (tree->biomassStem()==0)
292
    if (tree->biomassStem()==0)
262
        throw IException("Snag::addMortality: tree without stem biomass!!");
293
        throw IException("Snag::addMortality: tree without stem biomass!!");
263
    p_old = mToSWD[pi].C / (mToSWD[pi].C + tree->biomassStem()* biomassCFraction);
294
    p_old = mToSWD[pi].C / (mToSWD[pi].C + tree->biomassStem()* biomassCFraction);
264
    p_new =tree->biomassStem()* biomassCFraction / (mToSWD[pi].C + tree->biomassStem()* biomassCFraction);
295
    p_new =tree->biomassStem()* biomassCFraction / (mToSWD[pi].C + tree->biomassStem()* biomassCFraction);
265
    mCurrentKSW[pi] = mCurrentKSW[pi]*p_old + species->snagKSW() * p_new;
-
 
-
 
296
    mCurrentKSW[pi] = mCurrentKSW[pi]*p_old + species->snagKsw() * p_new;
266
    mNumberOfSnags[pi]++;
297
    mNumberOfSnags[pi]++;
267
298
268
    // finally add the biomass
299
    // finally add the biomass
269
    CNPool &swd = mToSWD[pi];
-
 
270
    swd.addBiomass(tree->biomassStem(), species->cnWood());
-
 
-
 
300
    CNPool &to_swd = mToSWD[pi];
-
 
301
    to_swd.addBiomass(tree->biomassStem(), species->cnWood(), tree->species()->snagKyr());
271
}
302
}
272
303
273
/// add residual biomass of 'tree' after harvesting.
304
/// add residual biomass of 'tree' after harvesting.
274
/// remove_{stem, branch, foliage}_fraction: percentage of biomass compartment that is *removed* by the harvest operation (i.e.: not to stay in the system)
305
/// remove_{stem, branch, foliage}_fraction: percentage of biomass compartment that is *removed* by the harvest operation (i.e.: not to stay in the system)
275
/// records on harvested biomass is collected (mTotalToExtern-pool).
306
/// records on harvested biomass is collected (mTotalToExtern-pool).
Line 277... Line 308...
277
{
308
{
278
    const Species *species = tree->species();
309
    const Species *species = tree->species();
279
310
280
    // immediate flows: 100% of residual foliage, 100% of fine roots: they go to the labile pool
311
    // immediate flows: 100% of residual foliage, 100% of fine roots: they go to the labile pool
281
    // 100% of coarse root biomass: that goes to the refractory pool
312
    // 100% of coarse root biomass: that goes to the refractory pool
282
    mLabileFlux.addBiomass(tree->biomassFoliage() * (1. - remove_foliage_fraction), species->cnFoliage());
-
 
283
    mLabileFlux.addBiomass(tree->biomassFineRoot(), species->cnFineroot());
-
 
284
    mRefractoryFlux.addBiomass(tree->biomassCoarseRoot(), species->cnWood());
-
 
-
 
313
    mLabileFlux.addBiomass(tree->biomassFoliage() * (1. - remove_foliage_fraction), species->cnFoliage(), tree->species()->snagKyl());
-
 
314
    mLabileFlux.addBiomass(tree->biomassFineRoot(), species->cnFineroot(), tree->species()->snagKyl());
-
 
315
    mRefractoryFlux.addBiomass(tree->biomassCoarseRoot(), species->cnWood(), tree->species()->snagKyr());
285
    // for branches, add all biomass that remains in the forest to the soil
316
    // for branches, add all biomass that remains in the forest to the soil
286
    mRefractoryFlux.addBiomass(tree->biomassBranch()*(1.-remove_branch_fraction), species->cnWood());
-
 
-
 
317
    mRefractoryFlux.addBiomass(tree->biomassBranch()*(1.-remove_branch_fraction), species->cnWood(), tree->species()->snagKyr());
287
    // the same treatment for stem residuals
318
    // the same treatment for stem residuals
288
    mRefractoryFlux.addBiomass(tree->biomassStem() * remove_stem_fraction, species->cnWood());
-
 
-
 
319
    mRefractoryFlux.addBiomass(tree->biomassStem() * remove_stem_fraction, species->cnWood(), tree->species()->snagKyr());
289
320
290
    // for book-keeping...
321
    // for book-keeping...
291
    mTotalToExtern.addBiomass(tree->biomassFoliage()*remove_foliage_fraction +
322
    mTotalToExtern.addBiomass(tree->biomassFoliage()*remove_foliage_fraction +
292
                              tree->biomassBranch()*remove_branch_fraction +
323
                              tree->biomassBranch()*remove_branch_fraction +
293
                              tree->biomassStem()*remove_stem_fraction, species->cnWood());
324
                              tree->biomassStem()*remove_stem_fraction, species->cnWood());
294
}
325
}
-
 
326
-
 
327
-
 
328
295
329