Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9ff6ca4

Browse files
Hallberg-NOAAalperaltuntas
authored andcommittedJul 16, 2024·
Scale checksums in hor_bnd_diffusion
Added missing scale arguments to the hchksum and global_mass_integral calls for debugging in hor_bnd_diffusion, so that they now give messages to stdout that do not change when tracers (including temperature and salinity) are rescaled. Also added a missing debuggingParam argument to the get_Param call for HBD_DEBUG so that is will be logged in MOM_parameter_doc.debugging rather that MOM_parameter_doc.all. This commit partially addresses the scaling problems that were noted in github.com//issues/275. All solutions are bitwise identical, but some debugging output can change to become more robust.
1 parent 99edf23 commit 9ff6ca4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed
 

‎src/tracer/MOM_hor_bnd_diffusion.F90

+9-8
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module MOM_hor_bnd_diffusion
3232
public boundary_k_range, hor_bnd_diffusion_end
3333

3434
! Private parameters to avoid doing string comparisons for bottom or top boundary layer
35-
integer, public, parameter :: SURFACE = -1 !< Set a value that corresponds to the surface bopundary
35+
integer, public, parameter :: SURFACE = -1 !< Set a value that corresponds to the surface boundary
3636
integer, public, parameter :: BOTTOM = 1 !< Set a value that corresponds to the bottom boundary
3737
#include <MOM_memory.h>
3838

@@ -146,10 +146,11 @@ logical function hor_bnd_diffusion_init(Time, G, GV, US, param_file, diag, diaba
146146
call initialize_remapping( CS%remap_CS, string, boundary_extrapolation = boundary_extrap ,&
147147
check_reconstruction=.false., check_remapping=.false.)
148148
call extract_member_remapping_CS(CS%remap_CS, degree=CS%deg)
149-
call get_param(param_file, mdl, "DEBUG", debug, default=.false., do_not_log=.true.)
149+
call get_param(param_file, mdl, "DEBUG", debug, &
150+
default=.false., debuggingParam=.true., do_not_log=.true.)
150151
call get_param(param_file, mdl, "HBD_DEBUG", CS%debug, &
151152
"If true, write out verbose debugging data in the HBD module.", &
152-
default=debug)
153+
default=debug, debuggingParam=.true.)
153154

154155
id_clock_hbd = cpu_clock_id('(Ocean HBD)', grain=CLOCK_MODULE)
155156

@@ -208,7 +209,7 @@ subroutine hor_bnd_diffusion(G, GV, US, h, Coef_x, Coef_y, dt, Reg, CS)
208209
tracer => Reg%tr(m)
209210

210211
if (CS%debug) then
211-
call hchksum(tracer%t, "before HBD "//tracer%name,G%HI)
212+
call hchksum(tracer%t, "before HBD "//tracer%name, G%HI, scale=tracer%conc_scale)
212213
endif
213214

214215
! for diagnostics
@@ -264,10 +265,10 @@ subroutine hor_bnd_diffusion(G, GV, US, h, Coef_x, Coef_y, dt, Reg, CS)
264265
endif
265266

266267
if (CS%debug) then
267-
call hchksum(tracer%t, "after HBD "//tracer%name,G%HI)
268+
call hchksum(tracer%t, "after HBD "//tracer%name, G%HI, scale=tracer%conc_scale)
268269
! tracer (native grid) integrated tracer amounts before and after HBD
269-
tracer_int_prev = global_mass_integral(h, G, GV, tracer_old)
270-
tracer_int_end = global_mass_integral(h, G, GV, tracer%t)
270+
tracer_int_prev = global_mass_integral(h, G, GV, tracer_old, scale=tracer%conc_scale)
271+
tracer_int_end = global_mass_integral(h, G, GV, tracer%t, scale=tracer%conc_scale)
271272
write(mesg,*) 'Total '//tracer%name//' before/after HBD:', tracer_int_prev, tracer_int_end
272273
call MOM_mesg(mesg)
273274
endif
@@ -1213,7 +1214,7 @@ end subroutine hor_bnd_diffusion_end
12131214
!!
12141215
!! \subsection section_harmonic_mean Harmonic Mean
12151216
!!
1216-
!! The harmonic mean (HM) betwen h1 and h2 is defined as:
1217+
!! The harmonic mean (HM) between h1 and h2 is defined as:
12171218
!!
12181219
!! \f[ HM = \frac{2 \times h1 \times h2}{h1 + h2} \f]
12191220
!!

0 commit comments

Comments
 (0)
Please sign in to comment.