Skip to content

Fixes recent regressions in heat initialization and refactors soil state variables

Brian Groenke requested to merge bgroenke/cryogridjulia:bugfix/heat-init into master

This fixes a bug in the new implementation of initialcondition! that incorrectly initialized the liquid water content.

In addition, it turns out that making the soil properties state variables has a considerable impact on performance for stiff solvers, even in the case where these variables remain constant throughout the integration. This is likely due to the considerable increase in computational complexity for autodiff; more state variables = more dual numbers (partial derivatives) to track and compute, though this extra work is largely pointless in the constant case since the derivatives are always zero.

As an optimization, we strike a compromise with the previous change allowing soil parameters to be state variables. We define a set of methods which can be overriden in the future to provide state vectors instead of scalar constants, in the case where soil properties (e.g. total water content, mineral content, etc) are variable. However, for configurations where these variables are held constant, no performance overhead will be incurred.

Merge request reports