SNOWPACK 3.7.0
Snowpack.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*/
26#ifndef SNOWPACK_H
27#define SNOWPACK_H
28
29#include <snowpack/Meteo.h>
31#include <snowpack/SnowDrift.h>
35
36#include <meteoio/MeteoIO.h>
37#include <vector>
38#include <string>
39
41#define N_OF_INCIDENCES 2
42
43class Snowpack {
44
45 public:
46 Snowpack(const SnowpackConfig& i_cfg);
47
48 void runSnowpackModel(CurrentMeteo& Mdata, SnowStation& Xdata, double& cumu_precip,
49 BoundCond& Bdata, SurfaceFluxes& Sdata);
50
56 void snowPreparation(const mio::Date& currentDate, SnowStation& Xdata) const;
57
58 void setUseSoilLayers(const bool& value);
59 const static double min_ice_content;
60
61 double getSnDt() const { return sn_dt;}
62
63 void setSnDt(const double& snDt) { sn_dt = snDt;}
64
72 };
73
74 double getParameterizedAlbedo(const SnowStation& Xdata,
75 const CurrentMeteo& Mdata) const;
76 double getModelAlbedo(const SnowStation& Xdata, CurrentMeteo& Mdata) const;
77
78 protected:
79
80 bool compTemperatureProfile(const CurrentMeteo& Mdata, SnowStation& Xdata,
81 BoundCond& Bdata,
82 const bool& ThrowAtNoConvergence);
83
85
86 private:
87 static void EL_INCID(const int &e, int Ie[]);
88 static void EL_TEMP( const int Ie[], double Te0[], double Tei[], const std::vector<NodeData> &T0, const double Ti[] );
89 static void EL_RGT_ASSEM(double F[], const int Ie[], const double Fe[]);
90
91 void compSnowCreep(const CurrentMeteo& Mdata, SnowStation& Xdata);
92
93 bool sn_ElementKtMatrix(ElementData &Edata, double dt, const double dvdz, double T0[ N_OF_INCIDENCES ],
94 double Se[ N_OF_INCIDENCES ][ N_OF_INCIDENCES ], double Fe[ N_OF_INCIDENCES ],
95 const double VaporEnhance);
96
97 void updateBoundHeatFluxes(BoundCond& Bdata, SnowStation& Xdata, const CurrentMeteo& Mdata);
98
99 void neumannBoundaryConditions(const CurrentMeteo& Mdata, BoundCond& Bdata, const SnowStation& Xdata,
100 const double& T_snow, const double& T_iter,
101 double Se[ N_OF_INCIDENCES ][ N_OF_INCIDENCES ],
102 double Fe[ N_OF_INCIDENCES ]);
103
104 void neumannBoundaryConditionsSoil(const double& flux, const double& T_snow,
105 double Se[ N_OF_INCIDENCES ][ N_OF_INCIDENCES ],
106 double Fe[ N_OF_INCIDENCES ]);
107
108 void assignSomeFluxes(SnowStation& Xdata, const CurrentMeteo& Mdata, const double& mAlb,
109 SurfaceFluxes& Sdata);
110
111 void setHydrometeorMicrostructure(const CurrentMeteo& Mdata, const bool& is_surface_hoar, ElementData &EMS);
112
113 void fillNewSnowElement(const CurrentMeteo& Mdata, const double& length, const double& density,
114 const bool& is_surface_hoar, const unsigned short& number_of_solutes, ElementData &elem);
115
116 void compTechnicalSnow(const CurrentMeteo& Mdata, SnowStation& Xdata, double& cumu_precip);
117
118 void compSnowFall(const CurrentMeteo& Mdata, SnowStation& Xdata, double& cumu_precip,
119 SurfaceFluxes& Sdata);
120
121 const SnowpackConfig& cfg;
122
123 TechSnow techsnow;
124 std::string variant, viscosity_model, watertransportmodel_snow, watertransportmodel_soil;
125 std::string hn_density, hn_density_parameterization;
126 std::string sw_mode, snow_albedo, albedo_parameterization, albedo_average_schmucki, sw_absorption_scheme;
127 Meteo::ATM_STABILITY atm_stability_model;
128 double albedo_NIED_av;
129 double albedo_fixedValue, hn_density_fixedValue;
130 double meteo_step_length;
131 double thresh_change_bc, geo_heat, height_of_meteo_values, height_new_elem, sn_dt;
132 double t_crazy_min, t_crazy_max, thresh_rh, thresh_dtempAirSnow;
133 double new_snow_dd, new_snow_sp, new_snow_dd_wind, new_snow_sp_wind, rh_lowlim, bond_factor_rh;
134 double new_snow_grain_size, new_snow_bond_size;
135 double hoar_density_buried, hoar_density_surf, hoar_min_size_buried;
136 double minimum_l_element, comb_thresh_l;
137 double t_surf;
138 bool allow_adaptive_timestepping;
139 bool research_mode, useCanopyModel, enforce_measured_snow_heights, detect_grass;
140 bool soil_flux, useSoilLayers;
141 bool coupled_phase_changes;
142 bool combine_elements, reduce_n_elements, change_bc, meas_tss;
143 bool vw_dendricity;
144 bool enhanced_wind_slab;
145 bool alpine3d;
146 bool ageAlbedo;
147
148 const static double min_allowed_sn_dt;
149 const static bool hydrometeor;
150 const static double snowfall_warning;
151 const static unsigned int new_snow_marker;
152 bool adjust_height_of_meteo_values, adjust_height_of_wind_value;
153 bool advective_heat;
154 double heat_begin, heat_end;
155 double temp_index_degree_day, temp_index_swr_factor;
156 bool forestfloor_alb;
157 bool rime_index, newsnow_lwc, read_dsm;
158 std::string soil_evaporation, soil_thermal_conductivity;
159}; //end class Snowpack
160
161#endif
#define N_OF_INCIDENCES
The number of element incidences.
Definition: Snowpack.h:41
BoundCond is used to set Neumann boundary conditions.
Definition: DataClasses.h:713
CurrentMeteo is the class of interpolated meteo data for the current calculation time step It contai...
Definition: DataClasses.h:83
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
ATM_STABILITY
Definition: Meteo.h:39
Definition: DataClasses.h:604
Definition: SnowpackConfig.h:28
Definition: Snowpack.h:43
void setSnDt(const double &snDt)
Definition: Snowpack.h:63
static const double min_ice_content
Min volumetric ice content allowed.
Definition: Snowpack.h:59
void runSnowpackModel(CurrentMeteo &Mdata, SnowStation &Xdata, double &cumu_precip, BoundCond &Bdata, SurfaceFluxes &Sdata)
The near future (s. below) has arrived on Wednesday Feb. 6, when it was finally snowing in Davos and ...
Definition: Snowpack.cc:1962
Snowpack(const SnowpackConfig &i_cfg)
Definition: Snowpack.cc:87
BoundaryCondition
Specifies what kind of boundary condition is to be implemented at the top surface....
Definition: Snowpack.h:69
@ DIRICHLET_BC
Definition: Snowpack.h:71
@ NEUMANN_BC
Definition: Snowpack.h:70
double getModelAlbedo(const SnowStation &Xdata, CurrentMeteo &Mdata) const
Definition: Snowpack.cc:789
void snowPreparation(const mio::Date &currentDate, SnowStation &Xdata) const
Perform snow preparation (grooming, etc) on a given snowpack.
Definition: Snowpack.cc:2186
double getSnDt() const
Definition: Snowpack.h:61
BoundaryCondition surfaceCode
Definition: Snowpack.h:84
double getParameterizedAlbedo(const SnowStation &Xdata, const CurrentMeteo &Mdata) const
Definition: Snowpack.cc:731
bool compTemperatureProfile(const CurrentMeteo &Mdata, SnowStation &Xdata, BoundCond &Bdata, const bool &ThrowAtNoConvergence)
Computes the snow temperatures which are given by the following formula: .
Definition: Snowpack.cc:838
void setUseSoilLayers(const bool &value)
Definition: Snowpack.cc:306
Definition: DataClasses.h:733
Implementation of snow grooming.
Definition: TechnicalSnow.h:42