SNOWPACK  SNOWPACK-3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Hazard.h
Go to the documentation of this file.
1 /* **********************************************************************************************/
2 /* stand-alone */
3 /* Derived from RESEARCH VERSION 9.0 */
4 /* **********************************************************************************************/
5 /* **********************************************************************************/
6 /* Copyright WSL Institute for Snow and Avalanche Research SLF-DAVOS */
7 /* **********************************************************************************/
8 /* This file is part of Snowpack.
9  Snowpack is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  Snowpack is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with Snowpack. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
29 #ifndef HAZARD_H
30 #define HAZARD_H
31 
32 #include <meteoio/MeteoIO.h>
33 #include <snowpack/DataClasses.h>
34 #include <vector>
35 
40 class Hazard {
41  public:
42  Hazard(const SnowpackConfig& cfg, const double duration);
43 
44  void initializeHazard(std::vector<double>& vecDrift, double slope_angle,
45  std::vector<ProcessDat>& Hdata, std::vector<ProcessInd>& Hdata_ind);
46 
47  void getHazardDataMainStation(ProcessDat& Hdata, ProcessInd& Hdata_ind,
48  ZwischenData& Zdata, const double& newDrift, const bool stationDriftIndex,
49  const SnowStation& Xdata, const CurrentMeteo& Mdata, const SurfaceFluxes& Sdata);
50 
51  void getHazardDataSlope(ProcessDat& Hdata, ProcessInd& Hdata_ind,
52  std::vector<double>& drift24, const double& newDrift, const SnowStation& Xdata,
53  const bool luvDriftIndex, const bool north, const bool south);
54 
56  static const double minimum_drift, maximum_drift;
57 
58  private:
59  enum ActVec {
60  noAction=0, // neither shift nor overwite index values
61  overwrite, // overwrite <index>[0] w/o shifting
62  pushOverwrite // push vector values and overwrite <index>[0]
63  };
64 
65  void actOnVector(std::vector<double>& oldVector, const double& newValue, const ActVec& action);
66 
67  double compDriftIndex(std::vector<double>& vecDrift, const double& drift, const double& rho,
68  const unsigned int& nHours, const double& slope_angle, const ActVec& action);
69 
70  void getDriftIndex(ProcessDat& Hdata, ProcessInd& Hdata_ind,
71  std::vector<double>& vecDrift, const double& newDriftValue, const double slope_angle);
72 
73  double compHoarIndex(std::vector<double> &oldHoar, const double& newHoar,
74  const unsigned int& nHours, const ActVec& action);
75 
76  double compDewPointDeficit(double TA, double TSS, double RH);
77 
78  void compMeltFreezeCrust(const SnowStation& Xdata, ProcessDat& Hdata, ProcessInd& Hdata_ind);
79 
80  bool research_mode, enforce_measured_snow_heights, force_rh_water;
81  unsigned int nHz, hazard_steps_between;
82  double sn_dt;
83  double hoar_density_surf, hoar_min_size_surf;
84 };
85 
86 #endif
ZwischenData contains "memory" information mainly for operational use It is used to prepare some para...
Definition: DataClasses.h:63
void initializeHazard(std::vector< double > &vecDrift, double slope_angle, std::vector< ProcessDat > &Hdata, std::vector< ProcessInd > &Hdata_ind)
Allocates and initializes Hazard data.
Definition: Hazard.cc:126
Definition: SnowpackConfig.h:28
Definition: Hazard.h:40
Definition: DataClasses.h:580
static const double typical_slope_length
Definition: Hazard.h:55
CurrentMeteo is the class of interpolated meteo data for the current calculation time step It contai...
Definition: DataClasses.h:81
void getHazardDataMainStation(ProcessDat &Hdata, ProcessInd &Hdata_ind, ZwischenData &Zdata, const double &newDrift, const bool stationDriftIndex, const SnowStation &Xdata, const CurrentMeteo &Mdata, const SurfaceFluxes &Sdata)
Compute the Hdata from main station data.
Definition: Hazard.cc:284
static const double wind_slab_density
Definition: Hazard.h:55
Hazard(const SnowpackConfig &cfg, const double duration)
Definition: Hazard.cc:54
Structure of double values for output to SDB.
Definition: DataClasses.h:707
Station data including all information on snowpack layers (elements and nodes) and on canopy This is...
Definition: DataClasses.h:463
static const double minimum_drift
Definition: Hazard.h:56
void getHazardDataSlope(ProcessDat &Hdata, ProcessInd &Hdata_ind, std::vector< double > &drift24, const double &newDrift, const SnowStation &Xdata, const bool luvDriftIndex, const bool north, const bool south)
Compute Hdata from virtual slope data.
Definition: Hazard.cc:510
static const double maximum_drift
Definition: Hazard.h:56
Definition: DataClasses.h:771