Rev 451 | Rev 453 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 451 | Rev 452 | ||
---|---|---|---|
1 | Redirecting to URL 'https://iland.boku.ac.at/svn/iland/tags/release_1.0/src/core/resourceunitspecies.cpp': |
1 | Redirecting to URL 'https://iland.boku.ac.at/svn/iland/tags/release_1.0/src/core/resourceunitspecies.cpp': |
2 | /** @class ResourceUnitSpecies
|
2 | /** @class ResourceUnitSpecies
|
3 | The class contains data available at ResourceUnit x Species scale.
|
3 | The class contains data available at ResourceUnit x Species scale.
|
4 | Data stored is either statistical (i.e. number of trees per species) or used
|
4 | Data stored is either statistical (i.e. number of trees per species) or used
|
5 | within the model (e.g. fraction of utilizable Radiation)
|
5 | within the model (e.g. fraction of utilizable Radiation)
|
6 | */
|
6 | */
|
7 | #include "global.h"
|
7 | #include "global.h"
|
8 | #include "resourceunitspecies.h"
|
8 | #include "resourceunitspecies.h"
|
9 | 9 | ||
10 | #include "species.h"
|
10 | #include "species.h"
|
11 | #include "resourceunit.h"
|
11 | #include "resourceunit.h"
|
12 | 12 | ||
13 | 13 | ||
14 | double ResourceUnitSpecies::leafArea() const |
14 | double ResourceUnitSpecies::leafArea() const |
15 | {
|
15 | {
|
16 | // Leaf area of the species:
|
16 | // Leaf area of the species:
|
17 | // total leaf area on the RU * fraction of leafarea
|
17 | // total leaf area on the RU * fraction of leafarea
|
18 | return mLAIfactor * ru()->leafAreaIndex(); |
18 | return mLAIfactor * ru()->leafAreaIndex(); |
19 | }
|
19 | }
|
20 | 20 | ||
21 | void ResourceUnitSpecies::setup(Species *species, ResourceUnit *ru) |
21 | void ResourceUnitSpecies::setup(Species *species, ResourceUnit *ru) |
22 | {
|
22 | {
|
23 | mSpecies = species; |
23 | mSpecies = species; |
24 | mRU = ru; |
24 | mRU = ru; |
25 | mResponse.setup(this); |
25 | mResponse.setup(this); |
26 | m3PG.setResponse(&mResponse); |
26 | m3PG.setResponse(&mResponse); |
27 | mEstablishment.setup(ru->climate(), this); |
27 | mEstablishment.setup(ru->climate(), this); |
- | 28 | mSapling.setup(this); |
|
28 | mStatistics.setResourceUnitSpecies(this); |
29 | mStatistics.setResourceUnitSpecies(this); |
29 | mStatisticsDead.setResourceUnitSpecies(this); |
30 | mStatisticsDead.setResourceUnitSpecies(this); |
30 | mStatisticsMgmt.setResourceUnitSpecies(this); |
31 | mStatisticsMgmt.setResourceUnitSpecies(this); |
31 | 32 | ||
32 | mRemovedGrowth = 0.; |
33 | mRemovedGrowth = 0.; |
33 | mLastYear = -1; |
34 | mLastYear = -1; |
34 | }
|
35 | }
|
35 | 36 | ||
36 | 37 | ||
37 | void ResourceUnitSpecies::calculate(const bool fromEstablishment) |
38 | void ResourceUnitSpecies::calculate(const bool fromEstablishment) |
38 | {
|
39 | {
|
39 | if (mLastYear == GlobalSettings::instance()->currentYear()) |
40 | if (mLastYear == GlobalSettings::instance()->currentYear()) |
40 | return; |
41 | return; |
41 | mLastYear = GlobalSettings::instance()->currentYear(); |
42 | mLastYear = GlobalSettings::instance()->currentYear(); |
42 | 43 | ||
43 | statistics().clear(); |
44 | statistics().clear(); |
44 | if (mLAIfactor>0 || fromEstablishment==true) { |
45 | if (mLAIfactor>0 || fromEstablishment==true) { |
45 | mResponse.calculate();///< calculate environmental responses per species (vpd, temperature, ...) |
46 | mResponse.calculate();///< calculate environmental responses per species (vpd, temperature, ...) |
46 | m3PG.calculate();///< production of NPP |
47 | m3PG.calculate();///< production of NPP |
47 | } else { |
48 | } else { |
48 | // if no LAI is present, then just clear the respones.
|
49 | // if no LAI is present, then just clear the respones.
|
49 | // note: subject to change when regeneration is added...
|
50 | // note: subject to change when regeneration is added...
|
50 | mResponse.clear(); |
51 | mResponse.clear(); |
51 | m3PG.clear(); |
52 | m3PG.clear(); |
52 | }
|
53 | }
|
53 | }
|
54 | }
|
54 | 55 | ||
55 | 56 | ||
56 | void ResourceUnitSpecies::updateGWL() |
57 | void ResourceUnitSpecies::updateGWL() |
57 | {
|
58 | {
|
58 | // removed growth is the running sum of all removed
|
59 | // removed growth is the running sum of all removed
|
59 | // tree volume. the current "GWL" therefore is current volume (standing) + mRemovedGrowth.
|
60 | // tree volume. the current "GWL" therefore is current volume (standing) + mRemovedGrowth.
|
60 | mRemovedGrowth+=statisticsDead().volume() + statisticsMgmt().volume(); |
61 | mRemovedGrowth+=statisticsDead().volume() + statisticsMgmt().volume(); |
61 | }
|
62 | }
|
62 | 63 | ||
63 | void ResourceUnitSpecies::calclulateEstablishment() |
64 | void ResourceUnitSpecies::calclulateEstablishment() |
64 | {
|
65 | {
|
65 | mEstablishment.calculate(); |
66 | mEstablishment.calculate(); |
66 | //DBGMODE(
|
67 | //DBGMODE(
|
67 | if (GlobalSettings::instance()->isDebugEnabled(GlobalSettings::dEstablishment)) { |
68 | if (GlobalSettings::instance()->isDebugEnabled(GlobalSettings::dEstablishment)) { |
68 | DebugList &out = GlobalSettings::instance()->debugList(ru()->index(), GlobalSettings::dEstablishment); |
69 | DebugList &out = GlobalSettings::instance()->debugList(ru()->index(), GlobalSettings::dEstablishment); |
69 | // establishment details
|
70 | // establishment details
|
70 | out << mSpecies->id() << ru()->index(); |
71 | out << mSpecies->id() << ru()->index(); |
71 | out << mEstablishment.avgSeedDensity(); |
72 | out << mEstablishment.avgSeedDensity(); |
72 | out << mEstablishment.TACAminTemp() << mEstablishment.TACAchill() << mEstablishment.TACAfrostFree() << mEstablishment.TACgdd(); |
73 | out << mEstablishment.TACAminTemp() << mEstablishment.TACAchill() << mEstablishment.TACAfrostFree() << mEstablishment.TACgdd(); |
73 | out << mEstablishment.TACAfrostDaysAfterBudBirst() << mEstablishment.abioticEnvironment(); |
74 | out << mEstablishment.TACAfrostDaysAfterBudBirst() << mEstablishment.abioticEnvironment(); |
74 | out << m3PG.fEnvYear() << mEstablishment.avgLIFValue() << mEstablishment.numberEstablished(); |
75 | out << m3PG.fEnvYear() << mEstablishment.avgLIFValue() << mEstablishment.numberEstablished(); |
75 | out << mSapling.livingSaplings() << mSapling.averageHeight() << mSapling.newSaplings() << mSapling.diedSaplings() << mSapling.recruitedSaplings(); |
76 | out << mSapling.livingSaplings() << mSapling.averageHeight() << mSapling.newSaplings() << mSapling.diedSaplings() << mSapling.recruitedSaplings(); |
76 | }
|
77 | }
|
77 | //); // DBGMODE()
|
78 | //); // DBGMODE()
|
78 | 79 | ||
79 | 80 | ||
80 | if ( logLevelDebug() ) |
81 | if ( logLevelDebug() ) |
81 | qDebug() << "establishment of RU" << mRU->index() << "species" << species()->id() |
82 | qDebug() << "establishment of RU" << mRU->index() << "species" << species()->id() |
82 | << "seeds density:" << mEstablishment.avgSeedDensity() |
83 | << "seeds density:" << mEstablishment.avgSeedDensity() |
83 | << "abiotic environment:" << mEstablishment.abioticEnvironment() |
84 | << "abiotic environment:" << mEstablishment.abioticEnvironment() |
84 | << "f_env,yr:" << m3PG.fEnvYear() |
85 | << "f_env,yr:" << m3PG.fEnvYear() |
85 | << "N(established):" << mEstablishment.numberEstablished(); |
86 | << "N(established):" << mEstablishment.numberEstablished(); |
86 | 87 | ||
87 | }
|
88 | }
|
88 | 89 | ||
89 | void ResourceUnitSpecies::calclulateSaplingGrowth() |
90 | void ResourceUnitSpecies::calclulateSaplingGrowth() |
90 | {
|
91 | {
|
91 | mSapling.calculateGrowth(); |
92 | mSapling.calculateGrowth(); |
92 | }
|
93 | }
|
93 | 94 |