OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
Global Snowmelt Processing Methods

Global snowmelt processing methods. More...

Collaboration diagram for Global Snowmelt Processing Methods:

Functions

int snow_readMeltParams (char *tok[], int ntoks)
 Reads snowmelt parameters from a tokenized line of input data.
 
int snow_createSnowpack (int subcatchIndex, int snowIndex)
 Creates a snowpack object for a subcatchment.
 
void snow_validateSnowmelt (int snowIndex)
 Checks for valid values in a snowmelt parameter set.
 
void snow_initSnowpack (int subcatchIndex)
 Initializes state of a subcatchment's snowpack.
 
void snow_initSnowmelt (int snowIndex)
 Initializes values in a snowmelt parameter set.
 
void snow_getState (int i, int j, double x[])
 Retrieves the current state of a snowpack object.
 
void snow_setState (int subcatchIndex, int subAreaIndex, double x[])
 Sets the current state of a snowpack object.
 
void snow_setMeltCoeffs (int snowIndex, double season)
 Sets values of snowmelt coefficients for a particular time of year.
 
void snow_plowSnow (int subcatchIndex, double tStep)
 Adds new snow to subcatchment and plows it between sub-areas.
 
double snow_getSnowMelt (int subcatchIndex, double rainfall, double snowfall, double tStep, double netPrecip[])
 Modifies rainfall input to subcatchment's subareas based on possible snow melt and updates snow depth over entire subcatchment.
 
double snow_getSnowCover (int subcatchIndex)
 Computes volume of snow on a subcatchment.
 

Detailed Description

Global snowmelt processing methods.

Function Documentation

◆ snow_createSnowpack()

int snow_createSnowpack ( int subcatchIndex,
int snowIndex )

Creates a snowpack object for a subcatchment.

Parameters
[in]subcatchIndexSubcatchment index
[in]snowIndexSnowmelt parameter set index
Returns
TRUE if successful, FALSE if not

Creates a snowpack object for a subcatchment.

Implementation arguments
  • subcatchIndex (in): Valid subcatchment index; no existing owned snowpack may be overwritten without first releasing it.
  • snowIndex (in): Valid snowmelt parameter-set index stored in the new pack.
Returns
TRUE after allocation and attachment, FALSE if allocation fails.
Note
Only snowmeltIndex is initialized here. Call snow_initSnowpack() before using state arrays; the project owns the allocated snowpack.
Here is the caller graph for this function:

◆ snow_getSnowCover()

double snow_getSnowCover ( int subcatchIndex)

Computes volume of snow on a subcatchment.

Parameters
[in]subcatchIndexSubcatchment index
Returns
Volume of snow cover (ft3)

Computes volume of snow on a subcatchment.

Implementation arguments
  • subcatchIndex (in): Valid subcatchment index.
Returns
Snowpack water-equivalent volume in cubic feet, or zero when no snowpack exists. Reads all three snow-surface area fractions without modifying state.
Here is the caller graph for this function:

◆ snow_getSnowMelt()

double snow_getSnowMelt ( int subcatchIndex,
double rainfall,
double snowfall,
double tStep,
double netPrecip[] )

Modifies rainfall input to subcatchment's subareas based on possible snow melt and updates snow depth over entire subcatchment.

Parameters
[in]subcatchIndexSubcatchment index
[in]rainfallRainfall (ft/sec)
[in]snowfallSnowfall (ft/sec)
[in]tStepTime step (sec)
[out]netPrecipRainfall + snowmelt on each runoff sub-area (ft/sec)
Returns
New snow depth over subcatchment

Modifies rainfall input to subcatchment's subareas based on possible snow melt and updates snow depth over entire subcatchment.

Implementation arguments
  • subcatchIndex (in): Valid subcatchment index with a non-null initialized snowpack.
  • rainfall (in): Liquid rainfall rate in feet per second.
  • snowfall (in): Snowfall water-equivalent rate in feet per second.
  • tStep (in): Positive melt/routing interval in seconds.
  • netPrecip (out): Borrowed writable array of at least three doubles, receiving rainfall plus melt in ft/s for the runoff subareas. Impervious snow-surface rates are combined into IMPERV0/IMPERV1 entries.
Returns
Area-weighted snow water-equivalent depth in feet.
Postcondition
Advances the selected pack's snow, free-water, cold-content, depletion and immediate-melt state; no output storage is retained.

◆ snow_getState()

void snow_getState ( int i,
int j,
double x[] )

Retrieves the current state of a snowpack object.

Parameters
[in]iSubcatchment index
[in]jSnowpack sub-area index
[out]xArray of snowpack state variables

Retrieves the current state of a snowpack object.

Implementation arguments
  • i (in): Valid subcatchment index; a missing snowpack leaves x unchanged.
  • j (in): Snow surface index SNOW_PLOWABLE..SNOW_PERV, in [0, 2].
  • x (out): Borrowed writable array of at least five doubles: snow water equivalent depth, free water, cold content, antecedent temperature and initial depletion-curve AWESI. Depths use feet and temperature uses degrees F.
Note
Preserves the internal cold-content/depletion representation for snow_setState(); no conversion, validation or storage retention occurs.

