SNOWPACK 20260609.1e92c933
Physically based, energy balance snow cover model
Loading...
Searching...
No Matches
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
70 void RedepositSnow(CurrentMeteo Mdata, SnowStation& Xdata, SurfaceFluxes& Sdata, double redeposit_mass, const std::string density_redep="EVENT");
71
80
81 double getParameterizedAlbedo(const SnowStation& Xdata,
82 const CurrentMeteo& Mdata) const;
83 double getModelAlbedo(const SnowStation& Xdata, CurrentMeteo& Mdata) const;
84
85 protected:
86
87 bool compTemperatureProfile(const CurrentMeteo& Mdata, SnowStation& Xdata,
88 BoundCond& Bdata,
89 const bool& ThrowAtNoConvergence);
90
92
93 private:
94 static void EL_INCID(const int &e, int Ie[]);
95 static void EL_TEMP( const int Ie[], double Te0[], double Tei[], const std::vector<NodeData> &T0, const double Ti[] );
96 static void EL_RGT_ASSEM(double F[], const int Ie[], const double Fe[]);
97
98 void compSnowCreep(const CurrentMeteo& Mdata, SnowStation& Xdata);
99
100 bool sn_ElementKtMatrix(ElementData &Edata, double dt, const double dvdz, double T0[ N_OF_INCIDENCES ],
101 double Se[ N_OF_INCIDENCES ][ N_OF_INCIDENCES ], double Fe[ N_OF_INCIDENCES ],
102 const double VaporEnhance);
103
104 void updateBoundHeatFluxes(BoundCond& Bdata, SnowStation& Xdata, const CurrentMeteo& Mdata);
105
106 void neumannBoundaryConditions(const CurrentMeteo& Mdata, BoundCond& Bdata, const SnowStation& Xdata,
107 const double& T_snow, const double& T_iter,
108 double Se[ N_OF_INCIDENCES ][ N_OF_INCIDENCES ],
109 double Fe[ N_OF_INCIDENCES ]);
110
111 void neumannBoundaryConditionsSoil(const double& flux, const double& T_snow,
112 double Se[ N_OF_INCIDENCES ][ N_OF_INCIDENCES ],
113 double Fe[ N_OF_INCIDENCES ]);
114
115 void assignSomeFluxes(SnowStation& Xdata, const CurrentMeteo& Mdata, const double& mAlb,
116 SurfaceFluxes& Sdata);
117
118 void setHydrometeorMicrostructure(const CurrentMeteo& Mdata, const bool& is_surface_hoar, ElementData &EMS);
119
120 void fillNewSnowElement(const CurrentMeteo& Mdata, const double& length, const double& density, double& theta_water,
121 const bool& is_surface_hoar, const unsigned short& number_of_solutes, ElementData &elem);
122
123 void compTechnicalSnow(const CurrentMeteo& Mdata, SnowStation& Xdata, double& cumu_precip);
124
125 void compSnowFall(CurrentMeteo& Mdata, SnowStation& Xdata, double& cumu_precip,
126 SurfaceFluxes& Sdata);
127
128 const SnowpackConfig& cfg;
129
130 TechSnow techsnow;
131 std::string variant, viscosity_model, watertransportmodel_snow, watertransportmodel_soil;
132 std::string hn_density, hn_density_parameterization;
133 std::string sw_mode, snow_albedo, albedo_parameterization, albedo_average_schmucki, sw_absorption_scheme;
134 Meteo::ATM_STABILITY atm_stability_model;
135 double albedo_NIED_av;
136 double albedo_fixedValue, hn_density_fixedValue;
137 double meteo_step_length;
138 double thresh_change_bc, geo_heat, height_of_meteo_values, height_new_elem, sn_dt;
139 double t_crazy_min, t_crazy_max, thresh_rh, thresh_dtempAirSnow;
140 double new_snow_dd, new_snow_sp, new_snow_dd_wind, new_snow_sp_wind, rh_lowlim, bond_factor_rh;
141 double new_snow_grain_size, new_snow_bond_size;
142 double hoar_density_buried, hoar_density_surf, hoar_min_size_buried;
143 double minimum_l_element, comb_thresh_l;
144 double t_surf;
145 bool allow_adaptive_timestepping;
146 bool research_mode, useCanopyModel, enforce_measured_snow_heights, detect_grass;
147 bool soil_flux, useSoilLayers;
148 bool coupled_phase_changes;
149 bool combine_elements, reduce_n_elements, force_add_snowfall, change_bc, meas_tss;
150 bool vw_dendricity;
151 bool enhanced_wind_slab;
152 std::string snow_erosion; // erosion of snow: NONE, HS_DRIVEN, FREE, VIRTUAL or REDEPOSIT
153 std::string snow_redistribution; // redistribution of snow from windward (luv) slope to leeward slope
154 bool alpine3d;
155 bool ageAlbedo;
156 const static double min_allowed_sn_dt;
157 const static bool hydrometeor;
158 const static double snowfall_warning;
159 const static unsigned int new_snow_marker;
160 bool adjust_height_of_meteo_values, adjust_height_of_wind_value;
161 bool advective_heat;
162 double heat_begin, heat_end;
163 double temp_index_degree_day, temp_index_swr_factor;
164 bool allow_freezing_rain;
165 bool forestfloor_alb;
166 bool rime_index, newsnow_lwc, read_dsm;
167 std::string soil_evaporation, soil_thermal_conductivity;
168}; //end class Snowpack
169
170#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:654
Class of interpolated meteo data for the current calculation time step.
Definition DataClasses.h:895
The physical properties of an individual element used in snow layers (one or multiple elements are co...
Definition DataClasses.h:212
ATM_STABILITY
Definition Meteo.h:39
Station data including all information on snowpack layers (elements and nodes) and on canopy.
Definition DataClasses.h:533
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 RedepositSnow(CurrentMeteo Mdata, SnowStation &Xdata, SurfaceFluxes &Sdata, double redeposit_mass, const std::string density_redep="EVENT")
Redeposit snow that was eroded. This is used either with EROSION_REDEPOSIT or SNOW_REDISTRIBUTION....
Definition Snowpack.cc:2003
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:2124
BoundaryCondition
Specifies what kind of boundary condition is to be implemented at the top surface....
Definition Snowpack.h:76
@ DIRICHLET_BC
Definition Snowpack.h:78
@ NEUMANN_BC
Definition Snowpack.h:77
double getModelAlbedo(const SnowStation &Xdata, CurrentMeteo &Mdata) const
Definition Snowpack.cc:807
void snowPreparation(const mio::Date &currentDate, SnowStation &Xdata) const
Perform snow preparation (grooming, etc) on a given snowpack.
Definition Snowpack.cc:2366
double getSnDt() const
Definition Snowpack.h:61
BoundaryCondition surfaceCode
Definition Snowpack.h:91
double getParameterizedAlbedo(const SnowStation &Xdata, const CurrentMeteo &Mdata) const
Definition Snowpack.cc:749
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:856
void setUseSoilLayers(const bool &value)
Definition Snowpack.cc:318
The surface fluxes data as computed by Snowpack.
Definition DataClasses.h:675
Implementation of snow grooming.
Definition TechnicalSnow.h:42