Skip to content

Commit

Permalink
Merge pull request #1014 from marshallward/meke_diag_arrays
Browse files Browse the repository at this point in the history
MEKE diagnostic array fixes
  • Loading branch information
adcroft authored Oct 4, 2019
2 parents 57e5165 + cecc6e6 commit ceaca56
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/parameterizations/lateral/MOM_MEKE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ subroutine step_forward_MEKE(MEKE, h, SN_u, SN_v, visc, dt, G, GV, US, CS, hu, h
del4MEKE, & ! Time-integrated MEKE tendency arising from the biharmonic of MEKE [L2 T-2 ~> m2 s-2].
LmixScale, & ! Eddy mixing length [L ~> m].
barotrFac2, & ! Ratio of EKE_barotropic / EKE [nondim]
bottomFac2 ! Ratio of EKE_bottom / EKE [nondim]
bottomFac2, & ! Ratio of EKE_bottom / EKE [nondim]
tmp ! Temporary variable for diagnostic computation

real, dimension(SZIB_(G),SZJ_(G)) :: &
MEKE_uflux, & ! The zonal advective and diffusive flux of MEKE with different units in different
Expand Down Expand Up @@ -575,10 +576,29 @@ subroutine step_forward_MEKE(MEKE, h, SN_u, SN_v, visc, dt, G, GV, US, CS, hu, h
endif

! Offer fields for averaging.

if (any([CS%id_Ue, CS%id_Ub, CS%id_Ut] > 0)) &
tmp(:,:) = 0.

if (CS%id_MEKE>0) call post_data(CS%id_MEKE, MEKE%MEKE, CS%diag)
if (CS%id_Ue>0) call post_data(CS%id_Ue, sqrt(max(0.,2.0*MEKE%MEKE)), CS%diag)
if (CS%id_Ub>0) call post_data(CS%id_Ub, sqrt(max(0.,2.0*MEKE%MEKE*bottomFac2)), CS%diag)
if (CS%id_Ut>0) call post_data(CS%id_Ut, sqrt(max(0.,2.0*MEKE%MEKE*barotrFac2)), CS%diag)
if (CS%id_Ue>0) then
do j=js,je ; do i=is,ie
tmp(i,j) = sqrt(max(0., 2. * MEKE%MEKE(i,j)))
enddo ; enddo
call post_data(CS%id_Ue, tmp, CS%diag)
endif
if (CS%id_Ub>0) then
do j=js,je ; do i=is,ie
tmp(i,j) = sqrt(max(0., 2. * MEKE%MEKE(i,j) * bottomFac2(i,j)))
enddo ; enddo
call post_data(CS%id_Ub, tmp, CS%diag)
endif
if (CS%id_Ut>0) then
do j=js,je ; do i=is,ie
tmp(i,j) = sqrt(max(0., 2. * MEKE%MEKE(i,j) * barotrFac2(i,j)))
enddo ; enddo
call post_data(CS%id_Ut, tmp, CS%diag)
endif
if (CS%id_Kh>0) call post_data(CS%id_Kh, MEKE%Kh, CS%diag)
if (CS%id_Ku>0) call post_data(CS%id_Ku, MEKE%Ku, CS%diag)
if (CS%id_Au>0) call post_data(CS%id_Au, MEKE%Au, CS%diag)
Expand Down

0 comments on commit ceaca56

Please sign in to comment.