Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
671 werner 1
/********************************************************************************************
2
**    iLand - an individual based forest landscape and disturbance model
3
**    http://iland.boku.ac.at
4
**    Copyright (C) 2009-  Werner Rammer, Rupert Seidl
5
**
6
**    This program is free software: you can redistribute it and/or modify
7
**    it under the terms of the GNU General Public License as published by
8
**    the Free Software Foundation, either version 3 of the License, or
9
**    (at your option) any later version.
10
**
11
**    This program is distributed in the hope that it will be useful,
12
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
**    GNU General Public License for more details.
15
**
16
**    You should have received a copy of the GNU General Public License
17
**    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
********************************************************************************************/
19
 
200 werner 20
#include "global.h"
21
#include "modelsettings.h"
205 werner 22
#include "expression.h"
200 werner 23
 
24
ModelSettings::ModelSettings()
25
{
26
}
27
 
28
void ModelSettings::loadModelSettings()
29
{
30
    XmlHelper xml(GlobalSettings::instance()->settings().node("model.settings"));
31
    growthEnabled = xml.valueBool("growthEnabled", true);
32
    mortalityEnabled = xml.valueBool("mortalityEnabled", true);
33
    lightExtinctionCoefficient = xml.valueDouble("lightExtinctionCoefficient", 0.5);
34
    lightExtinctionCoefficientOpacity=xml.valueDouble("lightExtinctionCoefficientOpacity", 0.5);
201 werner 35
    temperatureTau=xml.valueDouble("temperatureTau",5);
239 werner 36
    epsilon = xml.valueDouble("epsilon",1.8); // max light use efficiency (aka alpha_c)
37
    airDensity = xml.valueDouble("airDensity", 1.2);
368 werner 38
    laiThresholdForClosedStands = xml.valueDouble("laiThresholdForClosedStands", 3.);
372 werner 39
    boundaryLayerConductance = xml.valueDouble("boundaryLayerConductance", 0.2);
269 werner 40
    XmlHelper world(GlobalSettings::instance()->settings().node("model.world"));
41
    latitude = RAD(world.valueDouble("latitude",48.));
536 werner 42
    usePARFractionBelowGroundAllocation = xml.valueBool("usePARFractionBelowGroundAllocation", true);
43
    //useDynamicAvailableNitrogen = xml.valueBool("model.settings.soil.useDynamicAvailableNitrogen", false); // TODO: there is a bug in using a xml helper that whose top-node is set
530 werner 44
    useDynamicAvailableNitrogen = GlobalSettings::instance()->settings().valueBool("model.settings.soil.useDynamicAvailableNitrogen", false);
1182 werner 45
    torusMode = GlobalSettings::instance()->settings().paramValueBool("torus", false);
200 werner 46
}
47
 
48
void ModelSettings::print()
49
{
431 werner 50
    if (!logLevelInfo()) return;
204 werner 51
    QStringList set=QStringList() << "Settings:";
200 werner 52
    set << QString("growthEnabled=%1").arg(growthEnabled);
53
    set << QString("mortalityEnabled=%1").arg(mortalityEnabled);
54
    set << QString("lightExtinctionCoefficient=%1").arg(lightExtinctionCoefficient);
55
    set << QString("lightExtinctionCoefficientOpacity=%1").arg(lightExtinctionCoefficientOpacity);
201 werner 56
    set << QString("temperatureTau=%1").arg(temperatureTau);
226 werner 57
    set << QString("epsilon=%1").arg(epsilon);
239 werner 58
    set << QString("airDensity=%1").arg(airDensity);
530 werner 59
    set << QString("useDynamicAvailableNitrogen=%1").arg(useDynamicAvailableNitrogen);
226 werner 60
 
210 werner 61
    set << QString("latitude=%1").arg(GRAD(latitude));
62
 
200 werner 63
    qDebug() << set.join("\n");
64
}