Skip to content

Commit

Permalink
+Add new parameter FATAL_INCONSISTENT_RESTART_TIME (#1511)
Browse files Browse the repository at this point in the history
Add the new runtime parameter FATAL_INCONSISTENT_RESTART_TIME, which if true
causes the model to compare the restart time read from a restart file with any
value provided as a time_in to MOM_initialize_state and issue a fatal error if
they differ.  In ocean-only mode, this input time is read from a ocean_solo.res
file, following FMS behavior.  The default value simply uses the specified time,
replicating the previous behavior.  If set to true, this would prevent a problem
with the time-history that recently occurred in a series of high-resolution runs
that were shared between several groups, where the nominal times were repeated.
All answers are bitwise identical, but many MOM_parameter_doc files have a new
entry.
  • Loading branch information
Hallberg-NOAA authored Oct 14, 2021
1 parent 393df05 commit 5bc0be3
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module MOM_state_initialization
use MOM_ALE_sponge, only : set_up_ALE_sponge_field, set_up_ALE_sponge_vel_field
use MOM_ALE_sponge, only : ALE_sponge_CS, initialize_ALE_sponge
use MOM_string_functions, only : uppercase, lowercase
use MOM_time_manager, only : time_type
use MOM_time_manager, only : time_type, operator(/=)
use MOM_tracer_registry, only : tracer_registry_type
use MOM_unit_scaling, only : unit_scale_type
use MOM_variables, only : thermo_var_ptrs
Expand Down Expand Up @@ -163,6 +163,7 @@ subroutine MOM_initialize_state(u, v, h, tv, Time, G, GV, US, PF, dirs, &
logical :: new_sim
integer :: write_geom
logical :: use_temperature, use_sponge, use_OBC, use_oda_incupd
logical :: verify_restart_time
logical :: use_EOS ! If true, density is calculated from T & S using an equation of state.
logical :: depress_sfc ! If true, remove the mass that would be displaced
! by a large surface pressure by squeezing the column.
Expand Down Expand Up @@ -235,14 +236,20 @@ subroutine MOM_initialize_state(u, v, h, tv, Time, G, GV, US, PF, dirs, &
depth_tot(i,j) = G%bathyT(i,j) + G%Z_ref
enddo ; enddo

call get_param(PF, mdl, "FATAL_INCONSISTENT_RESTART_TIME", verify_restart_time, &
"If true and a time_in value is provided to MOM_initialize_state, verify that "//&
"the time read from a restart file is the same as time_in, and issue a fatal "//&
"error if it is not. Otherwise, simply set the time to time_in if present.", &
default=.false.)

! The remaining initialization calls are done, regardless of whether the
! fields are actually initialized here (if just_read=.false.) or whether it
! is just to make sure that all valid parameters are read to enable the
! detection of unused parameters.
call get_param(PF, mdl, "INIT_LAYERS_FROM_Z_FILE", from_Z_file, &
"If true, initialize the layer thicknesses, temperatures, "//&
"and salinities from a Z-space file on a latitude-longitude "//&
"grid.", default=.false., do_not_log=just_read)
"If true, initialize the layer thicknesses, temperatures, and "//&
"salinities from a Z-space file on a latitude-longitude grid.", &
default=.false., do_not_log=just_read)

if (from_Z_file) then
! Initialize thickness and T/S from z-coordinate data in a file.
Expand Down Expand Up @@ -507,7 +514,11 @@ subroutine MOM_initialize_state(u, v, h, tv, Time, G, GV, US, PF, dirs, &
! This line calls a subroutine that reads the initial conditions
! from a previously generated file.
call restore_state(dirs%input_filename, dirs%restart_input_dir, Time, G, restart_CS)
if (present(Time_in)) Time = Time_in
if (present(Time_in)) then
if (verify_restart_time .and. (Time /= Time_in)) call MOM_error(FATAL, &
"MOM6 attempted to restart from a file from a different time than given by Time_in.")
Time = Time_in
endif
if ((GV%m_to_H_restart /= 0.0) .and. (GV%m_to_H_restart /= GV%m_to_H)) then
H_rescale = GV%m_to_H / GV%m_to_H_restart
do k=1,nz ; do j=js,je ; do i=is,ie ; h(i,j,k) = H_rescale * h(i,j,k) ; enddo ; enddo ; enddo
Expand Down

0 comments on commit 5bc0be3

Please sign in to comment.