From 14971b41024b96eda983b26d34b78894ec73c40e Mon Sep 17 00:00:00 2001 From: Alistair Adcroft Date: Tue, 30 Dec 2014 13:59:55 -0500 Subject: [PATCH] Fix division by zero using negative viscosity (backscatter) - Added a test for Kh_Max_xy(I,J)>0 when bounding the lateral viscosity. When Kh is negative, the if test that would normally avoid the division by zero does not apply. - No answer changes. --- src/parameterizations/lateral/MOM_hor_visc.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parameterizations/lateral/MOM_hor_visc.F90 b/src/parameterizations/lateral/MOM_hor_visc.F90 index c25b8a08b9..8cc8753523 100644 --- a/src/parameterizations/lateral/MOM_hor_visc.F90 +++ b/src/parameterizations/lateral/MOM_hor_visc.F90 @@ -470,7 +470,7 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, CS, OBC) if (Kh >= hrat_min*CS%Kh_Max_xy(I,J)) then visc_bound_rem = 0.0 Kh = hrat_min*CS%Kh_Max_xy(I,J) - else + elseif (CS%Kh_Max_xy(I,J)>0.) then !visc_bound_rem = 1.0 - abs(Kh) / (hrat_min*CS%Kh_Max_xy(I,J)) visc_bound_rem = 1.0 - Kh / (hrat_min*CS%Kh_Max_xy(I,J)) endif