Skip to content

Commit

Permalink
+Pass MLDdensityDifference in units of [R]
Browse files Browse the repository at this point in the history
  Pass MLDdensityDifference to diagnoseMLDbyDensityDifference in units of [R].
All answers are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Oct 8, 2019
1 parent f1b9c66 commit 8ade6de
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
27 changes: 14 additions & 13 deletions src/parameterizations/vertical/MOM_diabatic_aux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -558,15 +558,15 @@ subroutine find_uv_at_h(u, v, h, u_h, v_h, G, GV, US, ea, eb)
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
intent(in) :: u !< The zonal velocity [m s-1]
intent(in) :: u !< The zonal velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJB_(G),SZK_(G)), &
intent(in) :: v !< The meridional velocity [m s-1]
intent(in) :: v !< The meridional velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
intent(in) :: h !< Layer thicknesses [H ~> m or kg m-2]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
intent(out) :: u_h !< Zonal velocity interpolated to h points [m s-1].
intent(out) :: u_h !< Zonal velocity interpolated to h points [L T-1 ~> m s-1].
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
intent(out) :: v_h !< Meridional velocity interpolated to h points [m s-1].
intent(out) :: v_h !< Meridional velocity interpolated to h points [L T-1 ~> m s-1].
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
optional, intent(in) :: ea !< The amount of fluid entrained from the layer
!! above within this time step [H ~> m or kg m-2].
Expand Down Expand Up @@ -722,7 +722,7 @@ subroutine diagnoseMLDbyDensityDifference(id_MLD, h, tv, densityDiff, G, GV, US,
intent(in) :: h !< Layer thickness [H ~> m or kg m-2]
type(thermo_var_ptrs), intent(in) :: tv !< Structure containing pointers to any
!! available thermodynamic fields.
real, intent(in) :: densityDiff !< Density difference to determine MLD [kg m-3]
real, intent(in) :: densityDiff !< Density difference to determine MLD [R ~> kg m-3]
type(diag_ctrl), pointer :: diagPtr !< Diagnostics structure
integer, optional, intent(in) :: id_N2subML !< Optional handle (ID) of subML stratification
integer, optional, intent(in) :: id_MLDsq !< Optional handle (ID) of squared MLD
Expand Down Expand Up @@ -873,10 +873,10 @@ subroutine applyBoundaryFluxesInOut(CS, G, GV, US, dt_in_T, fluxes, optics, nsw,
!! forcing through each layer [R Z3 T-2 ~> J m-2]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
optional, intent(out) :: dSV_dT !< Partial derivative of specific volume with
!! potential temperature [R-1 degC-1].
!! potential temperature [R-1 degC-1 ~> m3 kg-1 degC-1].
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
optional, intent(out) :: dSV_dS !< Partial derivative of specific volume with
!! salinity [R-1 ppt-1].
!! salinity [R-1 ppt-1 ~> m3 kg-1 ppt-1].
real, dimension(SZI_(G),SZJ_(G)), &
optional, intent(out) :: SkinBuoyFlux !< Buoyancy flux at surface [Z2 T-3 ~> m2 s-3].

Expand All @@ -888,7 +888,8 @@ subroutine applyBoundaryFluxesInOut(CS, G, GV, US, dt_in_T, fluxes, optics, nsw,
real :: Idt ! The inverse of the timestep [T-1 ~> s-1]
real :: dThickness, dTemp, dSalt
real :: fractionOfForcing, hOld, Ithickness
real :: RivermixConst ! A constant used in implementing river mixing [Pa s].
real :: RivermixConst ! A constant used in implementing river mixing [R Z2 T-1 ~> Pa s].

real, dimension(SZI_(G)) :: &
d_pres, & ! pressure change across a layer [Pa]
p_lay, & ! average pressure in a layer [Pa]
Expand Down Expand Up @@ -1124,11 +1125,11 @@ subroutine applyBoundaryFluxesInOut(CS, G, GV, US, dt_in_T, fluxes, optics, nsw,
! Determine the energetics of river mixing before updating the state.
if (calculate_energetics .and. associated(fluxes%lrunoff) .and. CS%do_rivermix) then
! Here we add an additional source of TKE to the mixed layer where river
! is present to simulate unresolved estuaries. The TKE input is diagnosed
! as follows:
! TKE_river[m3 s-3] = 0.5*rivermix_depth*g*(1/rho)*drho_ds*
! River*(Samb - Sriver) = CS%mstar*U_star^3
! where River is in units of [m s-1].
! is present to simulate unresolved estuaries. The TKE input, TKE_river in
! [Z3 T-3 ~> m3 s-3], is diagnosed as follows:
! TKE_river = 0.5*rivermix_depth*g*(1/rho)*drho_ds*
! River*(Samb - Sriver) = CS%mstar*U_star^3
! where River is in units of [Z T-1 ~> m s-1].
! Samb = Ambient salinity at the mouth of the estuary
! rivermix_depth = The prescribed depth over which to mix river inflow
! drho_ds = The gradient of density wrt salt at the ambient surface salinity.
Expand Down
17 changes: 9 additions & 8 deletions src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ module MOM_diabatic_driver
!< vertical diffusion of T and S
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
real :: MLDdensityDifference !< Density difference used to determine MLD_user [R ~> kg m-3]
real :: dz_subML_N2 !< The distance over which to calculate a diagnostic of the
!! average stratification at the base of the mixed layer [Z ~> m].

Expand Down Expand Up @@ -420,11 +420,11 @@ subroutine diabatic(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end, &
! Diagnose mixed layer depths.
call enable_averaging(dt, Time_end, CS%diag)
if (CS%id_MLD_003 > 0 .or. CS%id_subMLN2 > 0 .or. CS%id_mlotstsq > 0) then
call diagnoseMLDbyDensityDifference(CS%id_MLD_003, h, tv, 0.03, G, GV, US, CS%diag, &
call diagnoseMLDbyDensityDifference(CS%id_MLD_003, h, tv, 0.03*US%kg_m3_to_R, G, GV, US, CS%diag, &
id_N2subML=CS%id_subMLN2, id_MLDsq=CS%id_mlotstsq, dz_subML=CS%dz_subML_N2)
endif
if (CS%id_MLD_0125 > 0) then
call diagnoseMLDbyDensityDifference(CS%id_MLD_0125, h, tv, 0.125, G, GV, US, CS%diag)
call diagnoseMLDbyDensityDifference(CS%id_MLD_0125, h, tv, 0.125*US%kg_m3_to_R, G, GV, US, CS%diag)
endif
if (CS%id_MLD_user > 0) then
call diagnoseMLDbyDensityDifference(CS%id_MLD_user, h, tv, CS%MLDdensityDifference, G, GV, US, CS%diag)
Expand Down Expand Up @@ -1966,10 +1966,10 @@ subroutine layered_diabatic(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_e
Kd_heat, & ! diapycnal diffusivity of heat [Z2 T-1 ~> m2 s-1]
Kd_salt, & ! diapycnal diffusivity of salt and passive tracers [Z2 T-1 ~> m2 s-1]
Kd_ePBL, & ! test array of diapycnal diffusivities at interfaces [Z2 T-1 ~> m2 s-1]
Tdif_flx, & ! diffusive diapycnal heat flux across interfaces [degC m s-1]
Tadv_flx, & ! advective diapycnal heat flux across interfaces [degC m s-1]
Sdif_flx, & ! diffusive diapycnal salt flux across interfaces [ppt m s-1]
Sadv_flx ! advective diapycnal salt flux across interfaces [ppt m s-1]
Tdif_flx, & ! diffusive diapycnal heat flux across interfaces [degC H s-1 ~> degC m s-1 or degC kg m-2 s-1]
Tadv_flx, & ! advective diapycnal heat flux across interfaces [degC H s-1 ~> degC m s-1 or degC kg m-2 s-1]
Sdif_flx, & ! diffusive diapycnal salt flux across interfaces [ppt H s-1 ~> ppt m s-1 or ppt kg m-2 s-1]
Sadv_flx ! advective diapycnal salt flux across interfaces [ppt H s-1 ~> ppt m s-1 or ppt kg m-2 s-1]

! The following 5 variables are only used with a bulk mixed layer.
real, pointer, dimension(:,:,:) :: &
Expand Down Expand Up @@ -3436,7 +3436,8 @@ subroutine diabatic_driver_init(Time, G, GV, US, param_file, useALEalgorithm, di
"The density difference used to determine a diagnostic mixed "//&
"layer depth, MLD_user, following the definition of Levitus 1982. "//&
"The MLD is the depth at which the density is larger than the "//&
"surface density by the specified amount.", units='kg/m3', default=0.1)
"surface density by the specified amount.", &
units='kg/m3', default=0.1, scale=US%kg_m3_to_R)
call get_param(param_file, mdl, "DIAG_DEPTH_SUBML_N2", CS%dz_subML_N2, &
"The distance over which to calculate a diagnostic of the "//&
"stratification at the base of the mixed layer.", &
Expand Down

0 comments on commit 8ade6de

Please sign in to comment.