Skip to content

Commit

Permalink
Changed kv to a pointer since it might not always be associated
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-marques committed Apr 4, 2018
1 parent 0ce9980 commit 36f7a06
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/parameterizations/vertical/MOM_bkgnd_mixing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ subroutine calculate_bkgnd_mixing(h, tv, N2_lay, kd_lay, kv, j, G, GV, CS)
real, dimension(SZI_(G),SZK_(G)), intent(in) :: N2_lay!< squared buoyancy frequency associated
!! with layers (1/s2)
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), intent(inout) :: kd_lay!< Diapycnal diffusivity of each layer m2 s-1.
real, dimension(SZI_(G),SZJ_(G),SZK_(G)+1), intent(out) :: kv !< The "slow" vertical viscosity at each interface
real, dimension(:,:,:), pointer :: kv !< The "slow" vertical viscosity at each interface
!! (not layer!) in m2 s-1.
integer, intent(in) :: j !< Meridional grid indice.
type(bkgnd_mixing_cs), pointer :: CS !< The control structure returned by
Expand Down Expand Up @@ -415,11 +415,13 @@ subroutine calculate_bkgnd_mixing(h, tv, N2_lay, kd_lay, kv, j, G, GV, CS)
endif

! Update kv
do i=is,ie
do k=1,nz+1
kv(i,j,k) = kv(i,j,k) + CS%kv_bkgnd(i,j,k)
if (associated(kv)) then
do i=is,ie
do k=1,nz+1
kv(i,j,k) = kv(i,j,k) + CS%kv_bkgnd(i,j,k)
enddo
enddo
enddo
endif

end subroutine calculate_bkgnd_mixing

Expand Down

0 comments on commit 36f7a06

Please sign in to comment.