22 use cvmix_shear
, only : cvmix_init_shear, cvmix_coeffs_shear
    24 implicit none ; 
private    26 #include <MOM_memory.h>    32   logical :: use_lmd94, use_pp81
    36   real, 
allocatable, 
dimension(:,:,:) :: n2
    37   real, 
allocatable, 
dimension(:,:,:) :: s2
    38   character(10) :: mix_scheme
    41 character(len=40)  :: 
mdl = 
"MOM_CVMix_shear"    50   real, 
dimension(SZI_(G),SZJ_(G),SZK_(G)),   
intent(in)  :: u_H
    51   real, 
dimension(SZI_(G),SZJ_(G),SZK_(G)),   
intent(in)  :: v_H
    52   real, 
dimension(SZI_(G),SZJ_(G),SZK_(G)),   
intent(in)  :: h
    54   real, 
dimension(SZI_(G),SZJ_(G),SZK_(G)+1), 
intent(out) :: KH
    56   real, 
dimension(SZI_(G),SZJ_(G),SZK_(G)+1), 
intent(out) :: KM
    61   integer :: i, j, k, kk, km1
    63   real :: pref, DU, DV, DRHO, DZ, N2, S2
    64   real, 
dimension(2*(G%ke)) :: pres_1d, temp_1d, salt_1d, rho_1d
    65   real, 
dimension(G%ke+1) ::  Ri_Grad
    68   gorho = gv%g_Earth / gv%Rho0
    74       if (g%mask2dT(i,j)==0.) cycle
    87         temp_1d(kk+1) = tv%T(i,j,k)
    88         temp_1d(kk+2) = tv%T(i,j,km1)
    89         salt_1d(kk+1) = tv%S(i,j,k)
    90         salt_1d(kk+2) = tv%S(i,j,km1)
    94         pref = pref + gv%H_to_Pa * h(i,j,k)
    99       call calculate_density(temp_1d, salt_1d, pres_1d, rho_1d, 1, 2*g%ke, tv%EQN_OF_STATE)
   105         du = (u_h(i,j,k))-(u_h(i,j,km1))
   106         dv = (v_h(i,j,k))-(v_h(i,j,km1))
   107         drho = (gorho * (rho_1d(kk+1) - rho_1d(kk+2)) )
   108         dz = ((0.5*(h(i,j,km1) + h(i,j,k))+gv%H_subroundoff)*gv%H_to_m)
   110         s2 = (du*du+dv*dv)/(dz*dz)
   111         ri_grad(k) = max(0.,n2)/max(s2,1.e-16)
   115       call  cvmix_coeffs_shear(mdiff_out=km(i,j,:), &
   116                                    tdiff_out=kh(i,j,:), &
   131   type(time_type),         
intent(in)    :: Time
   135   type(
diag_ctrl), 
target, 
intent(inout) :: diag
   138   integer :: NumberTrue=0
   141 #include "version_variable.h"   143   if (
associated(cs)) 
then   144     call mom_error(warning, 
"cvmix_shear_init called with an associated "// &
   145                             "control structure.")
   152     "Parameterization of shear-driven turbulence via CVMix (various options)")
   153   call get_param(param_file, 
mdl, 
"USE_LMD94", cs%use_LMD94, &
   154                  "If true, use the Large-McWilliams-Doney (JGR 1994) \n"//&
   155                  "shear mixing parameterization.", default=.false.)
   156   if (cs%use_LMD94) 
then   157      numbertrue=numbertrue + 1
   160   call get_param(param_file, 
mdl, 
"USE_PP81", cs%use_PP81, &
   161                  "If true, use the Pacanowski and Philander (JPO 1981) \n"//&
   162                  "shear mixing parameterization.", default=.false.)
   163   if (cs%use_PP81) 
then   164      numbertrue = numbertrue + 1
   168   if (use_jhl) numbertrue = numbertrue + 1
   171   if ((numbertrue).gt.1) 
then   172      call mom_error(fatal, 
'MOM_cvmix_shear_init: '// &
   173            'Multiple shear driven internal mixing schemes selected,'//&
   174            ' please disable all but one scheme to proceed.')
   180   call get_param(param_file, 
mdl, 
"NU_ZERO", cs%Nu_Zero, &
   181                  "Leading coefficient in KPP shear mixing.", &
   182                  units=
"nondim", default=5.e-3)
   183   call get_param(param_file, 
mdl, 
"RI_ZERO", cs%Ri_Zero, &
   184                  "Critical Richardson for KPP shear mixing,"// &
   185                  " NOTE this the internal mixing and this is"// &
   186                  " not for setting the boundary layer depth." &
   187                  ,units=
"nondim", default=0.7)
   188   call get_param(param_file, 
mdl, 
"KPP_EXP", cs%KPP_exp, &
   189                  "Exponent of unitless factor of diffusivities,"// &
   190                  " for KPP internal shear mixing scheme." &
   191                  ,units=
"nondim", default=3.0)
   192   call cvmix_init_shear(mix_scheme=cs%mix_scheme, &
   193                         kpp_nu_zero=cs%Nu_Zero,   &
   194                         kpp_ri_zero=cs%Ri_zero,   &
   197   allocate( cs%N2( szi_(g), szj_(g), szk_(g)+1 ) );cs%N2(:,:,:) = 0.
   198   allocate( cs%S2( szi_(g), szj_(g), szk_(g)+1 ) );cs%S2(:,:,:) = 0.
   208   logical :: LMD94, PP81
   210        default=.false., do_not_log = .true.)
   212        default=.false., do_not_log = .true.)
 Control structure including parameters for CVMix interior shear schemes. 
Interface to CVMix interior shear schemes. 
Ocean grid type. See mom_grid for details. 
Calculates density of sea water from T, S and P. 
subroutine, public calculate_cvmix_shear(u_H, v_H, h, tv, KH, KM, G, GV, CS)
Subroutine for calculating (internal) diffusivity. 
Provides the ocean grid type. 
logical function, public cvmix_shear_init(Time, G, GV, param_file, diag, CS)
Initialized the cvmix internal shear mixing routine. 
logical function, public is_root_pe()
Provides subroutines for quantities specific to the equation of state. 
character(len=40) mdl
This module's name. 
logical function, public cvmix_shear_is_used(param_file)
Reads the parameters "LMD94" and "PP81" and returns state. This function allows other modules to know...
The thermo_var_ptrs structure contains pointers to an assortment of thermodynamic fields that may be ...
subroutine, public mom_error(level, message, all_print)
logical function, public kappa_shear_is_used(param_file)
A control structure for the equation of state.