Skip to content

Commit 6c2822f

Browse files
Raphael DussinRaphael Dussin
authored andcommitted
add diagnostic for Kd_Work related to the Kd_add part
* also corrects some capitalization typos
1 parent 31a4d8b commit 6c2822f

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/parameterizations/vertical/MOM_set_diffusivity.F90

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ module MOM_set_diffusivity
182182
integer :: id_Kd_quad = -1, id_Kd_itidal = -1, id_Kd_Froude = -1, id_Kd_slope = -1
183183
integer :: id_prof_leak = -1, id_prof_quad = -1, id_prof_itidal= -1
184184
integer :: id_prof_Froude= -1, id_prof_slope = -1, id_bbl_thick = -1, id_kbbl = -1
185+
integer :: id_Kd_Work_added
185186
!>@}
186187

187188
end type set_diffusivity_CS
@@ -192,7 +193,8 @@ module MOM_set_diffusivity
192193
N2_3d => NULL(), & !< squared buoyancy frequency at interfaces [T-2 ~> s-2]
193194
Kd_user => NULL(), & !< user-added diffusivity at interfaces [H Z T-1 ~> m2 s-1 or kg m-1 s-1]
194195
Kd_BBL => NULL(), & !< BBL diffusivity at interfaces [H Z T-1 ~> m2 s-1 or kg m-1 s-1]
195-
Kd_work => NULL(), & !< layer integrated work by diapycnal mixing [R Z3 T-3 ~> W m-2]
196+
Kd_Work => NULL(), & !< layer integrated work by diapycnal mixing [R Z3 T-3 ~> W m-2]
197+
Kd_Work_added => NULL(), & !< layer integrated work by added mixing [R Z3 T-3 ~> W m-2]
196198
maxTKE => NULL(), & !< energy required to entrain to h_max [H Z2 T-3 ~> m3 s-3 or W m-2]
197199
Kd_bkgnd => NULL(), & !< Background diffusivity at interfaces [H Z T-1 ~> m2 s-1 or kg m-1 s-1]
198200
Kv_bkgnd => NULL(), & !< Viscosity from background diffusivity at interfaces [H Z T-1 ~> m2 s-1 or Pa s]
@@ -359,7 +361,8 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, Kd_i
359361

360362
if (CS%id_N2 > 0) allocate(dd%N2_3d(isd:ied,jsd:jed,nz+1), source=0.0)
361363
if (CS%id_Kd_user > 0) allocate(dd%Kd_user(isd:ied,jsd:jed,nz+1), source=0.0)
362-
if (CS%id_Kd_work > 0) allocate(dd%Kd_work(isd:ied,jsd:jed,nz), source=0.0)
364+
if (CS%id_Kd_Work > 0) allocate(dd%Kd_Work(isd:ied,jsd:jed,nz), source=0.0)
365+
if (CS%id_Kd_Work_added > 0) allocate(dd%Kd_Work_added(isd:ied,jsd:jed,nz), source=0.0)
363366
if (CS%id_maxTKE > 0) allocate(dd%maxTKE(isd:ied,jsd:jed,nz), source=0.0)
364367
if (CS%id_TKE_to_Kd > 0) allocate(dd%TKE_to_Kd(isd:ied,jsd:jed,nz), source=0.0)
365368
if ((CS%double_diffusion) .and. (CS%id_KT_extra > 0)) &
@@ -549,7 +552,7 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, Kd_i
549552
enddo ; enddo
550553
endif
551554

552-
if (CS%ML_radiation .or. CS%use_tidal_mixing .or. associated(dd%Kd_work)) then
555+
if (CS%ML_radiation .or. CS%use_tidal_mixing .or. associated(dd%Kd_Work)) then
553556
call thickness_to_dz(h, tv, dz, j, G, GV)
554557
endif
555558

@@ -662,7 +665,7 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, Kd_i
662665
enddo ; enddo
663666
endif
664667

665-
if (associated(dd%Kd_work)) then
668+
if (associated(dd%Kd_Work)) then
666669
do k=1,nz ; do i=is,ie
667670
dd%Kd_Work(i,j,k) = GV%H_to_RZ * Kd_lay_2d(i,k) * N2_lay(i,k) * dz(i,k) ! Watt m-2 = kg s-3
668671
enddo ; enddo
@@ -675,6 +678,12 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, Kd_i
675678
enddo ; enddo
676679
endif
677680

