Skip to content

Commit

Permalink
Check if Kv is associated before updating it
Browse files Browse the repository at this point in the history
  • Loading branch information
alperaltuntas committed Jun 1, 2018
1 parent b2fac04 commit 21d1038
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/parameterizations/vertical/MOM_tidal_mixing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,11 @@ subroutine calculate_CVMix_tidal(h, j, G, GV, CS, N2_int, Kd, Kv)
enddo

! Update viscosity
do k=1,G%ke+1
Kv(i,j,k) = Kv(i,j,k) + Kv_tidal(k)
enddo
if (associated(Kv)) then
do k=1,G%ke+1
Kv(i,j,k) = Kv(i,j,k) + Kv_tidal(k)
enddo
endif

! diagnostics
if (associated(dd%Kd_itidal)) then
Expand Down Expand Up @@ -851,9 +853,11 @@ subroutine calculate_CVMix_tidal(h, j, G, GV, CS, N2_int, Kd, Kv)
enddo

! Update viscosity
do k=1,G%ke+1
Kv(i,j,k) = Kv(i,j,k) + Kv_tidal(k)
enddo
if (associated(Kv)) then
do k=1,G%ke+1
Kv(i,j,k) = Kv(i,j,k) + Kv_tidal(k)
enddo
endif

! diagnostics
if (associated(dd%Kd_itidal)) then
Expand Down Expand Up @@ -903,12 +907,7 @@ subroutine add_int_tide_diffusivity(h, N2_bot, j, TKE_to_Kd, max_TKE, G, GV, CS,
real, dimension(SZI_(G),SZJ_(G),SZK_(G)+1), optional, intent(inout) :: Kd_int
real, intent(inout) :: Kd_max

! This subroutine adds the effect of internal-tide-driven mixing to the layer diffusivities.
! The mechanisms considered are (1) local dissipation of internal waves generated by the
! barotropic flow ("itidal"), (2) local dissipation of internal waves generated by the propagating
! low modes (rays) of the internal tide ("lowmode"), and (3) local dissipation of internal lee waves.
! Will eventually need to add diffusivity due to other wave-breaking processes (e.g. Bottom friction,
! Froude-number-depending breaking, PSI, etc.).
! local

real, dimension(SZI_(G)) :: &
htot, & ! total thickness above or below a layer, or the
Expand Down

0 comments on commit 21d1038

Please sign in to comment.