Skip to content

Bug fixes

  • peripheral and rare (if ever) bugs
    • More precision for the lat/lon fields in the .pro and .met files
    • The current implementation did not support sno smet files providing easting/northing instead of latitude/longitude, it now does.
    • Fixed a minor bug: when looking for frozen layers, the top one was always skipped
    • Fixed two small bugs: starting a loop at the wrong index (the "e-->0" trick decrements first, before netering into the loop!)
    • Properly setting the Hdata_ind for lwi computed with only one slope (this was missing and creating trouble for the database)
    • Fixing a potential bug. Potentially, the bug may mess up with volumetric contents and mass of elements, although I'm not sure if I ever encountered it.
    • Fixing a bug that is likely of no interest to anyone. But because we can have multiple phase changes in a time step, we should add the change in liquid water content instead of assigning it.
  • Energy balance related bugs
    • fixed issue 382 (strong TSS oscillations) after a very long fight...
    • Solving a bug where SNOW surface temperature could become above 0 degC. This particularly happened when the element itself remained below 0 degC and only the surface node exceeded 0 degC. Then no phase change occured, so the top node remains above 0 degC. This commit makes the surface node "consistent", although it creates a small violation in maintaining energy balance.
    • The problem of snow surface temperatures above 0 degC was very present and visible, but the opposite may very, very rarely also occur: cooling wet snow elements may get a surface temperature below 0 degC, altough the element itself doesn't undergo phasechange. This is much less likely, as wet elements are 0 degC, and basically every drop in surface temperature will result in freezing of the surface element. But let's make things consistent.
    • Fix for occasional "temperature above melting point" warnings. The commit also bounds the nodal temperatures in alpine3d simulations.
    • For Alpine3D, the out of bound temperatures are now only a warning and the element temperature gets reset to (hopefully) meaningful values. For Snowpack, this remains an exception.
    • The check for invalid temperatures was based on arbitrary (and fixed) values. This was inconsistent with the definition of t_crazy (min and max). So now the check is performed with t_crazy instead.
    • After running into some snow albedo issues, I saw that the lower limit of snow albedo was provided by the albedo of soil, which is not desirable for a detailed snow model. They are not related. Now snow albedo has its own limits that are enforced.
  • Richards Equation solver
    • SafeMode was not really working when ice was present in soil. Some redesign work to improve the safe mode workings and to more accurately calculate the mass balance error due to the safe mode.
    • Switching on the safemode for Richards equation solver by default, to make it more user-friendly
    • Fixing a mass balance error when using Richards Equation for cases where more than 1 element is merged at once, and it turns out to be complete melt.
    • Improving the LIMITEDFLUX approach for infiltration: it appeared that oscillating behaviour could occur in the calculated limited flux, leading to small time steps
    • Sublimation in ReSolver1d.cc for limitedfluxevaporation boundary condition: elements may not get 0. mass, as we do not pass through mergeElements anymore to remove them. Fixed
    • Overlooked something when using RE for snow: snow melt of a previously dry layer should also trigger the restructuring algorithm for nodal and element temperatures. This solves many of the warnings that "Snow temperature is above melting point" and provides a slight improvement in satisfying the energy balance.
    • When pure ice layers are present, richards equation will crash (of course, how to permeate 100% ice with water?). Therefore, we place a hard limit of a maximum volumetric ice content of 99%, ice above this threshold will be melted. This is actually not far away from reality, where ice is often permeable to some degree.
    • Improved treatment of ice layers in Richards equation solver
    • Improving stability of Richards equation solver with ice layers. We need to limit maximum settling, so we don't get saturated layers
    • Bug fix in soil freezing with Richards equation (not properly initialized variable)
  • others
    • Fixed a VERY SERIOUS bug that lead to underestimation of the new snow sums in operational systems
    • Fixing two mass fluxes errors: an inappropriate bug fix (this had to be in Alpine3D, not in Snowpack where it was conflicting with a initialization done in the Main) and a proper initialization of mass fluxes to zero when creating an object (so Alpine3D does not show random MS_SOIL_RUNOFF at the first time step).
    • Sometimes, the normal load gets negative and this create problems in setShearStrengthDEFAULT (log of negative number). This has been fixed.
    • Now using the new MeteoIO C_T_K and K_TO_C methods (from IOUtils). This actually solved a numerical issue in the stability indices.
    • Fixed a stack pointer getting wild... this was randomly corrupting data in Stability.
    • When merging elements, it turned out to be a more consistent approach to keep the density of the lower element constant. Often elements that are "removed" (in fact: merged), have low density, as they are melting. This artificially seemed to produce lighter lower elements.
    • Bug fix for some unrealistic element merging occurring every now and then.
    • Solving a bug where SNOWPACK is not always correctly identifying ice layers from the marker when determining snow type.
    • Solving an issue that when sw_mode == "BOTH", ISWR and RSWR were set to 0 when either one was missing. This is a rather inconvenient approach. This commit uses the parameterized albedo instead.
    • Fixing the option: SW_ABSORPTION_SCHEME = SINGLE_BAND, thereby closing issue 378.
    • reducing the number of calls to Canopy (issue 470)

