From 8fb8aaf83b9afb8e10ea87f1084d0066f2707b47 Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Tue, 1 Oct 2024 13:53:13 -0600 Subject: [PATCH] Avoid chl=0 in lookup_ohlmann_opacity() previous commit only avoiding log10(0) in lookup_ohlmann_swpen() but we have another log10(chl) in the opacity function --- src/parameterizations/vertical/MOM_opacity.F90 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parameterizations/vertical/MOM_opacity.F90 b/src/parameterizations/vertical/MOM_opacity.F90 index 9d2339a440..b8b8c56d21 100644 --- a/src/parameterizations/vertical/MOM_opacity.F90 +++ b/src/parameterizations/vertical/MOM_opacity.F90 @@ -1377,7 +1377,11 @@ function lookup_ohlmann_opacity(chl,optics) result(B) integer :: n ! Make sure we are in the table - log10chl = max(optics%log10chl_min,min(log10(chl),optics%log10chl_max)) + if (chl > optics%chl_min) then + log10chl = min(log10(chl),optics%log10chl_max) + else + log10chl = optics%log10chl_min + endif ! Do a nearest neighbor lookup n = nint( (log10chl - optics%log10chl_min)/optics%dlog10chl ) + 1