@@ -30,7 +30,8 @@ module MOM_diagnose_mld
30
30
! > Diagnose a mixed layer depth (MLD) determined by a given density difference with the surface.
31
31
! > This routine is appropriate in MOM_diabatic_aux due to its position within the time stepping.
32
32
subroutine diagnoseMLDbyDensityDifference (id_MLD , h , tv , densityDiff , G , GV , US , diagPtr , &
33
- ref_h_mld , id_ref_z , id_ref_rho , id_N2subML , id_MLDsq , dz_subML )
33
+ ref_h_mld , id_ref_z , id_ref_rho , id_N2subML , id_MLDsq , &
34
+ dz_subML , MLD_out )
34
35
type (ocean_grid_type), intent (in ) :: G ! < Grid type
35
36
type (verticalGrid_type), intent (in ) :: GV ! < ocean vertical grid structure
36
37
type (unit_scale_type), intent (in ) :: US ! < A dimensional unit scaling type
@@ -48,6 +49,8 @@ subroutine diagnoseMLDbyDensityDifference(id_MLD, h, tv, densityDiff, G, GV, US,
48
49
integer , optional , intent (in ) :: id_MLDsq ! < Optional handle (ID) of squared MLD
49
50
real , optional , intent (in ) :: dz_subML ! < The distance over which to calculate N2subML
50
51
! ! or 50 m if missing [Z ~> m]
52
+ real , dimension (SZI_(G),SZJ_(G)), &
53
+ optional , intent (out ) :: MLD_out ! < Send MLD to other routines [Z ~> m]
51
54
52
55
! Local variables
53
56
real , dimension (SZI_(G)) :: deltaRhoAtKm1, deltaRhoAtK ! Density differences [R ~> kg m-3].
@@ -234,11 +237,16 @@ subroutine diagnoseMLDbyDensityDifference(id_MLD, h, tv, densityDiff, G, GV, US,
234
237
if ((id_ref_z > 0 ) .and. (pRef_MLD(is)/= 0 .)) call post_data(id_ref_z, z_ref_diag , diagPtr)
235
238
if (id_ref_rho > 0 ) call post_data(id_ref_rho, rhoSurf_2d , diagPtr)
236
239
240
+ if (present (MLD_out)) then
241
+ MLD_out(:,:) = 0.0
242
+ MLD_out(is:ie,js:je) = MLD(is:ie,js:je)
243
+ endif
244
+
237
245
end subroutine diagnoseMLDbyDensityDifference
238
246
239
247
! > Diagnose a mixed layer depth (MLD) determined by the depth a given energy value would mix.
240
248
! > This routine is appropriate in MOM_diabatic_aux due to its position within the time stepping.
241
- subroutine diagnoseMLDbyEnergy (id_MLD , h , tv , G , GV , US , Mixing_Energy , diagPtr )
249
+ subroutine diagnoseMLDbyEnergy (id_MLD , h , tv , G , GV , US , Mixing_Energy , diagPtr , MLD_out )
242
250
! Author: Brandon Reichl
243
251
! Date: October 2, 2020
244
252
! //
@@ -270,6 +278,8 @@ subroutine diagnoseMLDbyEnergy(id_MLD, h, tv, G, GV, US, Mixing_Energy, diagPtr)
270
278
type (thermo_var_ptrs), intent (in ) :: tv ! < Structure containing pointers to any
271
279
! ! available thermodynamic fields.
272
280
type (diag_ctrl), pointer :: diagPtr ! < Diagnostics structure
281
+ real , dimension (SZI_(G),SZJ_(G)), &
282
+ optional , intent (out ) :: MLD_out ! < Send MLD to other routines [Z ~> m]
273
283
274
284
! Local variables
275
285
real , dimension (SZI_(G),SZJ_(G),3 ) :: MLD ! Diagnosed mixed layer depth [Z ~> m].
@@ -325,8 +335,6 @@ subroutine diagnoseMLDbyEnergy(id_MLD, h, tv, G, GV, US, Mixing_Energy, diagPtr)
325
335
PE_threshold(iM) = Mixing_Energy(iM) / GV% g_Earth_Z_T2
326
336
enddo
327
337
328
- MLD(:,:,:) = 0.0
329
-
330
338
EOSdom(:) = EOS_domain(G% HI)
331
339
332
340
do j= js,je
@@ -467,6 +475,11 @@ subroutine diagnoseMLDbyEnergy(id_MLD, h, tv, G, GV, US, Mixing_Energy, diagPtr)
467
475
if (id_MLD(2 ) > 0 ) call post_data(id_MLD(2 ), MLD(:,:,2 ), diagPtr)
468
476
if (id_MLD(3 ) > 0 ) call post_data(id_MLD(3 ), MLD(:,:,3 ), diagPtr)
469
477
478
+ if (present (MLD_out)) then
479
+ MLD_out(:,:) = 0.0
480
+ MLD_out(is:ie,js:je) = MLD(is:ie,js:je,1 )
481
+ endif
482
+
470
483
end subroutine diagnoseMLDbyEnergy
471
484
472
485
! > \namespace mom_diagnose_mld
0 commit comments