Skip to content

Commit d4b04fe

Browse files
Raphael DussinRaphael Dussin
authored andcommitted
fixes the restart checksum problem
1 parent e4b8b6c commit d4b04fe

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

src/parameterizations/lateral/MOM_internal_tides.F90

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,18 +3241,21 @@ subroutine register_int_tide_restarts(G, GV, US, param_file, CS, restart_CS)
32413241

32423242
! This subroutine is used to allocate and register any fields in this module
32433243
! that should be written to or read from the restart file.
3244+
logical :: non_Bous ! If true, this run is fully non-Boussinesq
3245+
logical :: Boussinesq ! If true, this run is fully Boussinesq
3246+
logical :: semi_Boussinesq ! If true, this run is partially non-Boussinesq
32443247
logical :: use_int_tides
32453248
integer :: num_freq, num_angle , num_mode, period_1
32463249
integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB, i, j, a, fr
3247-
character(64) :: var_name, cfr
3250+
character(64) :: var_name, cfr, units
32483251

32493252
type(axis_info) :: axes_inttides(2)
32503253
real, dimension(:), allocatable :: angles, freqs ! Lables for angles and frequencies [nondim]
32513254
real :: HZ2_T2_to_J_m2 ! unit conversion factor for Energy from internal to mks [H Z2 T-2 ~> m3 s-2 or J m-2]
32523255

32533256
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed
32543257

3255-
HZ2_T2_to_J_m2 = GV%H_to_kg_m2*(US%Z_to_m**2)*(US%s_to_T**2)
3258+
HZ2_T2_to_J_m2 = GV%H_to_MKS*(US%Z_to_m**2)*(US%s_to_T**2)
32563259

32573260
if (associated(CS)) then
32583261
call MOM_error(WARNING, "register_int_tide_restarts called "//&
@@ -3267,6 +3270,19 @@ subroutine register_int_tide_restarts(G, GV, US, param_file, CS, restart_CS)
32673270
call get_param(param_file, "MOM", "INTERNAL_TIDE_FREQS", num_freq, default=1)
32683271
call get_param(param_file, "MOM", "INTERNAL_TIDE_MODES", num_mode, default=1)
32693272

3273+
! define restart units depemding on Boussinesq
3274+
call get_param(param_file, "MOM", "BOUSSINESQ", Boussinesq, &
3275+
"If true, make the Boussinesq approximation.", default=.true., do_not_log=.true.)
3276+
call get_param(param_file, "MOM", "SEMI_BOUSSINESQ", semi_Boussinesq, &
3277+
"If true, do non-Boussinesq pressure force calculations and use mass-based "//&
3278+
"thicknesses, but use RHO_0 to convert layer thicknesses into certain "//&
3279+
"height changes. This only applies if BOUSSINESQ is false.", &
3280+
default=.true., do_not_log=.true.)
3281+
non_Bous = .not.(Boussinesq .or. semi_Boussinesq)
3282+
3283+
units="J m-2"
3284+
if (non_Bous) units="m3 s-2"
3285+
32703286
allocate (angles(num_angle))
32713287
allocate (freqs(num_freq))
32723288

@@ -3293,7 +3309,7 @@ subroutine register_int_tide_restarts(G, GV, US, param_file, CS, restart_CS)
32933309
! register all 4d restarts and copy into full Energy array when restarting from previous state
32943310
call register_restart_field(CS%En_restart_mode1(:,:,:,:), "IW_energy_mode1", .false., restart_CS, &
32953311
longname="The internal wave energy density f(i,j,angle,freq) for mode 1", &
3296-
units="J m-2", conversion=HZ2_T2_to_J_m2, z_grid='1', t_grid="s", &
3312+
units=units, conversion=HZ2_T2_to_J_m2, z_grid='1', t_grid="s", &
32973313
extra_axes=axes_inttides)
32983314

32993315
do fr=1,num_freq ; do a=1,num_angle ; do j=jsd,jed ; do i=isd,ied
@@ -3303,7 +3319,7 @@ subroutine register_int_tide_restarts(G, GV, US, param_file, CS, restart_CS)
33033319
if (num_mode >= 2) then
33043320
call register_restart_field(CS%En_restart_mode2(:,:,:,:), "IW_energy_mode2", .false., restart_CS, &
33053321
longname="The internal wave energy density f(i,j,angle,freq) for mode 2", &
3306-
units="J m-2", conversion=HZ2_T2_to_J_m2, z_grid='1', t_grid="s", &
3322+
units=units, conversion=HZ2_T2_to_J_m2, z_grid='1', t_grid="s", &
33073323
extra_axes=axes_inttides)
33083324

33093325
do fr=1,num_freq ; do a=1,num_angle ; do j=jsd,jed ; do i=isd,ied
@@ -3315,7 +3331,7 @@ subroutine register_int_tide_restarts(G, GV, US, param_file, CS, restart_CS)
33153331
if (num_mode >= 3) then
33163332
call register_restart_field(CS%En_restart_mode3(:,:,:,:), "IW_energy_mode3", .false., restart_CS, &
33173333
longname="The internal wave energy density f(i,j,angle,freq) for mode 3", &
3318-
units="J m-2", conversion=HZ2_T2_to_J_m2, z_grid='1', t_grid="s", &
3334+
units=units, conversion=HZ2_T2_to_J_m2, z_grid='1', t_grid="s", &
33193335
extra_axes=axes_inttides)
33203336

33213337
do fr=1,num_freq ; do a=1,num_angle ; do j=jsd,jed ; do i=isd,ied
@@ -3327,7 +3343,7 @@ subroutine register_int_tide_restarts(G, GV, US, param_file, CS, restart_CS)
33273343
if (num_mode >= 4) then
33283344
call register_restart_field(CS%En_restart_mode4(:,:,:,:), "IW_energy_mode4", .false., restart_CS, &
33293345
longname="The internal wave energy density f(i,j,angle,freq) for mode 4", &
3330-
units="J m-2", conversion=HZ2_T2_to_J_m2, z_grid='1', t_grid="s", &
3346+
units=units, conversion=HZ2_T2_to_J_m2, z_grid='1', t_grid="s", &
33313347
extra_axes=axes_inttides)
33323348

33333349
do fr=1,num_freq ; do a=1,num_angle ; do j=jsd,jed ; do i=isd,ied
@@ -3339,7 +3355,7 @@ subroutine register_int_tide_restarts(G, GV, US, param_file, CS, restart_CS)
33393355
if (num_mode >= 5) then
33403356
call register_restart_field(CS%En_restart_mode5(:,:,:,:), "IW_energy_mode5", .false., restart_CS, &
33413357
longname="The internal wave energy density f(i,j,angle,freq) for mode 5", &
3342-
units="J m-2", conversion=HZ2_T2_to_J_m2, z_grid='1', t_grid="s", &
3358+
units=units, conversion=HZ2_T2_to_J_m2, z_grid='1', t_grid="s", &
33433359
extra_axes=axes_inttides)
33443360

33453361
do fr=1,num_freq ; do a=1,num_angle ; do j=jsd,jed ; do i=isd,ied

0 commit comments

Comments
 (0)