Skip to content

Commit

Permalink
Fix division by zero using negative viscosity (backscatter)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
adcroft committed Dec 30, 2014
1 parent ed4a046 commit 14971b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parameterizations/lateral/MOM_hor_visc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14971b4

Please sign in to comment.