@@ -56,12 +56,15 @@ void CmvPrecipitation::Initialize()
5656 if (iFrom[q]==DOESNT_EXIST){iFrom[q]=iAtmos; } // since this routine reacts to presence or absence of individual state variables
5757 }
5858
59- // lake snow handling
59+ // frozen lake & wetland snow handling
6060 if (pModel->StateVarExists (ICE_THICKNESS))
6161 {
6262 iFrom[13 ]=pModel->GetStateVarIndex (SNOW); iTo[13 ]=pModel->GetLakeStorageIndex ();
6363 iFrom[14 ]=pModel->GetStateVarIndex (SNOW_LIQ); iTo[14 ]=pModel->GetLakeStorageIndex ();
6464 iFrom[15 ]=pModel->GetStateVarIndex (PONDED_WATER); iTo[15 ]=pModel->GetLakeStorageIndex ();
65+ iFrom[16 ]=pModel->GetStateVarIndex (SNOW); iTo[16 ]=pModel->GetStateVarIndex (DEPRESSION);
66+ iFrom[17 ]=pModel->GetStateVarIndex (SNOW_LIQ); iTo[17 ]=pModel->GetStateVarIndex (DEPRESSION);
67+ iFrom[18 ]=pModel->GetStateVarIndex (PONDED_WATER); iTo[18 ]=pModel->GetStateVarIndex (DEPRESSION);
6568 }
6669}
6770// ////////////////////////////////////////////////////////////////
@@ -167,9 +170,9 @@ void CmvPrecipitation::GetRatesOfChange(const double *state_vars,
167170 int qSnowToLake=13 ;
168171 int qSnLiqToLake=14 ;
169172 int qPondToLake=15 ;
170- // int qSnowToDep=16;
171- // int qSnLiqToDep=17;
172- // int qPondToDep=18;
173+ int qSnowToDep=16 ;
174+ int qSnLiqToDep=17 ;
175+ int qPondToDep=18 ;
173176
174177 // get precipitation information from gauges
175178 total_precip=pHRU->GetForcingFunctions ()->precip ;// [mm/day]
@@ -237,12 +240,15 @@ void CmvPrecipitation::GetRatesOfChange(const double *state_vars,
237240 rainthru = rainfall;
238241 }
239242
240- bool lake_frozen=false ;
243+ bool lake_frozen =false ;
241244 bool wetland_frozen=false ;
242245 if (pModel->StateVarExists (ICE_THICKNESS))
243246 {
244247 int iIceThick=pModel->GetStateVarIndex (ICE_THICKNESS);
245- if (state_vars[iIceThick]>10 ){lake_frozen=true ;}
248+ if (state_vars[iIceThick]>10 ){ // 10mm of ice can support snow?
249+ lake_frozen =true ;
250+ wetland_frozen=true ;
251+ }
246252 }
247253
248254 if ((pHRU->IsLake ()) && (!lake_frozen))
@@ -254,7 +260,7 @@ void CmvPrecipitation::GetRatesOfChange(const double *state_vars,
254260 rates[qLake]=snowthru+rainthru; // in lake, all water just added
255261 }
256262
257- if (pModel->StateVarExists (ICE_THICKNESS))// all remaining snow and ponded water dumped to lake
263+ if (pModel->StateVarExists (ICE_THICKNESS))// all remaining snow and ponded water dumped to lake \todo[funct]: handle multilayer snowpack models
258264 {
259265 rates[qSnowToLake ]+=state_vars[iSWE ]/Options.timestep ;
260266 rates[qSnLiqToLake]+=state_vars[iSnLiq]/Options.timestep ;
@@ -264,11 +270,15 @@ void CmvPrecipitation::GetRatesOfChange(const double *state_vars,
264270 {
265271 rates[qDep] =snowthru + rainthru; // all water goes to depression in wetland
266272
267- /* if (pModel->StateVarExists(ICE_THICKNESS))// \todo[funct]: all remaining snow and ponded water dumped to wetland/depression
273+ if (pModel->StateVarExists (ICE_THICKNESS))// all remaining snow and ponded water dumped to wetland/depression
268274 {
269275 rates[qSnowToDep ]+=state_vars[iSWE ]/Options.timestep ;
270276 rates[qSnLiqToDep]+=state_vars[iSnLiq]/Options.timestep ;
271- }*/
277+ }
278+ }
279+ else if (pHRU->GetHRUType () == HRU_WATER)
280+ {
281+ rates[qSW] =snowthru + rainthru; // all water goes to surface water
272282 }
273283 else // regular land, frozen lakes or frozen wetlands - treat snow
274284 {
@@ -307,7 +317,7 @@ void CmvPrecipitation::GetRatesOfChange(const double *state_vars,
307317 rates[qNewSnow]=snowthru;
308318 }
309319
310- if ( pHRU->IsLake ())
320+ if (pHRU->IsLake ())
311321 {
312322 if (pHRU->IsLinkedToReservoir ()) {
313323 rates[qSW]=rainthru; // handles case when both reservoirs and lake storage used
@@ -325,13 +335,13 @@ void CmvPrecipitation::GetRatesOfChange(const double *state_vars,
325335 {
326336 rates[qDep] =rainthru; // ponded water goes to depression in wetland
327337
328- /* if (pModel->StateVarExists(ICE_THICKNESS))
338+ if (pModel->StateVarExists (ICE_THICKNESS))
329339 {
330- rates[qPondToDep ]+=state_vars[iPond ]/Options.timestep; // \todo[funct]: handles on-wetland snowmelt whether ice is present or not
331- }*/
340+ rates[qPondToDep ]+=state_vars[iPond ]/Options.timestep ; // handles on-wetland snowmelt whether ice is present or not
341+ }
332342 }
333343 else {
334- // everything remaining goes to ponded water variable, usually handled by infiltration & abstraction algorithms
344+ // everything remaining goes to ponded water variable, usually handled by infiltration and/or abstraction algorithms
335345 rates[qPond]=rainthru;
336346 }
337347 }
0 commit comments