From 21fd4277c3da0f98848cb7238ecdb39f3e176f51 Mon Sep 17 00:00:00 2001 From: Gustavo Marques Date: Tue, 30 Jul 2019 15:49:50 -0600 Subject: [PATCH] Make sure that MEKE%GME_snk is only used when the array is allocated --- src/parameterizations/lateral/MOM_hor_visc.F90 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parameterizations/lateral/MOM_hor_visc.F90 b/src/parameterizations/lateral/MOM_hor_visc.F90 index efba8e8e8d..3e7b027ae3 100644 --- a/src/parameterizations/lateral/MOM_hor_visc.F90 +++ b/src/parameterizations/lateral/MOM_hor_visc.F90 @@ -1288,8 +1288,12 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US, if (k==1) then do j=js,je ; do i=is,ie MEKE%mom_src(i,j) = 0. - MEKE%GME_snk(i,j) = 0. enddo ; enddo + if (associated(MEKE%GME_snk)) then + do j=js,je ; do i=is,ie + MEKE%GME_snk(i,j) = 0. + enddo ; enddo + endif endif if (MEKE%backscatter_Ro_c /= 0.) then do j=js,je ; do i=is,ie