Open apcraig opened 6 years ago
Try uncommenting lines 563, 564 in icedrv_step.F90. This could fix a number of problems, e.g. issues #48 , #167 . Underflows also appear in the CICE dynamics subroutine stress; this issue is bigger than Icepack. There are different kinds of underflows: those that occur because there isn't any ice (we should mask), those that occur because of coding choices (recode), and those that are produced by a parameterization for physical reasons. The latter comes in different flavors, e.g. radiation attentuation and internal stresses, and will need to be taken on a case-by-case basis. But we could definitely make the trapping more consistent within these types.
I search the code (cicecore and icepack) for underflow instances, and did not find others besides the ones in evp and eap and the ones that were discussed and/or fixed here:
exponential underflows in dEdd shortwave #118 icepack_algae underflow #126 fix shortwave underflows and mechred divide by zero #127 PR ice_brine exception #129 fix more icepack debug errors #132 PR fix underflow in brine #158 PR fix mechred exp underflows #169 PR
I also looked at all of the places where puny (10^-11) is used. These are mostly to prevent divide-by-zero, for masking purposes, or for certain physical states (e.g. snow depth disappears during melting, or the sun being below the horizon). These all seem fine to me.
I propose the following:
Currently, the underflow trapping is not entirely consistent, which maybe is fine. But it was done somewhat adhoc. Review and modify if appropriate. For instance, maybe we should compute ln(tiny) to define the exp_argmax instead of choosing it arbitrarily. Or maybe exp_argmax should be more uniform across the code. Or maybe there are other approaches.