◆ snow_initSnowmelt()

void snow_initSnowmelt ( int snowIndex)

Initializes values in a snowmelt parameter set.

Parameters
[in]snowIndexSnowmelt parameter set index

Initializes values in a snowmelt parameter set.

Implementation arguments
  • snowIndex (in): Valid destination index into Snowmelt.
Postcondition
Clears three-surface melt, water and redistribution properties, sets the plowing trigger to 1e6 and clears the receiving-subcatchment reference.
Note
Does not allocate the Snowmelt array or initialize snowpack objects.

◆ snow_initSnowpack()

void snow_initSnowpack ( int subcatchIndex)

Initializes state of a subcatchment's snowpack.

Parameters
[in]subcatchIndexSubcatchment index

Initializes state of a subcatchment's snowpack.

Implementation arguments
  • subcatchIndex (in): Valid subcatchment index; a missing snowpack is a no-op.
Postcondition
Sets surface area fractions, snow/free-water depths, cold content, antecedent-temperature index and depletion state from the selected Snowmelt parameters, and writes Subcatch.newSnowDepth in feet of water equivalent.
Precondition
The pack's snowmeltIndex and subcatchment impervious fraction are valid.
Here is the caller graph for this function:

◆ snow_plowSnow()

void snow_plowSnow ( int subcatchIndex,
double tStep )

Adds new snow to subcatchment and plows it between sub-areas.

Parameters
[in]subcatchIndexSubcatchment index
[in]tStepTime step (sec)

Adds new snow to subcatchment and plows it between sub-areas.

Implementation arguments
  • subcatchIndex (in): Valid subcatchment index; missing snowpack is a no-op.
  • tStep (in): Positive accumulation/plowing interval in seconds.
Postcondition
Updates snow water-equivalent depths, immediate-melt rates, Snow.removed and any receiving subcatchment pack. Gage snowfall is scaled by snowScaleFactor and API snowfall is added before accumulation.
Precondition
Snowmelt redistribution targets and area fractions are validated.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ snow_readMeltParams()

int snow_readMeltParams ( char * tok[],
int ntoks )

Reads snowmelt parameters from a tokenized line of input data.

Parameters
[in]tokArray of string tokens
[in]ntoksNumber of tokens
Returns
Error code

Format of data are:

  • Name SubArea Cmin Cmax Tbase FWF SD0 FW0 SNN0/SD100
  • Name REMOVAL SDplow Fout Fimperv Fperv Fimelt Fsubcatch (Subcatch)
Implementation arguments
  • tok (in): Array of string tokens
  • ntoks (in): Number of tokens
    Returns
    Error code
    Format of data are:
  • Name SubArea Cmin Cmax Tbase FWF SD0 FW0 SNN0/SD100
  • Name REMOVAL SDplow Fout Fimperv Fperv Fimelt Fsubcatch (Subcatch)

Reads snow melt parameters from a tokenized line of input data. Format of data are: Name SubArea Cmin Cmax Tbase FWF SD0 FW0 SNN0/SD100 Name REMOVAL SDplow Fout Fimperv Fperv Fimelt Fsubcatch (Subcatch).

Here is the call graph for this function:

◆ snow_setMeltCoeffs()

void snow_setMeltCoeffs ( int snowIndex,
double season )

Sets values of snowmelt coefficients for a particular time of year.

Parameters
[in]snowIndexSnowmelt parameter set index
[in]seasonSeason of the year

Sets values of snowmelt coefficients for a particular time of year.

Implementation arguments
  • snowIndex (in): Valid Snowmelt parameter-set index.
  • season (in): Dimensionless seasonal factor, normally in [-1, 1]; -1 selects dhmin and +1 selects dhmax. Values are not clamped.
Postcondition
Stores interpolated dhm coefficients in the parameter set's internal units.

◆ snow_setState()

void snow_setState ( int subcatchIndex,
int subAreaIndex,
double x[] )

Sets the current state of a snowpack object.

Parameters
[in]subcatchIndexSubcatchment index
[in]subAreaIndexSnowpack sub-area index
[in]xArray of snowpack state variables

Sets the current state of a snowpack object.

Implementation arguments
  • subcatchIndex (in): Valid subcatchment index; missing snowpack is a no-op.
  • subAreaIndex (in): Snow surface index SNOW_PLOWABLE..SNOW_PERV, in [0, 2].
  • x (in): Borrowed readable array of at least five doubles in exactly the order/internal units returned by snow_getState().
Postcondition
Copies all five values without validation; aggregate subcatchment snow depth is not recomputed here. Input storage is not retained.

◆ snow_validateSnowmelt()

void snow_validateSnowmelt ( int snowIndex)

Checks for valid values in a snowmelt parameter set.

Parameters
[in]snowIndexSnowmelt parameter set index

Checks for valid values in a snowmelt parameter set.

Implementation arguments
  • snowIndex (in): Valid parameter-set index into Snowmelt.
Postcondition
Reports ERR_SNOWPACK_PARAMS if min melt coefficients exceed maxima, free-water or plowable fractions lie outside [0, 1], or redistribution fractions sum above 1.01. Does not repair parameter values.
Here is the call graph for this function:
Here is the caller graph for this function: