Alpine3D

Alpine3D Svn Source Tree

Root/trunk/alpine3d/AlpineControl.h

1/***********************************************************************************/
2/* Copyright 2009-2015 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3/***********************************************************************************/
4/* This file is part of Alpine3D.
5 Alpine3D is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Alpine3D is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with Alpine3D. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef ALPINECONTROL_H
19#define ALPINECONTROL_H
20
21#include <stdio.h>
22
23#include <meteoio/MeteoIO.h>
24#include <snowpack/libsnowpack.h>
25
26#include <alpine3d/SnowpackInterface.h>
27#include <alpine3d/snowdrift/SnowDrift.h>
28#include <alpine3d/ebalance/EnergyBalance.h>
29#include <alpine3d/DataAssimilation.h>
30#include <alpine3d/MeteoObj.h>
31#include <alpine3d/MPIControl.h>
32
33/**
34 * @page restarts Restarts
35 * It is possible to regularly dump the exact status of each simulated pixel and then restart from a previously saved such backup.
36 * In order to do so, it is necessary to enable writting out these status files, to copy them at the required timestep and then tell the model
37 * to reread them when starting. These files are just regular SMET ".sno" files such as produced and used by Snowpack but for each simulated pixel.
38 *
39 * The following keys control this process, in the [Output] section:
40 * + SNOW_WRITE: is set to TRUE, enable writing these files;
41 * + SNOW_DAYS_BETWEEN: how many days between two updates to these files;
42 *
43 * On the command line, the switch "--restart" tells Alpine3D to read one file for each pixel instead of one file per land use class. Of course, all
44 * the usual configuration keys for the "sno" files apply (see \ref reading_snow_files "reading snow files").
45 *
46 * @note You MUST set the key "EXPERIMENT_NAME" in the [Output] section since this is used to name the files necessary for restarts
47 */
48
49class AlpineControl
50{
51public:
52AlpineControl(SnowpackInterface *mysnowpack,
53 SnowDriftA3D *mysnowdrift,
54 EnergyBalance *myeb,
55 DataAssimilation *myda,
56 Runoff *myrunoff,
57 const mio::Config& cfg,
58 const mio::DEMObject& dem);
59void Run(mio::Date i_startdate, const unsigned int max_steps);
60void setNoCompute(bool i_nocompute) {nocompute = i_nocompute;}
61
62private:
63MeteoObj meteo;
64
65SnowpackInterface *snowpack;
66SnowDriftA3D *snowdrift;
67EnergyBalance *eb;
68DataAssimilation* da;
69Runoff* runoff;
70double snow_days_between;
71bool nocompute, out_snow; // no computation, only parse inputs (check mode)
72};
73
74#endif

Archive Download this file

Revision: HEAD