Skip to content

Commit

Permalink
+*Pass visc%h_ML to call_tracer_column_fns
Browse files Browse the repository at this point in the history
  Added the optional argument h_BL to call_tracer_column_fns, and then pass
visc%h_ML to this routine as a part of the calls from the diabatic routines.
This argument is not provided in adiabatic mode or in offline tracer mode, which
is why it has been made optional.  All answers are bitwise identical in
Boussinesq mode but ideal age tracers can change in non-Boussinesq mode due to
the updates to the layer specific volumes between the calculation of the
boundary layer properties and the calls to call_tracer_column_fns.
  • Loading branch information
Hallberg-NOAA committed May 31, 2024
1 parent 25f04c1 commit 75b9437
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
13 changes: 5 additions & 8 deletions src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ subroutine diabatic_ALE_legacy(u, v, h, tv, BLD, fluxes, visc, ADp, CDp, dt, Tim
KPP_CSp=CS%KPP_CSp, &
nonLocalTrans=KPP_NLTscalar, &
evap_CFL_limit=CS%evap_CFL_limit, &
minimum_forcing_depth=CS%minimum_forcing_depth)
minimum_forcing_depth=CS%minimum_forcing_depth, h_BL=visc%h_ML)

call cpu_clock_end(id_clock_tracers)

Expand Down Expand Up @@ -1587,7 +1587,7 @@ subroutine diabatic_ALE(u, v, h, tv, BLD, fluxes, visc, ADp, CDp, dt, Time_end,
KPP_CSp=CS%KPP_CSp, &
nonLocalTrans=KPP_NLTscalar, &
evap_CFL_limit=CS%evap_CFL_limit, &
minimum_forcing_depth=CS%minimum_forcing_depth)
minimum_forcing_depth=CS%minimum_forcing_depth, h_BL=visc%h_ML)

call cpu_clock_end(id_clock_tracers)

Expand Down Expand Up @@ -2381,8 +2381,7 @@ subroutine layered_diabatic(u, v, h, tv, BLD, fluxes, visc, ADp, CDp, dt, Time_e

call call_tracer_column_fns(hold, h, eatr, ebtr, fluxes, BLD, dt, G, GV, US, tv, &
CS%optics, CS%tracer_flow_CSp, CS%debug, &
KPP_CSp=CS%KPP_CSp, &
nonLocalTrans=KPP_NLTscalar)
KPP_CSp=CS%KPP_CSp, nonLocalTrans=KPP_NLTscalar, h_BL=visc%h_ML)

elseif (CS%double_diffuse) then ! extra diffusivity for passive tracers

Expand All @@ -2403,14 +2402,12 @@ subroutine layered_diabatic(u, v, h, tv, BLD, fluxes, visc, ADp, CDp, dt, Time_e

call call_tracer_column_fns(hold, h, eatr, ebtr, fluxes, BLD, dt, G, GV, US, tv, &
CS%optics, CS%tracer_flow_CSp, CS%debug, &
KPP_CSp=CS%KPP_CSp, &
nonLocalTrans=KPP_NLTscalar)
KPP_CSp=CS%KPP_CSp, nonLocalTrans=KPP_NLTscalar, h_BL=visc%h_ML)

else
call call_tracer_column_fns(hold, h, ea, eb, fluxes, BLD, dt, G, GV, US, tv, &
CS%optics, CS%tracer_flow_CSp, CS%debug, &
KPP_CSp=CS%KPP_CSp, &
nonLocalTrans=KPP_NLTscalar)
KPP_CSp=CS%KPP_CSp, nonLocalTrans=KPP_NLTscalar, h_BL=visc%h_ML)

endif ! (CS%mix_boundary_tracers)

