Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating point exception when using Medlyn stomatal conductance #1118

Open
JessicaNeedham opened this issue Nov 13, 2023 · 2 comments
Open

Comments

@JessicaNeedham
Copy link
Contributor

I’m getting a crash and the error “SIGFPE floating-point exception - erroneous arithmetic operation” when running with Medlyn stomatal conductance and DEBUG=TRUE, on Perlmutter CPUs, gnu compiler (global 4x5 run). With DEBUG=FALSE it runs but I get a lot of warnings “ FATESWARN: 1 m: Stomatal conductance error check - weak convergence: 0.168128E+06 0.159592E+06 “

The error with DEBUG=TRUE is being triggered here:

q = -0.5_r8 * (b - sqrt(b*b - 4._r8*a*c))

because ( b*b - 4._r8*a*c) is negative and we’re asking for a square root.

My parameter values are:
fates_leaf_stomatal_intercept = 10000, 10000, 10000, 10000, 10000, 10000,
10000, 10000, 10000, 10000, 10000, 40000 ;

fates_leaf_stomatal_slope_medlyn = 4.12, 2.35, 2.35, 4.12, 4.45, 4.45,
4.7, 4.7, 4.7, 2.22, 5.25, 1.62 ;

Can we wrap it in a max(0, ) term or should the model crash if this term becomes negative?

@mpaiao
Copy link
Contributor

mpaiao commented Nov 13, 2023

I guess it depends... If it is a tiny negative number, then I think it makes sense to assume this is just truncation error and set q=0. If not, then I think the model should crash.

@glemieux
Copy link
Contributor

Per the software meeting today, @JessicaNeedham noted that the sqrt number is on the order of -1e-7, so this isn't numerical precision.

We should add a check inside the function to make sure that we check b*b-4*a*c and output diagnostic warnings (i.e. values of a, b, and c), but from discussion we need to diagnose why we're getting a combo of these values in upstream code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ❕Todo
Development

No branches or pull requests

3 participants