CICE-Consortium / Icepack

Development repository for sea-ice column physics
Other
25 stars 131 forks source link

exponential underflows in dEdd shortwave #118

Closed eclare108213 closed 6 years ago

eclare108213 commented 6 years ago

Some compilers are complaining about underflows in the shortwave calculation. These are coming from exponentials with very small arguments. The current code to get rid of those values does not avoid their being calculated in the first place:

argmax = 10. exp_min = exp(-argmax) f = max(exp(-A), exp_min) ! exp(-A) is what we are trying to compute

We should do this instead:

argmax = 10. exp_min = min(argmax, A) f = exp(-exp_min)

This type of calculation occurs in 3 places in icepack_shortwave.F90. I expect this to change the answers (nonBFB).

apcraig commented 6 years ago

I will take this on as one of my next tasks, after a couple other tasks....

apcraig commented 6 years ago

I've implemented this on a branch and am testing, PR soon.

eclare108213 commented 6 years ago

Fixed in PR #127