SNOWPACK 20241221.26c8720
PhaseChange.h
Go to the documentation of this file.
1/*
2 * SNOWPACK stand-alone
3 *
4 * Copyright WSL Institute for Snow and Avalanche Research SLF, DAVOS, SWITZERLAND
5*/
6/* This file is part of Snowpack.
7 Snowpack 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 Snowpack 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 Snowpack. If not, see <http://www.gnu.org/licenses/>.
19*/
20#ifndef PHASE_CHANGE_H
21#define PHASE_CHANGE_H
22
24#include <meteoio/MeteoIO.h>
25
34 public:
35 PhaseChange(const SnowpackConfig& i_cfg);
36
37 void reset();
38 void initialize(SnowStation& Xdata); //Call before first call to compPhaseChange in a time step
39 void finalize(const SurfaceFluxes& Sdata, SnowStation& Xdata, const mio::Date& date_in); //Call after last call to compPhaseChange in a time step
40 double compPhaseChange(SnowStation& Xdata, const mio::Date& date_in, const bool& verbose=true); //Call to do a phase change in a time step, returning the temperature of the top node (K)
41
42 static const double RE_theta_r;
43 static const double RE_theta_threshold;
44 static const double theta_r;
45
46 private:
47 //To prevent string comparisons, we define an enumerated list:
48 enum watertransportmodels{BUCKET, NIED, RICHARDSEQUATION};
49 watertransportmodels iwatertransportmodel_snow, iwatertransportmodel_soil;
50
51 std::string watertransportmodel_snow;
52 std::string watertransportmodel_soil;
53 void compSubSurfaceMelt(ElementData& Edata, const unsigned int nSolutes, const double& dt,
54 double& ql_Rest, const mio::Date& date_in);
55 void compSubSurfaceFrze(ElementData& Edata, const unsigned int nSolutes, const double& dt,
56 const mio::Date& date_in);
57
58 const double sn_dt;
59
60 double cold_content_in;
61 double cold_content_soil_in;
62 double cold_content_out;
63 double cold_content_soil_out;
64
65 const bool alpine3d;
66 double t_crazy_min, t_crazy_max;
67 double max_theta_ice;
68
69 static const double theta_s;
70
71 bool enable_ice_reservoir;
72};
73
74#endif
ELEMENT DATA used as a pointer in the SnowStation structure NOTE on M below: this is the mass of an e...
Definition: DataClasses.h:285
This class contains the phase change routines for the 1d snowpack model It also updates the volumetri...
Definition: PhaseChange.h:33
static const double RE_theta_threshold
Threshold Water Content for snow, when using water transport model "RICHARDSEQUATION",...
Definition: PhaseChange.h:43
void reset()
Definition: PhaseChange.cc:104
void initialize(SnowStation &Xdata)
Definition: PhaseChange.cc:315
double compPhaseChange(SnowStation &Xdata, const mio::Date &date_in, const bool &verbose=true)
Driving routine for subsurface melting and refreezing as well as surface melting. The basic equation ...
Definition: PhaseChange.cc:409
PhaseChange(const SnowpackConfig &i_cfg)
Definition: PhaseChange.cc:70
static const double RE_theta_r
Residual Water Content for snow, when using water transport model "RICHARDSEQUATION".
Definition: PhaseChange.h:42
static const double theta_r
Residual Water Content for snow and soil, when using water transport model "BUCKET" or "NIED".
Definition: PhaseChange.h:44
void finalize(const SurfaceFluxes &Sdata, SnowStation &Xdata, const mio::Date &date_in)
Definition: PhaseChange.cc:342
Definition: DataClasses.h:604
Definition: SnowpackConfig.h:28
Definition: DataClasses.h:733