New features

  • Precipitation parameter renamed: instead of HNW it is now PSUM
  • Mixed precipitation supprt: a new field has to be provided, PSUM_PH that contains the precipitation phase (between 0 and 1; 0 being fully solid and 1 fully liquid). If not measured, PSUM_PH can be provided by a data generator in MeteoIO (this has been committed to MeteoIO) or otherwise a simple temperature threshold is provided as fallback in the Main.
  • Richards Equation solver
    • Allowing to specify the lower boundary condition for Richards equation in the ini file, using the key LB_COND_WATERFLUX. Implemented choices are: WATERTABLE (recommended), FREEDRAINAGE (recommended and default), DIRICHLET, GRAVITATIONALDRAINAGE and SEEPAGE. DIRICHLET behaviour changed a bit. It now takes the values at the boundaries and keep those constant over the time step and doesn't prescribe saturation anymore. WATERTABLE explicitly prescribes a saturated Dirichlet lower boundary condition. There is the option NEUMANN available to prescribe a constant flux. However, there are not many interesting applications for this, so an advanced user should dive in the source code when he wants to enable this one. However, it is in there for technical reasons, as FREEDRAINAGE, GRAVITATIONALDRAINAGE and SEEPAGE are Neumann-type boundary conditions.
    • Change to make simulations with Richards equation almost perfectly matching simulations with Bucket for DRY snowpacks.
    • Changing the default water retention curve of snow to the Yamaguchi et al. (2012) one, in line with publication: doi:10.5194/tcd-9-2655-2015, where it is shown that this provides a better agreement with observations.
  • API (ie for Alpine3D)
    • Implementation of a mechanism to reduce the number of elements deeper in the snowpack, and splitting the elements again when they come closer to the surface. Of interest for simulations with Glaciers or deep firn, to reduce the computational load. Activate by having both COMBINE_ELEMENTS and REDUCE_N_ELEMENTS set in to true in the ini-file. VERY EXPERIMENTAL!!
    • Methods have been added to average (actually, to multiply by any factor) the fluxes in SurfaceFluxes and CanopyData.
    • Add SurfaceFluxes::averageEnergyFluxes() for Alpine3D.
    • DataClasses: Adding insertion and extraction (<<, >>) operators for most classes. Reason: These data types are used in the MPI version of A3D, where serialization and deserialization is mandatory.
    • SurfaceFluxes: Adding insertion and extraction operator implementations to allow serialization and deserialization of these objects.
    • Adding serialization/deserialization for class CurrentMeteo and a default constructor, which is needed when deserializing the object in A3D
  • new modules
    • Created a plugin for reading CAAML profiles
    • Introduce a very simple constant degree day melt model, which only is active as long as the surface layer is melting and replaces the other energy fluxes; more complex version may be implemented later
    • 2-layer canopy model with litter albedo

