Skip to content

Commit

Permalink
Scales liquid redistribution by ratio of unfrozen sections
Browse files Browse the repository at this point in the history
Also adds some comments and cleanup details.
  • Loading branch information
rarutter committed Oct 17, 2024
1 parent 9e0b8b8 commit de2e897
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Ground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1570,9 +1570,12 @@ void Ground::splitOneSoilLayer(SoilLayer*usl, SoilLayer* lsl,
ice2 = lower_frozen_ratio * totice;
ice1 = totice - ice2;
}
else{
else{ //Both layers are completely thawed
if(totice > 0.0){
BOOST_LOG_SEV(glg, warn) << "Positive ice content when both layers are unfrozen";
}
ice2 = 0;
ice1 = totice; //Should be 0, but setting to totice just in case
ice1 = 0;
}

usl->ice = fmin(ice1, usl->maxice);
Expand All @@ -1583,9 +1586,14 @@ void Ground::splitOneSoilLayer(SoilLayer*usl, SoilLayer* lsl,
double unf1 = 1.0 - usl->frozenfrac;
double unf2 = 1.0 - lsl->frozenfrac;

double upper_unfrozen_dz = unf1 * usl->dz;
double lower_unfrozen_dz = unf2 * lsl->dz;
double total_unfrozen_dz = upper_unfrozen_dz + lower_unfrozen_dz;

//if either are partially or completely unfrozen
if(unf1>0.0 or unf2>0.0){
liq2 = lslfrac * totliq;
double lower_unfrozen_ratio = lower_unfrozen_dz/total_unfrozen_dz;
liq2 = lower_unfrozen_ratio * totliq;
liq1 = totliq - liq2;
}
else{ //if both are completely frozen
Expand Down

0 comments on commit de2e897

Please sign in to comment.