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

Don't compute log10(chl) for small chl #305

Open
wants to merge 1 commit into
base: dev/ncar
Choose a base branch
from

Conversation

mnlevy1981
Copy link
Collaborator

if chl <= chl_min, we already have log10(chl_min) stored as a parameter. Avoiding the computation of log10(chl) in those cases prevents the possibility of a floating point exception (if chl <= 0), and this approach replaces a max() statement with an if block so it shouldn't affect performance.

This requires adding chl_min to the optics_type (which already has log10chl_min and log10chl_max).

if chl <= chl_min, we already have log10(chl_min) stored as a parameter.
Avoiding the computation of log10(chl) in those cases prevents the possibility
of a floating point exception, and lets us replace a max() statement with an if
check so it shouldn't affect performance.

This requires adding chl_min to the optics_type (which already has log10chl_min
and log10chl_max).
@mnlevy1981
Copy link
Collaborator Author

Note that this fix will allow us to run CESM with DEBUG=TRUE and CHL_FROM_FILE=False (if MARBL is available to provide CHL). Previously, debug tests were failing because MARBL was returning chl=0 at some points and MOM6 was dutifully trying to compute log10(chl) anyway. The MOM_interface tag that includes this MOM6 update should add an SMS_D test for C1850MARBL_JRA to aux_mom_MARBL (and maybe prebeta?) to make sure we can continue to run in debug mode if needed.

@mnlevy1981 mnlevy1981 marked this pull request as ready for review September 27, 2024 22:17
@mnlevy1981
Copy link
Collaborator Author

testing: Verified this is bit-for-bit in a one month test run (with MARBL providing chlorophyll)

@klindsay28
Copy link
Collaborator

@mnlevy1981 , do you know why this is needed in lookup_ohlmann_swpen, but not lookup_ohlmann_opacity, which has the same log10chl computation?
Perhaps @fobryan3 has an idea about this.

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

Successfully merging this pull request may close these issues.

2 participants