Skip to content

Commit

Permalink
+Revamped MOM_diapyc_energy_req.F90
Browse files Browse the repository at this point in the history
  Updated the test-code for calculating diapycnal mixing energy requirements,
and added calls (controlled by the undocumented run-time parameter
DEBUG_ENERGY_REQ) within MOM_diabatic_driver to call this code.  The energy
requiments can now be applied for successive addition of diffusivities. This
checkin involves changes to some internal interfaces, but all solutions are
bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Sep 12, 2016
1 parent 2b4a8fb commit 2577c8a
Show file tree
Hide file tree
Showing 2 changed files with 804 additions and 121 deletions.
17 changes: 16 additions & 1 deletion src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module MOM_diabatic_driver
use MOM_diag_mediator, only : diag_ctrl, time_type, diag_update_target_grids
use MOM_diag_mediator, only : diag_ctrl, query_averaging_enabled
use MOM_diag_to_Z, only : diag_to_Z_CS, register_Zint_diag, calc_Zint_diags
use MOM_diapyc_energy_req, only : diapyc_energy_req_init, diapyc_energy_req_end
use MOM_diapyc_energy_req, only : diapyc_energy_req_calc, diapyc_energy_req_test, diapyc_energy_req_CS
use MOM_diffConvection, only : diffConvection_CS, diffConvection_init
use MOM_diffConvection, only : diffConvection_calculate, diffConvection_end
use MOM_domains, only : pass_var, To_West, To_South
Expand Down Expand Up @@ -78,7 +80,7 @@ module MOM_diabatic_driver
!! in the surface boundary layer.
logical :: use_kappa_shear !< If true, use the kappa_shear module to find the
!! shear-driven diapycnal diffusivity.
logical :: use_cvmix_shear !< If true, use the CVMix module to find the
logical :: use_cvmix_shear !< If true, use the CVMix module to find the
!! shear-driven diapycnal diffusivity.
logical :: use_sponge !< If true, sponges may be applied anywhere in the
!! domain. The exact location and properties of
Expand Down Expand Up @@ -139,6 +141,7 @@ module MOM_diabatic_driver
!! is statically unstable.
logical :: debug !< If true, write verbose checksums for debugging purposes.
logical :: debugConservation !< If true, monitor conservation and extrema.
logical :: debug_energy_req ! If true, test the mixing energy requirement code.
type(diag_ctrl), pointer :: diag !< structure used to regulate timing of diagnostic output
real :: MLDdensityDifference !< Density difference used to determine MLD_user
integer :: nsw !< SW_NBANDS
Expand Down Expand Up @@ -196,6 +199,7 @@ module MOM_diabatic_driver
type(diag_to_Z_CS), pointer :: diag_to_Z_CSp => NULL()
type(KPP_CS), pointer :: KPP_CSp => NULL()
type(diffConvection_CS), pointer :: Conv_CSp => NULL()
type(diapyc_energy_req_CS), pointer :: diapyc_en_rec_CSp => NULL()

type(group_pass_type) :: pass_hold_eb_ea !< For group halo pass

Expand Down Expand Up @@ -358,6 +362,10 @@ subroutine diabatic(u, v, h, tv, fluxes, visc, ADp, CDp, dt, G, GV, CS)
endif
if (CS%debugConservation) call MOM_state_stats('Start of diabatic', u, v, h, tv%T, tv%S, G)

if (CS%debug_energy_req) &
call diapyc_energy_req_test(h, dt, tv, G, GV, CS%diapyc_en_rec_CSp)


call cpu_clock_begin(id_clock_set_diffusivity)
call set_BBL_TKE(u, v, h, fluxes, visc, G, GV, CS%set_diff_CSp)
call cpu_clock_end(id_clock_set_diffusivity)
Expand Down Expand Up @@ -1842,6 +1850,9 @@ subroutine diabatic_driver_init(Time, G, GV, param_file, useALEalgorithm, diag,
"If true, write out verbose debugging data.", default=.false.)
call get_param(param_file, mod, "DEBUG_CONSERVATION", CS%debugConservation, &
"If true, monitor conservation and extrema.", default=.false.)

call get_param(param_file, mod, "DEBUG_ENERGY_REQ", CS%debug_energy_req, &
"If true, debug the energy requirements.", default=.false., do_not_log=.true.)
call get_param(param_file, mod, "MIX_BOUNDARY_TRACERS", CS%mix_boundary_tracers, &
"If true, mix the passive tracers in massless layers at \n"//&
"the bottom into the interior as though a diffusivity of \n"//&
Expand Down Expand Up @@ -2182,6 +2193,8 @@ subroutine diabatic_driver_init(Time, G, GV, param_file, useALEalgorithm, diag,

call regularize_layers_init(Time, G, param_file, diag, CS%regularize_layers_CSp)

if (CS%debug_energy_req) &
call diapyc_energy_req_init(G, param_file, CS%diapyc_en_rec_CSp)

! obtain information about the number of bands for penetrative shortwave
if (use_temperature) then
Expand Down Expand Up @@ -2219,6 +2232,8 @@ subroutine diabatic_driver_end(CS)
if (CS%useConvection) call diffConvection_end(CS%Conv_CSp)
if (CS%use_energetic_PBL) &
call energetic_PBL_end(CS%energetic_PBL_CSp)
if (CS%debug_energy_req) &
call diapyc_energy_req_end(CS%diapyc_en_rec_CSp)

if (associated(CS%optics)) then
call opacity_end(CS%opacity_CSp, CS%optics)
Expand Down
Loading

0 comments on commit 2577c8a

Please sign in to comment.