Subversion Repositories public iLand

Rev

Rev 1220 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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