Rev 564 | Rev 626 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 564 | Rev 605 | ||
---|---|---|---|
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 | #include "global.h"
|
2 | #include "global.h"
|
3 | #include "resourceunitspecies.h"
|
3 | #include "resourceunitspecies.h"
|
4 | 4 | ||
5 | #include "species.h"
|
5 | #include "species.h"
|
6 | #include "resourceunit.h"
|
6 | #include "resourceunit.h"
|
7 | #include "model.h"
|
7 | #include "model.h"
|
8 | #include "watercycle.h"
|
8 | #include "watercycle.h"
|
9 | 9 | ||
10 | /** @class ResourceUnitSpecies
|
10 | /** @class ResourceUnitSpecies
|
11 | The class contains data available at ResourceUnit x Species scale.
|
11 | The class contains data available at ResourceUnit x Species scale.
|
12 | Data stored is either statistical (i.e. number of trees per species) or used
|
12 | Data stored is either statistical (i.e. number of trees per species) or used
|
13 | within the model (e.g. fraction of utilizable Radiation).
|
13 | within the model (e.g. fraction of utilizable Radiation).
|
14 | Important submodules are:
|
14 | Important submodules are:
|
15 | * 3PG production (Production3PG)
|
15 | * 3PG production (Production3PG)
|
16 | * Establishment
|
16 | * Establishment
|
17 | * Growth and Recruitment of Saplings
|
17 | * Growth and Recruitment of Saplings
|
18 | * Snag dynamics
|
18 | * Snag dynamics
|
19 | */
|
19 | */
|
20 | ResourceUnitSpecies::~ResourceUnitSpecies() |
20 | ResourceUnitSpecies::~ResourceUnitSpecies() |
21 | {
|
21 | {
|
22 | }
|
22 | }
|
23 | 23 | ||
24 | double ResourceUnitSpecies::leafArea() const |
24 | double ResourceUnitSpecies::leafArea() const |
25 | {
|
25 | {
|
26 | // Leaf area of the species:
|
26 | // Leaf area of the species:
|
27 | // total leaf area on the RU * fraction of leafarea
|
27 | // total leaf area on the RU * fraction of leafarea
|
28 | return mLAIfactor * ru()->leafAreaIndex(); |
28 | return mLAIfactor * ru()->leafAreaIndex(); |
29 | }
|
29 | }
|
30 | 30 | ||
31 | void ResourceUnitSpecies::setup(Species *species, ResourceUnit *ru) |
31 | void ResourceUnitSpecies::setup(Species *species, ResourceUnit *ru) |
32 | {
|
32 | {
|
33 | mSpecies = species; |
33 | mSpecies = species; |
34 | mRU = ru; |
34 | mRU = ru; |
35 | mResponse.setup(this); |
35 | mResponse.setup(this); |
36 | m3PG.setResponse(&mResponse); |
36 | m3PG.setResponse(&mResponse); |
37 | mEstablishment.setup(ru->climate(), this); |
37 | mEstablishment.setup(ru->climate(), this); |
38 | mSapling.setup(this); |
38 | mSapling.setup(this); |
39 | mStatistics.setResourceUnitSpecies(this); |
39 | mStatistics.setResourceUnitSpecies(this); |
40 | mStatisticsDead.setResourceUnitSpecies(this); |
40 | mStatisticsDead.setResourceUnitSpecies(this); |
41 | mStatisticsMgmt.setResourceUnitSpecies(this); |
41 | mStatisticsMgmt.setResourceUnitSpecies(this); |
42 | 42 | ||
43 | mRemovedGrowth = 0.; |
43 | mRemovedGrowth = 0.; |
44 | mLastYear = -1; |
44 | mLastYear = -1; |
45 | 45 | ||
46 | }
|
46 | }
|
47 | 47 | ||
48 | 48 | ||
49 | void ResourceUnitSpecies::calculate(const bool fromEstablishment) |
49 | void ResourceUnitSpecies::calculate(const bool fromEstablishment) |
50 | {
|
50 | {
|
51 | if (mLastYear == GlobalSettings::instance()->currentYear()) |
51 | if (mLastYear == GlobalSettings::instance()->currentYear()) |
52 | return; |
52 | return; |
53 | 53 | ||
54 | // the call *not* from establishment
|
54 | // the call *not* from establishment
|
55 | if (!fromEstablishment) |
55 | if (!fromEstablishment) |
56 | statistics().clear(); |
56 | statistics().clear(); |
57 | 57 | ||
58 | if (mLAIfactor>0 || fromEstablishment==true) { |
58 | if (mLAIfactor>0 || fromEstablishment==true) { |
59 | // execute the water calculation...
|
59 | // execute the water calculation...
|
60 | if (fromEstablishment) |
60 | if (fromEstablishment) |
61 | const_cast<WaterCycle*>(mRU->waterCycle())->run(); // run the water sub model (only if this has not be done already) |
61 | const_cast<WaterCycle*>(mRU->waterCycle())->run(); // run the water sub model (only if this has not be done already) |
62 | mResponse.calculate();// calculate environmental responses per species (vpd, temperature, ...) |
62 | mResponse.calculate();// calculate environmental responses per species (vpd, temperature, ...) |
63 | m3PG.calculate();// production of NPP |
63 | m3PG.calculate();// production of NPP |
64 | mLastYear = GlobalSettings::instance()->currentYear(); // mark this year as processed |
64 | mLastYear = GlobalSettings::instance()->currentYear(); // mark this year as processed |
65 | } else { |
65 | } else { |
66 | // if no LAI is present, then just clear the respones.
|
66 | // if no LAI is present, then just clear the respones.
|
67 | mResponse.clear(); |
67 | mResponse.clear(); |
68 | m3PG.clear(); |
68 | m3PG.clear(); |
69 | }
|
69 | }
|
70 | }
|
70 | }
|
71 | 71 | ||
72 | 72 | ||
73 | void ResourceUnitSpecies::updateGWL() |
73 | void ResourceUnitSpecies::updateGWL() |
74 | {
|
74 | {
|
75 | // removed growth is the running sum of all removed
|
75 | // removed growth is the running sum of all removed
|
76 | // tree volume. the current "GWL" therefore is current volume (standing) + mRemovedGrowth.
|
76 | // tree volume. the current "GWL" therefore is current volume (standing) + mRemovedGrowth.
|
77 | mRemovedGrowth+=statisticsDead().volume() + statisticsMgmt().volume(); |
77 | mRemovedGrowth+=statisticsDead().volume() + statisticsMgmt().volume(); |
78 | }
|
78 | }
|
79 | 79 | ||
80 | void ResourceUnitSpecies::calclulateEstablishment() |
80 | void ResourceUnitSpecies::calclulateEstablishment() |
81 | {
|
81 | {
|
82 | mEstablishment.calculate(); |
82 | mEstablishment.calculate(); |
83 | //DBGMODE(
|
83 | //DBGMODE(
|
84 | if (GlobalSettings::instance()->isDebugEnabled(GlobalSettings::dEstablishment)) { |
84 | if (GlobalSettings::instance()->isDebugEnabled(GlobalSettings::dEstablishment)) { |
85 | DebugList &out = GlobalSettings::instance()->debugList(ru()->index(), GlobalSettings::dEstablishment); |
85 | DebugList &out = GlobalSettings::instance()->debugList(ru()->index(), GlobalSettings::dEstablishment); |
86 | // establishment details
|
86 | // establishment details
|
87 | out << mSpecies->id() << ru()->index(); |
- | |
- | 87 | out << mSpecies->id() << ru()->index() << ru()->id(); |
|
88 | out << mEstablishment.avgSeedDensity(); |
88 | out << mEstablishment.avgSeedDensity(); |
89 | out << mEstablishment.TACAminTemp() << mEstablishment.TACAchill() << mEstablishment.TACAfrostFree() << mEstablishment.TACgdd(); |
89 | out << mEstablishment.TACAminTemp() << mEstablishment.TACAchill() << mEstablishment.TACAfrostFree() << mEstablishment.TACgdd(); |
90 | out << mEstablishment.TACAfrostDaysAfterBudBirst() << mEstablishment.abioticEnvironment(); |
90 | out << mEstablishment.TACAfrostDaysAfterBudBirst() << mEstablishment.abioticEnvironment(); |
91 | out << m3PG.fEnvYear() << mEstablishment.avgLIFValue() << mEstablishment.numberEstablished(); |
91 | out << m3PG.fEnvYear() << mEstablishment.avgLIFValue() << mEstablishment.numberEstablished(); |
92 | out << mSapling.livingSaplings() << mSapling.averageHeight() << mSapling.averageAge() << mSapling.averageDeltaHPot() << mSapling.averageDeltaHRealized(); |
92 | out << mSapling.livingSaplings() << mSapling.averageHeight() << mSapling.averageAge() << mSapling.averageDeltaHPot() << mSapling.averageDeltaHRealized(); |
93 | out << mSapling.newSaplings() << mSapling.diedSaplings() << mSapling.recruitedSaplings() << mSpecies->saplingGrowthParameters().referenceRatio; |
93 | out << mSapling.newSaplings() << mSapling.diedSaplings() << mSapling.recruitedSaplings() << mSpecies->saplingGrowthParameters().referenceRatio; |
94 | }
|
94 | }
|
95 | //); // DBGMODE()
|
95 | //); // DBGMODE()
|
96 | 96 | ||
97 | 97 | ||
98 | if ( logLevelDebug() ) |
98 | if ( logLevelDebug() ) |
99 | qDebug() << "establishment of RU" << mRU->index() << "species" << species()->id() |
99 | qDebug() << "establishment of RU" << mRU->index() << "species" << species()->id() |
100 | << "seeds density:" << mEstablishment.avgSeedDensity() |
100 | << "seeds density:" << mEstablishment.avgSeedDensity() |
101 | << "abiotic environment:" << mEstablishment.abioticEnvironment() |
101 | << "abiotic environment:" << mEstablishment.abioticEnvironment() |
102 | << "f_env,yr:" << m3PG.fEnvYear() |
102 | << "f_env,yr:" << m3PG.fEnvYear() |
103 | << "N(established):" << mEstablishment.numberEstablished(); |
103 | << "N(established):" << mEstablishment.numberEstablished(); |
104 | 104 | ||
105 | }
|
105 | }
|
106 | 106 | ||
107 | void ResourceUnitSpecies::calclulateSaplingGrowth() |
107 | void ResourceUnitSpecies::calclulateSaplingGrowth() |
108 | {
|
108 | {
|
109 | mSapling.calculateGrowth(); |
109 | mSapling.calculateGrowth(); |
110 | }
|
110 | }
|
111 | 111 | ||
112 | void ResourceUnitSpecies::visualGrid(Grid<float> &grid) const |
112 | void ResourceUnitSpecies::visualGrid(Grid<float> &grid) const |
113 | {
|
113 | {
|
114 | mSapling.fillMaxHeightGrid(grid); |
114 | mSapling.fillMaxHeightGrid(grid); |
115 | }
|
115 | }
|
116 | 116 | ||
117 | 117 | ||
118 | 118 |