681+
if (associated(dd%Kd_Work_added)) then
682+
do k=1,nz ; do i=is,ie
683+
dd%Kd_Work_added(i,j,k) = GV%H_to_RZ * CS%Kd_add * N2_lay(i,k) * dz(i,k) ! Watt m-2 = kg s-3
684+
enddo ; enddo
685+
endif
686+
678687
! Copy the 2-d slices into the 3-d array that is exported; this was done above for Kd_int.
679688
if (present(Kd_lay)) then ; do k=1,nz ; do i=is,ie
680689
Kd_lay(i,j,k) = Kd_lay_2d(i,k)
@@ -754,12 +763,13 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, Kd_i
754763
if (CS%use_tidal_mixing) &
755764
call post_tidal_diagnostics(G, GV, h, CS%tidal_mixing)
756765

757-
if (CS%id_N2 > 0) call post_data(CS%id_N2, dd%N2_3d, CS%diag)
758-
if (CS%id_Kd_Work > 0) call post_data(CS%id_Kd_Work, dd%Kd_Work, CS%diag)
759-
if (CS%id_maxTKE > 0) call post_data(CS%id_maxTKE, dd%maxTKE, CS%diag)
760-
if (CS%id_TKE_to_Kd > 0) call post_data(CS%id_TKE_to_Kd, dd%TKE_to_Kd, CS%diag)
766+
if (CS%id_N2 > 0) call post_data(CS%id_N2, dd%N2_3d, CS%diag)
767+
if (CS%id_Kd_Work > 0) call post_data(CS%id_Kd_Work, dd%Kd_Work, CS%diag)
768+
if (CS%id_Kd_Work_added > 0) call post_data(CS%id_Kd_Work_added, dd%Kd_Work_added, CS%diag)
769+
if (CS%id_maxTKE > 0) call post_data(CS%id_maxTKE, dd%maxTKE, CS%diag)
770+
if (CS%id_TKE_to_Kd > 0) call post_data(CS%id_TKE_to_Kd, dd%TKE_to_Kd, CS%diag)
761771

762-
if (CS%id_Kd_user > 0) call post_data(CS%id_Kd_user, dd%Kd_user, CS%diag)
772+
if (CS%id_Kd_user > 0) call post_data(CS%id_Kd_user, dd%Kd_user, CS%diag)
763773

764774
! double diffusive mixing
765775
if (CS%double_diffusion) then
@@ -773,7 +783,8 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, Kd_i
773783
if (CS%id_Kd_BBL > 0) call post_data(CS%id_Kd_BBL, dd%Kd_BBL, CS%diag)
774784

775785
if (associated(dd%N2_3d)) deallocate(dd%N2_3d)
776-
if (associated(dd%Kd_work)) deallocate(dd%Kd_work)
786+
if (associated(dd%Kd_Work)) deallocate(dd%Kd_Work)
787+
if (associated(dd%Kd_Work_added)) deallocate(dd%Kd_Work_added)
777788
if (associated(dd%Kd_user)) deallocate(dd%Kd_user)
778789
if (associated(dd%maxTKE)) deallocate(dd%maxTKE)
779790
if (associated(dd%TKE_to_Kd)) deallocate(dd%TKE_to_Kd)
@@ -2517,6 +2528,8 @@ subroutine set_diffusivity_init(Time, G, GV, US, param_file, diag, CS, int_tide_
25172528
if (CS%use_tidal_mixing) then
25182529
CS%id_Kd_Work = register_diag_field('ocean_model', 'Kd_Work', diag%axesTL, Time, &
25192530
'Work done by Diapycnal Mixing', 'W m-2', conversion=US%RZ3_T3_to_W_m2)
2531+
CS%id_Kd_Work_added = register_diag_field('ocean_model', 'Kd_Work_added', diag%axesTL, Time, &
2532+
'Work done by additional mixing Kd_add', 'W m-2', conversion=US%RZ3_T3_to_W_m2)
25202533
CS%id_maxTKE = register_diag_field('ocean_model', 'maxTKE', diag%axesTL, Time, &
25212534
'Maximum layer TKE', 'm3 s-3', conversion=(GV%H_to_m*US%Z_to_m**2*US%s_to_T**3))
25222535
CS%id_TKE_to_Kd = register_diag_field('ocean_model', 'TKE_to_Kd', diag%axesTL, Time, &

0 commit comments

Comments
 (0)