Code cleanup, warnings and error messages

  • structure cleanup
    • Trying to better organize the sources by creating a plugins directory and moving core files into a snowpackCore directory
    • Restructuring the code used when starting a simulation, for greater clarity (still quite a long way to go, though!)
    • re-organizing the albedo (parametrized vs measured) code
    • Some includes cleanup (ie avoiding including Solver.h if not necessary) and lots of cleanup in Solver (removing the macros from the .h to the .cc, deleting the unused macros, deleting unused functions and only leaving the prototypes of API-like functions in the .h)
    • Removing an obsolete key
  • general code cleanup
    • code cleanup in Laws_sn
    • Adding WindScalingFactor and TimeCountDeltaHS to SnowStation, which in turn allows to remove SN_SNOWSOIL_DATA SSdata from the writeSnowCover routines.
    • Just make things with the explicit/implicit boundary conditions a little clearer. SNOWPACK should work the same as before this commit.
  • debugging support
    • The toString() method has been added to LayerData
    • A few new methods have been added: BoundCond::toString() for debugging
    • Adding two new assert() to better catch stability.cc issues
  • warnings
    • Removing duplicated code that was leading to the "shadowed variables" warning
    • The (very large number of) warnings in AsciiIO now belong to the past: the offending code has been re-written in pure c++ in order to properly deal with size_t
    • Fixed all the "printf" warnings. Most of the "printf" have been replaced by streams (I'm not really in love with those...) for consistency
    • Fixed all the gcc warnings in Solver.cc as well as some code cleanup (if such a thing is possible there...)
    • Many fixes for Clang warnings including in Solver.cc
  • error messages
    • now enforcing the new values for the SNOW key: either SMET or CAAML or SNOOLD
    • Warn users when they use RE-solver and compiled SNOWPACK with DEBUG_ARITHM set to ON. This is very likely to quickly result in a Floating point exception.
    • Adding an error messages when the user configured snow temperatures but did not provide them
    • better error messages for ImisDBIO (now fully functional sql querries that can be hand-tested on the side for debugging)
    • Improved error messages when reading sno files
    • Improving error message when richards equation doesn't converge, including a few suggestions for how to resolve the issue.
    • Improving the error/warning messages related to non-convergence of the solver.
    • Root uptake of liquid water becomes a sink term in the richards equation when using richards equation for soil. It is the method proposed in issue 471, but there is no safety mechanism in place when transpiration exceeds available water in the soil. But the error message provides some guidance on this

Build system, packaging and documentation

  • build system
    • Improved options for gcc compilations, including the use of LTO in release mode (this makes simulation 25% faster) and SANITIZE in debug (this makes the runtime around twice as long).
    • Implemented fix to remove cmake warning on osX
    • Add a check on inshell when preparing a bundle
    • Allowing the svn version to be used also on Windows
    • Improved detection of Snowpack that also work properly on WinXP
    • removing popc compilation support as well as unused cmake policies
  • documentation
    • The config.dox file has also been updated (to remove the warnings).
    • Improved documentation
    • Trying to build a better structured and user friendly documentation...
    • More documentation about file formats
    • The documentation has been improved by removing deprecated links, adding a mention of SnopViz, documenting some undocumented parameters, etc
    • The example simulations have been ported to the latest version of the code and therefore run again!
  • packaging and platform integration
    • Small fix so when a local svn check out is used for the bundled MeteoIO, the doc path is set differently (so there is no need install MeteoIO on the system for it to be used)
    • Windows: Better link in the start menu and using the improved MeteoIO detection
    • Windows: Add link in the start menu of Windows systems to our hosted version of SnopViz
    • Windows: return EXIT_FAILURE instead of exit(1) when catching exceptions (to avoid the MS "program crashed" kind of screen), no versioning on the installation directory but versionning in the name appearing in "Add/Remove software"
    • Windows: the libraries are now compiled in bin and installed directly in bin. This makes a slightly different directory structure depending on the OS but behaves much more naturally in Windows and avoids duplicating large libraries. The Windows package is now a quarter of what it was without these changes.
    • Since developing with Snowpack usually starts by getting the current source code, there is no need to distribute the dev libraries in the standard package, so this has been removed (and makes the Windows package much smaller). Same reasoning for the MeteoIO examples that have been removed.
    • osX: now offering Clang compilation options very similar to what is offered by Gcc. The debug mode warnings are now very, very picky!