Expand Down
6 changes: 4 additions & 2 deletions src/parameterizations/vertical/MOM_set_viscosity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2693,7 +2693,7 @@ subroutine set_visc_register_restarts(HI, G, GV, US, param_file, visc, restart_C
logical, intent(in) :: use_ice_shelf !< if true, register tau_shelf restarts
! Local variables
logical :: use_kappa_shear, KS_at_vertex
logical :: adiabatic, useKPP, useEPBL
logical :: adiabatic, useKPP, useEPBL, use_ideal_age
logical :: do_brine_plume, use_hor_bnd_diff, use_neutral_diffusion, use_fpmix
logical :: use_CVMix_shear, MLE_use_PBL_MLD, MLE_use_Bodner, use_CVMix_conv
integer :: isd, ied, jsd, jed, nz
Expand Down Expand Up @@ -2777,12 +2777,14 @@ subroutine set_visc_register_restarts(HI, G, GV, US, param_file, visc, restart_C
default=.false., do_not_log=.true.)
call get_param(param_file, mdl, "FPMIX", use_fpmix, &
default=.false., do_not_log=.true.)
call get_param(param_file, mdl, "USE_IDEAL_AGE_TRACER", use_ideal_age, &
default=.false., do_not_log=.true.)

if (MLE_use_PBL_MLD) then
call safe_alloc_ptr(visc%MLD, isd, ied, jsd, jed)
endif
if ((hfreeze >= 0.0) .or. MLE_use_PBL_MLD .or. do_brine_plume .or. use_fpmix .or. &
use_neutral_diffusion .or. use_hor_bnd_diff) then
use_neutral_diffusion .or. use_hor_bnd_diff .or. use_ideal_age) then
call safe_alloc_ptr(visc%h_ML, isd, ied, jsd, jed)
endif

Expand Down
18 changes: 15 additions & 3 deletions src/tracer/MOM_tracer_flow_control.F90
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ end subroutine call_tracer_set_forcing

!> This subroutine calls all registered tracer column physics subroutines.
subroutine call_tracer_column_fns(h_old, h_new, ea, eb, fluxes, mld, dt, G, GV, US, tv, optics, CS, &
debug, KPP_CSp, nonLocalTrans, evap_CFL_limit, minimum_forcing_depth)
debug, KPP_CSp, nonLocalTrans, evap_CFL_limit, minimum_forcing_depth, h_BL)
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: h_old !< Layer thickness before entrainment
Expand Down Expand Up @@ -464,9 +464,11 @@ subroutine call_tracer_column_fns(h_old, h_new, ea, eb, fluxes, mld, dt, G, GV,
!! of the top layer in a timestep [nondim]
real, optional, intent(in) :: minimum_forcing_depth !< The smallest depth over
!! which fluxes can be applied [H ~> m or kg m-2]
real, dimension(:,:), optional, pointer :: h_BL !< Thickness of active mixing layer [H ~> m or kg m-2]

! Local variables
real :: Hbl(SZI_(G),SZJ_(G)) !< Boundary layer thickness [H ~> m or kg m-2]
logical :: use_h_BL

if (.not. associated(CS)) call MOM_error(FATAL, "call_tracer_column_fns: "// &
"Module must be initialized via call_tracer_register before it is used.")
Expand All @@ -493,7 +495,12 @@ subroutine call_tracer_column_fns(h_old, h_new, ea, eb, fluxes, mld, dt, G, GV,
evap_CFL_limit=evap_CFL_limit, &
minimum_forcing_depth=minimum_forcing_depth)
if (CS%use_ideal_age) then
call convert_MLD_to_ML_thickness(mld, h_new, Hbl, tv, G, GV)
use_h_BL = .false. ; if (present(h_BL)) use_h_BL = associated(h_BL)
if (present(h_BL)) then
Hbl(:,:) = h_BL(:,:)
else ! This option is here mostly to support the offline tracers.
call convert_MLD_to_ML_thickness(mld, h_new, Hbl, tv, G, GV)
endif
call ideal_age_tracer_column_physics(h_old, h_new, ea, eb, fluxes, dt, &
G, GV, US, CS%ideal_age_tracer_CSp, &
evap_CFL_limit=evap_CFL_limit, &
Expand Down Expand Up @@ -573,7 +580,12 @@ subroutine call_tracer_column_fns(h_old, h_new, ea, eb, fluxes, mld, dt, G, GV,
call RGC_tracer_column_physics(h_old, h_new, ea, eb, fluxes, dt, &
G, GV, US, CS%RGC_tracer_CSp)
if (CS%use_ideal_age) then
call convert_MLD_to_ML_thickness(mld, h_new, Hbl, tv, G, GV)
use_h_BL = .false. ; if (present(h_BL)) use_h_BL = associated(h_BL)
if (present(h_BL)) then
Hbl(:,:) = h_BL(:,:)
else ! This option is here mostly to support the offline tracers.
call convert_MLD_to_ML_thickness(mld, h_new, Hbl, tv, G, GV)
endif
call ideal_age_tracer_column_physics(h_old, h_new, ea, eb, fluxes, dt, &
G, GV, US, CS%ideal_age_tracer_CSp, Hbl=Hbl)
endif
Expand Down

0 comments on commit 75b9437

Please sign in to comment.