Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spack:
- "armadillo"
- "tbb"
- "eigen"
- "meteoio"
- "meteoio@2.11.0"
- "func@2.2.0: ~openmp"
- "trilinos@15: +mpi"
- "jemalloc"
Expand Down
687 changes: 686 additions & 1 deletion src/modules/snowpack.cpp

Large diffs are not rendered by default.

30 changes: 23 additions & 7 deletions src/modules/snowpack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,32 @@
* - "MS_WATER"
* - "MS_TOTALMASS"
* - "MS_SOIL_RUNOFF"
* - Top layer Snow sphericity "snow_sphericity" [-]
* - Top layer Snow grain size "snow_grain_size" [mm]
* - Top layer Fraction of ice content "frac_ice_content" [-]
* - Top layer Liquid water content "Sliq" [-]
* - Snow surface temperature "Tsnow" [\f$ {}^\circ C \f$]
* - Top layer Snow density "snow_density" [\f$ kg \cdot m^{-3} \f$]
*
* **Configuration:**
* \rst
* .. code:: json
*
* "Lehning_snowpack":
* {
* "sno":
* {
* "SoilAlbedo": 0.09,
* "BareSoil_z0": 0.2,
* "WindScalingFactor": 1,
* "TimeCountDeltaHS": 0.0 *
* }
* "sno":
* {
* "SoilAlbedo": 0.09,
* "BareSoil_z0": 0.2,
* "WindScalingFactor": 1,
* "TimeCountDeltaHS": 0.0
* },
* "GROOMING_WEEK_START": 40,
* "GROOMING_WEEK_END": 17,
* "GROOMING_HOUR": 21,
* "GROOMING_DEPTH_START": 0.4,
* "GROOMING_DEPTH_IMPACT": 0.4
* }
* \endrst
* @}
*/
Expand All @@ -119,6 +132,8 @@ REGISTER_MODULE_HPP(Lehning_snowpack);

virtual void init(mesh& domain);

virtual void checkpoint(mesh& domain, netcdf& chkpt);
virtual void load_checkpoint(mesh& domain, netcdf& chkpt);

struct data : public face_info
{
Expand All @@ -138,6 +153,7 @@ REGISTER_MODULE_HPP(Lehning_snowpack);
double cum_precip;

double sum_subl;
bool is_grooming; // Flag indicating if snow grooming is enabled for this face
};

double sn_dt; // calculation step length
Expand Down
22 changes: 12 additions & 10 deletions third_party/snowpack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ IF(ENABLE_LAPACK)
ENDIF(ENABLE_LAPACK)

SET(snowpacklib_sources
DataClasses.cc
SnowpackConfig.cc
Meteo.cc
Saltation.cc
Laws_sn.cc
Utils.cc
StabilityAlgorithms.cc
Stability.cc
Hazard.cc
SnowDrift.cc
DataClasses.cc
vanGenuchten.cc
SnowpackConfig.cc
Meteo.cc
Saltation.cc
Laws_sn.cc
Utils.cc
StabilityAlgorithms.cc
Stability.cc
Hazard.cc
SnowDrift.cc
TechnicalSnow.cc
${plugins_sources}
${core_sources}
)
Expand Down
18 changes: 5 additions & 13 deletions third_party/snowpack/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
#define SN_VERSION STR2( _VERSION )
#endif

/// @brief Initial value for stability parameter
#define INIT_STABILITY 999.

namespace Constants {
const double undefined = -999.; ///<This is the snowpack undefined value
const int iundefined = -999; ///<This is the snowpack undefined value
Expand All @@ -55,33 +52,29 @@ namespace Constants {

const double solcon = 1366.1; ///< Total Solar Irradiance (W m-2) (Froehlich, 2006)

const double gas_constant = 461.9; ///< (J mol-1 K-1)
const double gas_constant = 461.9; ///< (J kg-1 K-1)
const double gas_constant_air = 287.0; ///< for air (J kg-1 K-1)
const double gas_constant_mol = 8.31; ///< (J mol-1 K-1)
const double karman = 0.4; ///< Karman constant

/// @name Albedo (1)
//@{
const double min_albedo = 0.3;
const double max_albedo = 0.99;
const double max_albedo = 0.9;
const double glacier_albedo = 0.3;
//@}
/// @name Emissivity (1)
//@{
const double emissivity_snow = 0.98;
const double emissivity_soil = 0.95;

//@}
/// @name Density (kg m-3)
//@{
const double density_air = 1.1; ///< Approximation: use ideal gas law
const double density_ice = 917.0; ///< At T = 0 degC
const double density_water = 1000.0; ///< At T = 0 degC
const double density_vapor = 1.0; ///< Approximation: use ideal gas law
/// @name Max and min densities (kg m-3)
//@{
const double min_rho = 5.0;
const double max_rho = 1000.0;
//@}
//@}

///@name Specific heat (J kg-1 K-1)
//@{
Expand All @@ -106,8 +99,7 @@ namespace Constants {

///@name Phase change constants
//@{
const double melting_tk = 273.15; ///< (K)
const double freezing_tk = 273.15; ///< (K)
const double meltfreeze_tk = 273.15; ///< (K)
const double triple_point_t = 273.16; ///< (K)
const double triple_point_p = 611.73; ///< (Pa)
const double lh_sublimation = 2.838e6; ///< (J kg-1) (solid to vapor)
Expand Down
Loading