CH-Earth / summa

Structure for Unifying Multiple Modeling Alternatives:
http://www.ral.ucar.edu/projects/summa
GNU General Public License v3.0
80 stars 104 forks source link

Fix for segfault on reference to `mw_exp` when using JRDN snow layering #445

Closed arbennett closed 3 years ago

arbennett commented 3 years ago

Occasionally, when using JRDN snow layering I have run into segfaults on reference to mw_exp (only when doing scalar solutions) in the line:

iLayerLiqFluxSnow(iLayer)      = k_snow*relSaturn**mw_exp

after some debugging it turns out this loss of access to mw_exp occurs directly following the pack statement:

ixLayerDesired = pack(ixLayerState, ixSnowOnlyHyd/=integerMissing)

I have not been able to determine the exact reason for this error, but have developed a workaround, which is provided in this PR.

Solves #446