Skip to content

Commit

Permalink
+Add and use query_debugging_checks
Browse files Browse the repository at this point in the history
  Added the new function query_debugging_checks to the MOM_debugging module to
return flags indicating what types of debugging are enabled, including checksums
or redundant value checks.  This new routine is used to allow for the redundant
value checks in various step_MOM routines to be enabled or disabled at run-time
when debugging is on overall (by setting DEBUG = True).  For cases with
inconsistent redundant points, this change allows for a reduction in the volume
of debugging information sent to stdout from multiple PEs (in an arbitrary
order), while for cases without inconsistent redundant points this change will
allow for faster debugging with checksums alone.  All answers are bitwise
identical, but there is a new publicly visible routine.
  • Loading branch information
Hallberg-NOAA committed Jul 15, 2024
1 parent 12af900 commit 2c1a9d3
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 39 deletions.
24 changes: 17 additions & 7 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module MOM
! Infrastructure modules
use MOM_array_transform, only : rotate_array, rotate_vector
use MOM_debugging, only : MOM_debugging_init, hchksum, uvchksum
use MOM_debugging, only : check_redundant
use MOM_debugging, only : check_redundant, query_debugging_checks
use MOM_checksum_packages, only : MOM_thermo_chksum, MOM_state_chksum
use MOM_checksum_packages, only : MOM_accel_chksum, MOM_surface_chksum
use MOM_coms, only : num_PEs
Expand Down Expand Up @@ -555,6 +555,7 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
! multiple dynamic timesteps.
logical :: do_dyn ! If true, dynamics are updated with this call.
logical :: do_thermo ! If true, thermodynamics and remapping may be applied with this call.
logical :: debug_redundant ! If true, check redundant values on PE boundaries when debugging.
logical :: nonblocking_p_surf_update ! A flag to indicate whether surface properties
! can use nonblocking halo updates
logical :: cycle_start ! If true, do calculations that are only done at the start of
Expand Down Expand Up @@ -610,6 +611,7 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
call cpu_clock_begin(id_clock_other)

if (CS%debug) then
call query_debugging_checks(do_redundant=debug_redundant)
call MOM_state_chksum("Beginning of step_MOM ", u, v, h, CS%uh, CS%vh, G, GV, US)
endif

