Skip to content

Commit 14971b4

Browse files
committed
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.
1 parent ed4a046 commit 14971b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/parameterizations/lateral/MOM_hor_visc.F90

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, CS, OBC)
470470
if (Kh >= hrat_min*CS%Kh_Max_xy(I,J)) then
471471
visc_bound_rem = 0.0
472472
Kh = hrat_min*CS%Kh_Max_xy(I,J)
473-
else
473+
elseif (CS%Kh_Max_xy(I,J)>0.) then
474474
!visc_bound_rem = 1.0 - abs(Kh) / (hrat_min*CS%Kh_Max_xy(I,J))
475475
visc_bound_rem = 1.0 - Kh / (hrat_min*CS%Kh_Max_xy(I,J))
476476
endif

0 commit comments

Comments
 (0)