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

avoid very small stability values #426

Closed martynpclark closed 3 years ago

martynpclark commented 3 years ago

The "standard" option for the stability correction is zero above the critical Richardson number. This provides an angle discontinuity -- close to the critical Richardson number values. The other stability corrections are more smooth.

To reduce numerical problems, the stability correction for the "standard" option sets stability to epsilon (~10^-16) if the bulk Richardson number is higher than the critical Richardson number. This still causes convergence problems. Suggest a minor modification to set the stability correction to 10^-10 if the Richardson number is above the critical value.

martynpclark commented 3 years ago

Just for completeness, epsilon(stabilityCorrection) is a small number (epsilon) of type stabilityCorrection, i.e., EPSILON(X) returns the smallest number E of the same kind as X such that 1 + E > 1.

bartnijssen commented 3 years ago

Oh I see - I did not realize fortran had an intrinsic function for that purpose. Disregard - I'll approve and merge the PR.