Expand Down Expand Up @@ -788,9 +790,11 @@ subroutine step_MOM(forces_in, fluxes_in, sfc_state, Time_start, time_int_in, CS
if (CS%debug) then
if (cycle_start) &
call MOM_state_chksum("Before steps ", u, v, h, CS%uh, CS%vh, G, GV, US)
if (cycle_start) call check_redundant("Before steps ", u, v, G, unscale=US%L_T_to_m_s)
if (cycle_start .and. debug_redundant) &
call check_redundant("Before steps ", u, v, G, unscale=US%L_T_to_m_s)
if (do_dyn) call MOM_mech_forcing_chksum("Before steps", forces, G, US, haloshift=0)
if (do_dyn) call check_redundant("Before steps ", forces%taux, forces%tauy, G, &
if (do_dyn .and. debug_redundant) &
call check_redundant("Before steps ", forces%taux, forces%tauy, G, &
unscale=US%RZ_T_to_kg_m2s*US%L_T_to_m_s)
endif
call cpu_clock_end(id_clock_other)
Expand Down Expand Up @@ -1537,6 +1541,7 @@ subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
! velocity points [H ~> m or kg m-2]
logical :: PCM_cell(SZI_(G),SZJ_(G),SZK_(GV)) ! If true, PCM remapping should be used in a cell.
logical :: use_ice_shelf ! Needed for selecting the right ALE interface.
logical :: debug_redundant ! If true, check redundant values on PE boundaries when debugging.
logical :: showCallTree
type(group_pass_type) :: pass_T_S, pass_T_S_h, pass_uv_T_S_h
integer :: dynamics_stencil ! The computational stencil for the calculations
Expand All @@ -1547,6 +1552,7 @@ subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke
showCallTree = callTree_showQuery()
if (showCallTree) call callTree_enter("step_MOM_thermo(), MOM.F90")
if (CS%debug) call query_debugging_checks(do_redundant=debug_redundant)

use_ice_shelf = .false.
if (associated(CS%frac_shelf_h)) use_ice_shelf = .true.
Expand Down Expand Up @@ -1599,7 +1605,8 @@ subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
haloshift=0, unscale=GV%H_to_MKS*US%L_to_m**2)
! call MOM_state_chksum("Pre-diabatic ", u, v, h, CS%uhtr, CS%vhtr, G, GV, vel_scale=1.0)
call MOM_thermo_chksum("Pre-diabatic ", tv, G, US, haloshift=0)
call check_redundant("Pre-diabatic ", u, v, G, unscale=US%L_T_to_m_s)
if (debug_redundant) &
call check_redundant("Pre-diabatic ", u, v, G, unscale=US%L_T_to_m_s)
call MOM_forcing_chksum("Pre-diabatic", fluxes, G, US, haloshift=0)
endif

Expand Down Expand Up @@ -1636,7 +1643,8 @@ subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
call MOM_state_chksum("Pre-ALE ", u, v, h, CS%uh, CS%vh, G, GV, US, omit_corners=.true.)
call hchksum(tv%T,"Pre-ALE T", G%HI, haloshift=1, omit_corners=.true., unscale=US%C_to_degC)
call hchksum(tv%S,"Pre-ALE S", G%HI, haloshift=1, omit_corners=.true., unscale=US%S_to_ppt)
call check_redundant("Pre-ALE ", u, v, G, unscale=US%L_T_to_m_s)
if (debug_redundant) &
call check_redundant("Pre-ALE ", u, v, G, unscale=US%L_T_to_m_s)
endif
call cpu_clock_begin(id_clock_ALE)

Expand Down Expand Up @@ -1722,7 +1730,8 @@ subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
call MOM_state_chksum("Post-ALE ", u, v, h, CS%uh, CS%vh, G, GV, US)
call hchksum(tv%T, "Post-ALE T", G%HI, haloshift=1, unscale=US%C_to_degC)
call hchksum(tv%S, "Post-ALE S", G%HI, haloshift=1, unscale=US%S_to_ppt)
call check_redundant("Post-ALE ", u, v, G, unscale=US%L_T_to_m_s)
if (debug_redundant) &
call check_redundant("Post-ALE ", u, v, G, unscale=US%L_T_to_m_s)
endif

! Whenever thickness changes let the diag manager know, target grids
Expand All @@ -1747,7 +1756,8 @@ subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
if (associated(tv%salt_deficit)) call hchksum(tv%salt_deficit, &
"Post-diabatic salt deficit", G%HI, haloshift=0, unscale=US%RZ_to_kg_m2)
! call MOM_thermo_chksum("Post-diabatic ", tv, G, US)
call check_redundant("Post-diabatic ", u, v, G, unscale=US%L_T_to_m_s)
if (debug_redundant) &
call check_redundant("Post-diabatic ", u, v, G, unscale=US%L_T_to_m_s)
endif
call disable_averaging(CS%diag)

Expand Down
44 changes: 28 additions & 16 deletions src/core/MOM_dynamics_split_RK2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module MOM_dynamics_split_RK2
use MOM_domains, only : To_North, To_East, Omit_Corners
use MOM_domains, only : create_group_pass, do_group_pass, group_pass_type
use MOM_domains, only : start_group_pass, complete_group_pass, pass_var, pass_vector
use MOM_debugging, only : hchksum, uvchksum
use MOM_debugging, only : hchksum, uvchksum, query_debugging_checks
use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL, WARNING, is_root_pe
use MOM_error_handler, only : MOM_set_verbosity, callTree_showQuery
use MOM_error_handler, only : callTree_enter, callTree_leave, callTree_waypoint
Expand Down Expand Up @@ -387,6 +387,7 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f
real :: dt_pred ! The time step for the predictor part of the baroclinic time stepping [T ~> s].
real :: Idt_bc ! Inverse of the baroclinic timestep [T-1 ~> s-1]
logical :: dyn_p_surf
logical :: debug_redundant ! If true, check redundant values on PE boundaries when debugging
logical :: BT_cont_BT_thick ! If true, use the BT_cont_type to estimate the
! relative weightings of the layers in calculating
! the barotropic accelerations.
Expand Down Expand Up @@ -419,9 +420,12 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f
call updateCFLtruncationValue(Time_local, CS%vertvisc_CSp, US)

if (CS%debug) then
call query_debugging_checks(do_redundant=debug_redundant)
call MOM_state_chksum("Start predictor ", u_inst, v_inst, h, uh, vh, G, GV, US, symmetric=sym)
call check_redundant("Start predictor u ", u_inst, v_inst, G, unscale=US%L_T_to_m_s)
call check_redundant("Start predictor uh ", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
if (debug_redundant) then
call check_redundant("Start predictor u ", u_inst, v_inst, G, unscale=US%L_T_to_m_s)
call check_redundant("Start predictor uh ", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
endif
endif

dyn_p_surf = associated(p_surf_begin) .and. associated(p_surf_end)
Expand Down Expand Up @@ -562,10 +566,12 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f
call MOM_accel_chksum("pre-btstep accel", CS%CAu_pred, CS%CAv_pred, CS%PFu, CS%PFv, &
CS%diffu, CS%diffv, G, GV, US, CS%pbce, u_bc_accel, v_bc_accel, &
symmetric=sym)
call check_redundant("pre-btstep CS%CA ", CS%CAu_pred, CS%CAv_pred, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep CS%PF ", CS%PFu, CS%PFv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep CS%diff ", CS%diffu, CS%diffv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep u_bc_accel ", u_bc_accel, v_bc_accel, G, unscale=US%L_T2_to_m_s2)
if (debug_redundant) then
call check_redundant("pre-btstep CS%CA ", CS%CAu_pred, CS%CAv_pred, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep CS%PF ", CS%PFu, CS%PFv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep CS%diff ", CS%diffu, CS%diffv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep u_bc_accel ", u_bc_accel, v_bc_accel, G, unscale=US%L_T2_to_m_s2)
endif
endif

call cpu_clock_begin(id_clock_vertvisc)
Expand Down Expand Up @@ -677,8 +683,10 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f
CS%diffu, CS%diffv, G, GV, US, CS%pbce, CS%u_accel_bt, CS%v_accel_bt, symmetric=sym)
call MOM_state_chksum("Predictor 1 init", u_inst, v_inst, h, uh, vh, G, GV, US, haloshift=1, &
symmetric=sym)
call check_redundant("Predictor 1 up", up, vp, G, unscale=US%L_T_to_m_s)
call check_redundant("Predictor 1 uh", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
if (debug_redundant) then
call check_redundant("Predictor 1 up", up, vp, G, unscale=US%L_T_to_m_s)
call check_redundant("Predictor 1 uh", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
endif
endif

! up <- up + dt_pred d/dz visc d/dz up
Expand Down Expand Up @@ -840,8 +848,10 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f
call uvchksum("Predictor avg [uv]", u_av, v_av, G%HI, haloshift=1, symmetric=sym, unscale=US%L_T_to_m_s)
call hchksum(h_av, "Predictor avg h", G%HI, haloshift=2, unscale=GV%H_to_MKS)
! call MOM_state_chksum("Predictor avg ", u_av, v_av, h_av, uh, vh, G, GV, US)
call check_redundant("Predictor up ", up, vp, G, unscale=US%L_T_to_m_s)
call check_redundant("Predictor uh ", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
if (debug_redundant) then
call check_redundant("Predictor up ", up, vp, G, unscale=US%L_T_to_m_s)
call check_redundant("Predictor uh ", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
endif
endif

! diffu = horizontal viscosity terms (u_av)
Expand Down Expand Up @@ -882,10 +892,12 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f
call MOM_accel_chksum("corr pre-btstep accel", CS%CAu, CS%CAv, CS%PFu, CS%PFv, &
CS%diffu, CS%diffv, G, GV, US, CS%pbce, u_bc_accel, v_bc_accel, &
symmetric=sym)
call check_redundant("corr pre-btstep CS%CA ", CS%CAu, CS%CAv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep CS%PF ", CS%PFu, CS%PFv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep CS%diff ", CS%diffu, CS%diffv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep u_bc_accel ", u_bc_accel, v_bc_accel, G, unscale=US%L_T2_to_m_s2)
if (debug_redundant) then
call check_redundant("corr pre-btstep CS%CA ", CS%CAu, CS%CAv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep CS%PF ", CS%PFu, CS%PFv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep CS%diff ", CS%diffu, CS%diffv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep u_bc_accel ", u_bc_accel, v_bc_accel, G, unscale=US%L_T2_to_m_s2)
endif
endif

! u_accel_bt = layer accelerations due to barotropic solver
Expand All @@ -909,7 +921,7 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f
call cpu_clock_end(id_clock_btstep)
if (showCallTree) call callTree_leave("btstep()")

if (CS%debug) then
if (CS%debug .and. debug_redundant) then
call check_redundant("u_accel_bt ", CS%u_accel_bt, CS%v_accel_bt, G, unscale=US%L_T2_to_m_s2)
endif

Expand Down
44 changes: 28 additions & 16 deletions src/core/MOM_dynamics_split_RK2b.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module MOM_dynamics_split_RK2b
use MOM_domains, only : To_North, To_East, Omit_Corners
use MOM_domains, only : create_group_pass, do_group_pass, group_pass_type
use MOM_domains, only : start_group_pass, complete_group_pass, pass_var, pass_vector
use MOM_debugging, only : hchksum, uvchksum
use MOM_debugging, only : hchksum, uvchksum, query_debugging_checks
use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL, WARNING, is_root_pe
use MOM_error_handler, only : MOM_set_verbosity, callTree_showQuery
use MOM_error_handler, only : callTree_enter, callTree_leave, callTree_waypoint
Expand Down Expand Up @@ -386,6 +386,7 @@ subroutine step_MOM_dyn_split_RK2b(u_av, v_av, h, tv, visc, Time_local, dt, forc
real :: dt_pred ! The time step for the predictor part of the baroclinic time stepping [T ~> s].
real :: Idt_bc ! Inverse of the baroclinic timestep [T-1 ~> s-1]
logical :: dyn_p_surf
logical :: debug_redundant ! If true, check redundant values on PE boundaries when debugging
logical :: BT_cont_BT_thick ! If true, use the BT_cont_type to estimate the
! relative weightings of the layers in calculating
! the barotropic accelerations.
Expand Down Expand Up @@ -415,9 +416,12 @@ subroutine step_MOM_dyn_split_RK2b(u_av, v_av, h, tv, visc, Time_local, dt, forc
call updateCFLtruncationValue(Time_local, CS%vertvisc_CSp, US)

if (CS%debug) then
call query_debugging_checks(do_redundant=debug_redundant)
call MOM_state_chksum("Start predictor ", u_av, v_av, h, uh, vh, G, GV, US, symmetric=sym)
call check_redundant("Start predictor u ", u_av, v_av, G, unscale=US%L_T_to_m_s)
call check_redundant("Start predictor uh ", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
if (debug_redundant) then
call check_redundant("Start predictor u ", u_av, v_av, G, unscale=US%L_T_to_m_s)
call check_redundant("Start predictor uh ", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
endif
endif

dyn_p_surf = associated(p_surf_begin) .and. associated(p_surf_end)
Expand Down Expand Up @@ -578,10 +582,12 @@ subroutine step_MOM_dyn_split_RK2b(u_av, v_av, h, tv, visc, Time_local, dt, forc
call MOM_accel_chksum("pre-btstep accel", CS%CAu_pred, CS%CAv_pred, CS%PFu, CS%PFv, &
CS%diffu, CS%diffv, G, GV, US, CS%pbce, u_bc_accel, v_bc_accel, &
symmetric=sym)
call check_redundant("pre-btstep CS%CA ", CS%CAu_pred, CS%CAv_pred, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep CS%PF ", CS%PFu, CS%PFv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep CS%diff ", CS%diffu, CS%diffv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep u_bc_accel ", u_bc_accel, v_bc_accel, G, unscale=US%L_T2_to_m_s2)
if (debug_redundant) then
call check_redundant("pre-btstep CS%CA ", CS%CAu_pred, CS%CAv_pred, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep CS%PF ", CS%PFu, CS%PFv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep CS%diff ", CS%diffu, CS%diffv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("pre-btstep u_bc_accel ", u_bc_accel, v_bc_accel, G, unscale=US%L_T2_to_m_s2)
endif
endif

call cpu_clock_begin(id_clock_vertvisc)
Expand Down Expand Up @@ -700,8 +706,10 @@ subroutine step_MOM_dyn_split_RK2b(u_av, v_av, h, tv, visc, Time_local, dt, forc
CS%diffu, CS%diffv, G, GV, US, CS%pbce, CS%u_accel_bt, CS%v_accel_bt, symmetric=sym)
call MOM_state_chksum("Predictor 1 init", u_inst, v_inst, h, uh, vh, G, GV, US, haloshift=1, &
symmetric=sym)
call check_redundant("Predictor 1 up", up, vp, G, unscale=US%L_T_to_m_s)
call check_redundant("Predictor 1 uh", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
if (debug_redundant) then
call check_redundant("Predictor 1 up", up, vp, G, unscale=US%L_T_to_m_s)
call check_redundant("Predictor 1 uh", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
endif
endif

! up <- up + dt_pred d/dz visc d/dz up
Expand Down Expand Up @@ -837,8 +845,10 @@ subroutine step_MOM_dyn_split_RK2b(u_av, v_av, h, tv, visc, Time_local, dt, forc
call uvchksum("Predictor avg [uv]", u_av, v_av, G%HI, haloshift=1, symmetric=sym, unscale=US%L_T_to_m_s)
call hchksum(h_av, "Predictor avg h", G%HI, haloshift=2, unscale=GV%H_to_MKS)
! call MOM_state_chksum("Predictor avg ", u_av, v_av, h_av, uh, vh, G, GV, US)
call check_redundant("Predictor up ", up, vp, G, unscale=US%L_T_to_m_s)
call check_redundant("Predictor uh ", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
if (debug_redundant) then
call check_redundant("Predictor up ", up, vp, G, unscale=US%L_T_to_m_s)
call check_redundant("Predictor uh ", uh, vh, G, unscale=GV%H_to_MKS*US%L_to_m**2*US%s_to_T)
endif
endif

! diffu = horizontal viscosity terms (u_av)
Expand Down Expand Up @@ -877,10 +887,12 @@ subroutine step_MOM_dyn_split_RK2b(u_av, v_av, h, tv, visc, Time_local, dt, forc
call MOM_accel_chksum("corr pre-btstep accel", CS%CAu, CS%CAv, CS%PFu, CS%PFv, &
CS%diffu, CS%diffv, G, GV, US, CS%pbce, u_bc_accel, v_bc_accel, &
symmetric=sym)
call check_redundant("corr pre-btstep CS%CA ", CS%CAu, CS%CAv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep CS%PF ", CS%PFu, CS%PFv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep CS%diff ", CS%diffu, CS%diffv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep u_bc_accel ", u_bc_accel, v_bc_accel, G, unscale=US%L_T2_to_m_s2)
if (debug_redundant) then
call check_redundant("corr pre-btstep CS%CA ", CS%CAu, CS%CAv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep CS%PF ", CS%PFu, CS%PFv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep CS%diff ", CS%diffu, CS%diffv, G, unscale=US%L_T2_to_m_s2)
call check_redundant("corr pre-btstep u_bc_accel ", u_bc_accel, v_bc_accel, G, unscale=US%L_T2_to_m_s2)
endif
endif

! u_accel_bt = layer accelerations due to barotropic solver
Expand All @@ -903,7 +915,7 @@ subroutine step_MOM_dyn_split_RK2b(u_av, v_av, h, tv, visc, Time_local, dt, forc
call cpu_clock_end(id_clock_btstep)
if (showCallTree) call callTree_leave("btstep()")

if (CS%debug) then
if (CS%debug .and. debug_redundant) then
call check_redundant("u_accel_bt ", CS%u_accel_bt, CS%v_accel_bt, G, unscale=US%L_T2_to_m_s2)
endif

Expand Down
13 changes: 13 additions & 0 deletions src/diagnostics/MOM_debugging.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module MOM_debugging
public :: vec_chksum, vec_chksum_C, vec_chksum_B, vec_chksum_A
public :: MOM_debugging_init, totalStuff, totalTandS
public :: check_column_integral, check_column_integrals
public :: query_debugging_checks

! These interfaces come from MOM_checksums.
public :: hchksum, Bchksum, qchksum, is_NaN, chksum, uvchksum, hchksum_pair
Expand Down Expand Up @@ -100,6 +101,18 @@ subroutine MOM_debugging_init(param_file)

end subroutine MOM_debugging_init

!> Returns logicals indicating which debugging checks should be performed.
subroutine query_debugging_checks(do_debug, do_chksums, do_redundant)
logical, optional, intent(out) :: do_debug !< True if verbose debugging is to be output
logical, optional, intent(out) :: do_chksums !< True if checksums are to be output
logical, optional, intent(out) :: do_redundant !< True if redundant points are to be checked

if (present(do_debug)) do_debug = debug
if (present(do_chksums)) do_chksums = debug_chksums
if (present(do_redundant)) do_redundant = debug_redundant

end subroutine query_debugging_checks

!> Check for consistency between the duplicated points of a 3-D C-grid vector
subroutine check_redundant_vC3d(mesg, u_comp, v_comp, G, is, ie, js, je, &
direction, unscale)
Expand Down

0 comments on commit 2c1a9d3

Please sign in to comment.