SNOWPACK  SNOWPACK-3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
23 #include <snowpack/DataClasses.h>
24 #include <meteoio/MeteoIO.h>
25 
33 class PhaseChange {
34  public:
35  PhaseChange(const SnowpackConfig& i_cfg);
36  void initialize(SnowStation& Xdata); //Call before first call to compPhaseChange in a time step
37  void finalize(const SurfaceFluxes& Sdata, SnowStation& Xdata, const mio::Date& date_in); //Call after last call to compPhaseChange in a time step
38  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)
39 
40  static const double RE_theta_r;
41  static const double RE_theta_threshold;
42  static const double theta_r;
43 
44  private:
45  //To prevent string comparisons, we define an enumerated list:
46  enum watertransportmodels{BUCKET, NIED, RICHARDSEQUATION};
47  watertransportmodels iwatertransportmodel_snow, iwatertransportmodel_soil;
48 
49  std::string watertransportmodel_snow;
50  std::string watertransportmodel_soil;
51  void compSubSurfaceMelt(ElementData& Edata, const unsigned int nSolutes, const double& dt,
52  double& ql_Rest, const mio::Date& date_in);
53  void compSubSurfaceFrze(ElementData& Edata, const unsigned int nSolutes, const double& dt,
54  const mio::Date& date_in);
55 
56  double sn_dt;
57 
58  double cold_content_in;
59  double cold_content_soil_in;
60  double cold_content_out;
61  double cold_content_soil_out;
62 
63  bool alpine3d;
64  double t_crazy_min, t_crazy_max;
65 
66  static const double theta_s;
67 };
68 
69 #endif
Definition: SnowpackConfig.h:28
static const double RE_theta_r
Residual Water Content for snow, when using water transport model "RICHARDSEQUATION".
Definition: PhaseChange.h:40
static const double RE_theta_threshold
Threshold Water Content for snow, when using water transport model "RICHARDSEQUATION", to determine what is dry and wet snow.
Definition: PhaseChange.h:41
ELEMENT DATA used as a pointer in the SnowStation structure NOTE on M below: this is the mass of an e...
Definition: DataClasses.h:251
Definition: DataClasses.h:580
PhaseChange(const SnowpackConfig &i_cfg)
Definition: PhaseChange.cc:48
static const double theta_r
Residual Water Content for snow and soil, when using water transport model "BUCKET" or "NIED"...
Definition: PhaseChange.h:42
This class contains the phase change routines for the 1d snowpack model It also updates the volumetri...
Definition: PhaseChange.h:33
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:393
void initialize(SnowStation &Xdata)
Definition: PhaseChange.cc:299
void finalize(const SurfaceFluxes &Sdata, SnowStation &Xdata, const mio::Date &date_in)
Definition: PhaseChange.cc:326
Station data including all information on snowpack layers (elements and nodes) and on canopy This is...
Definition: DataClasses.h:463