mom_restart module reference¶
The MOM6 facility for reading and writing restart files, and querying what has been read.
Data Types¶
A structure with information about a single restart field. |
|
A restart registry and the control structure for restarts. |
|
A structure to store information about restart fields that are no longer used. |
|
A type for making arrays of pointers to scalars. |
|
A type for making arrays of pointers to 1-d arrays. |
|
A type for making arrays of pointers to 2-d arrays. |
|
A type for making arrays of pointers to 3-d arrays. |
|
A type for making arrays of pointers to 4-d arrays. |
Functions/Subroutines¶
Register a 3-d field for restarts, providing the metadata in a structure. |
|
Register a 4-d field for restarts, providing the metadata in a structure. |
|
Register a 2-d field for restarts, providing the metadata in a structure. |
|
Register a 1-d field for restarts, providing the metadata in a structure. |
|
Register a 0-d field for restarts, providing the metadata in a structure. |
|
Register a pair of rotationally equivalent 2d restart fields. |
|
Register a pair of rotationally equivalent 3d restart fields. |
|
Register a pair of rotationally equivalent 2d restart fields. |
|
Register a 4-d field for restarts, providing the metadata as individual arguments. |
|
Register a 3-d field for restarts, providing the metadata as individual arguments. |
|
Register a 2-d field for restarts, providing the metadata as individual arguments. |
|
Register a 1-d field for restarts, providing the metadata as individual arguments. |
|
Register a 0-d field for restarts, providing the metadata as individual arguments. |
|
query_initialized_name determines whether a named field has been successfully read from a restart file yet. |
|
Indicate whether the field pointed to by f_ptr has been initialized from a restart file. |
|
Indicate whether the field pointed to by f_ptr has been initialized from a restart file. |
|
Indicate whether the field pointed to by f_ptr has been initialized from a restart file. |
|
Indicate whether the field pointed to by f_ptr has been initialized from a restart file. |
|
Indicate whether the field pointed to by f_ptr has been initialized from a restart file. |
|
Indicate whether the field pointed to by f_ptr or with the specified variable name has been initialized from a restart file. |
|
Indicate whether the field pointed to by f_ptr or with the specified variable name has been initialized from a restart file. |
|
Indicate whether the field pointed to by f_ptr or with the specified variable name has been initialized from a restart file. |
|
Indicate whether the field pointed to by f_ptr or with the specified variable name has been initialized from a restart file. |
|
Indicate whether the field pointed to by f_ptr or with the specified variable name has been initialized from a restart file. |
|
save_restart saves all registered variables to restart files. |
|
restore_state reads the model state from previously generated files. All restart variables are read from the first file in the input filename list in which they are found. |
|
restart_files_exist determines whether any restart files exist. |
|
determine_is_new_run determines from the value of filename and the existence automatically named restart files in directory whether this would be a new, and as a side effect stores this information in CS. |
|
is_new_run returns whether this is going to be a new run based on the information stored in CS by a previous call to determine_is_new_run. |
|
open_restart_units determines the number of existing restart files and optionally opens them and returns unit ids, paths and whether the files are global or spatially decomposed. |
|
Initialize this module and set up a restart control structure. |
|
Indicate that all variables have now been registered. |
|
Deallocate memory associated with a MOM_restart_CS variable. |
|
Return bounds for computing checksums to store in restart files. |
Detailed Description¶
The MOM6 facility for reading and writing restart files, and querying what has been read.
Type Documentation¶
-
type
mom_restart/field_restart¶ A structure with information about a single restart field.
- Type fields
%vars[type(vardesc),private] :: Description of a field that is to be read from or written to the restart file.%mand_var[logical,private] :: If .true. the run will abort if this field is not successfully read from the restart file.%initialized[logical,private] :: .true. if this field has been read from the restart file.%var_name[character (len=32),private] :: A name by which a variable may be queried.
-
type
mom_restart/mom_restart_cs¶ A restart registry and the control structure for restarts.
- Type fields
%var_ptr0d[type( p0d )(:),pointer] :: Pointers to the fields that have been registered for restarts.%var_ptr1d[type( p1d )(:),pointer] :: Pointers to the fields that have been registered for restarts.%var_ptr2d[type( p2d )(:),pointer] :: Pointers to the fields that have been registered for restarts.%var_ptr3d[type( p3d )(:),pointer] :: Pointers to the fields that have been registered for restarts.%var_ptr4d[type( p4d )(:),pointer] :: Pointers to the fields that have been registered for restarts.%restart[logical] :: restart is set to .true. if the run has been started from a full restart file. Otherwise some fields must be initialized approximately.%novars[integer] :: The number of restart fields that have been registered.%num_obsolete_vars[integer] :: The number of obsolete restart fields that have been registered.%parallel_restartfiles[logical] :: If true, each PE writes its own restart file, otherwise they are combined internally.%large_file_support[logical] :: If true, NetCDF 3.6 or later is being used and large-file-support is enabled.%new_run[logical] :: If true, the input filenames and restart file existence will result in a new run that is not initialized from restart files.%new_run_set[logical] :: If true, new_run has been determined for this restart_CS.%checksum_required[logical] :: If true, require the restart checksums to match and error out otherwise. Users may want to avoid this comparison if for example the restarts are made from a run with a different mask_table than the current run, in which case the checksums will not match and cause crash.%restartfile[character (len=240)] :: The name or name root for MOM restart files.%turns[integer] :: Number of quarter turns from input to model domain.%restart_field[type( field_restart )(:),pointer] :: An array of descriptions of the registered fields.%restart_obsolete[type( obsolete_restart )(:),pointer] :: An array of obsolete restart fields.%max_fields[integer] :: The maximum number of restart fields.
-
type
mom_restart/obsolete_restart¶ A structure to store information about restart fields that are no longer used.
- Type fields
%field_name[character (len=32),private] :: Name of restart field that is no longer in use.%replacement_name[character (len=32),private] :: Name of replacement restart field, if applicable.
-
type
mom_restart/p0d¶ A type for making arrays of pointers to scalars.
- Type fields
%p[real,pointer, private] :: A pointer to a scalar.
-
type
mom_restart/p1d¶ A type for making arrays of pointers to 1-d arrays.
- Type fields
%p[real(:),pointer, private] :: A pointer to a 1d array.
-
type
mom_restart/p2d¶ A type for making arrays of pointers to 2-d arrays.
- Type fields
%p[real(:,:),pointer, private] :: A pointer to a 2d array.
-
type
mom_restart/p3d¶ A type for making arrays of pointers to 3-d arrays.
- Type fields
%p[real(:,:,:),pointer, private] :: A pointer to a 3d array.
-
type
mom_restart/p4d¶ A type for making arrays of pointers to 4-d arrays.
- Type fields
%p[real(:,:,:,:),pointer, private] :: A pointer to a 4d array.
Function/Subroutine Documentation¶
-
subroutine
mom_restart/register_restart_field_as_obsolete(field_name, replacement_name, CS)¶ - Parameters
field_name :: [in] Name of restart field that is no longer in use
replacement_name :: [in] Name of replacement restart field, if applicable
cs :: A pointer to a MOM_restart_CS object (intent in/out)
- Called from
-
subroutine
mom_restart/register_restart_field_ptr3d(f_ptr, var_desc, mandatory, CS)¶ Register a 3-d field for restarts, providing the metadata in a structure.
- Parameters
f_ptr :: [in] A pointer to the field to be read or written
var_desc :: [in] A structure with metadata about this variable
mandatory :: [in] If true, the run will abort if this field is not successfully read from the restart file.
cs :: A pointer to a MOM_restart_CS object (intent in/out)
- Call to
- Called from
-
subroutine
mom_restart/register_restart_field_ptr4d(f_ptr, var_desc, mandatory, CS)¶ Register a 4-d field for restarts, providing the metadata in a structure.
- Parameters
f_ptr :: [in] A pointer to the field to be read or written
var_desc :: [in] A structure with metadata about this variable
mandatory :: [in] If true, the run will abort if this field is not successfully read from the restart file.
cs :: A pointer to a MOM_restart_CS object (intent in/out)
- Call to
- Called from
-
subroutine
mom_restart/register_restart_field_ptr2d(f_ptr, var_desc, mandatory, CS)¶ Register a 2-d field for restarts, providing the metadata in a structure.
- Parameters
f_ptr :: [in] A pointer to the field to be read or written
var_desc :: [in] A structure with metadata about this variable
mandatory :: [in] If true, the run will abort if this field is not successfully read from the restart file.
cs :: A pointer to a MOM_restart_CS object (intent in/out)
- Call to
- Called from
-
subroutine
mom_restart/register_restart_field_ptr1d(f_ptr, var_desc, mandatory, CS)¶ Register a 1-d field for restarts, providing the metadata in a structure.
- Parameters
f_ptr :: [in] A pointer to the field to be read or written
var_desc :: [in] A structure with metadata about this variable
mandatory :: [in] If true, the run will abort if this field is not successfully read from the restart file.
cs :: A pointer to a MOM_restart_CS object (intent in/out)
- Call to
- Called from
-
subroutine
mom_restart/register_restart_field_ptr0d(f_ptr, var_desc, mandatory, CS)¶ Register a 0-d field for restarts, providing the metadata in a structure.
- Parameters
f_ptr :: [in] A pointer to the field to be read or written
var_desc :: [in] A structure with metadata about this variable
mandatory :: [in] If true, the run will abort if this field is not successfully read from the restart file.
cs :: A pointer to a MOM_restart_CS object (intent in/out)
- Call to
- Called from
-
subroutine
mom_restart/register_restart_pair_ptr2d(a_ptr, b_ptr, a_desc, b_desc, mandatory, CS)¶ Register a pair of rotationally equivalent 2d restart fields.
- Parameters
a_ptr :: [in] First field pointer
b_ptr :: [in] Second field pointer
a_desc :: [in] First field descriptor
b_desc :: [in] Second field descriptor
mandatory :: [in] If true, abort if field is missing
cs :: MOM restart control structure
-
subroutine
mom_restart/register_restart_pair_ptr3d(a_ptr, b_ptr, a_desc, b_desc, mandatory, CS)¶ Register a pair of rotationally equivalent 3d restart fields.
- Parameters
a_ptr :: [in] First field pointer
b_ptr :: [in] Second field pointer
a_desc :: [in] First field descriptor
b_desc :: [in] Second field descriptor
mandatory :: [in] If true, abort if field is missing
cs :: MOM restart control structure
-
subroutine
mom_restart/register_restart_pair_ptr4d(a_ptr, b_ptr, a_desc, b_desc, mandatory, CS)¶ Register a pair of rotationally equivalent 2d restart fields.
- Parameters
a_ptr :: [in] First field pointer
b_ptr :: [in] Second field pointer
a_desc :: [in] First field descriptor
b_desc :: [in] Second field descriptor
mandatory :: [in] If true, abort if field is missing
cs :: MOM restart control structure
-
subroutine
mom_restart/register_restart_field_4d(f_ptr, name, mandatory, CS, longname, units, hor_grid, z_grid, t_grid)¶ Register a 4-d field for restarts, providing the metadata as individual arguments.
- Parameters
f_ptr :: [in] A pointer to the field to be read or written
name :: [in] variable name to be used in the restart file
mandatory :: [in] If true, the run will abort if this field is not successfully read from the restart file.
cs :: A pointer to a MOM_restart_CS object (intent in/out)
longname :: [in] variable long name
units :: [in] variable units
hor_grid :: [in] variable horizonal staggering, ‘h’ if absent
z_grid :: [in] variable vertical staggering, ‘L’ if absent
t_grid :: [in] time description: s, p, or 1, ‘s’ if absent
- Call to
-
subroutine
mom_restart/register_restart_field_3d(f_ptr, name, mandatory, CS, longname, units, hor_grid, z_grid, t_grid)¶ Register a 3-d field for restarts, providing the metadata as individual arguments.
- Parameters
f_ptr :: [in] A pointer to the field to be read or written
name :: [in] variable name to be used in the restart file
mandatory :: [in] If true, the run will abort if this field is not successfully read from the restart file.
cs :: A pointer to a MOM_restart_CS object (intent in/out)
longname :: [in] variable long name
units :: [in] variable units
hor_grid :: [in] variable horizonal staggering, ‘h’ if absent
z_grid :: [in] variable vertical staggering, ‘L’ if absent
t_grid :: [in] time description: s, p, or 1, ‘s’ if absent
- Call to
-
subroutine
mom_restart/register_restart_field_2d(f_ptr, name, mandatory, CS, longname, units, hor_grid, z_grid, t_grid)¶ Register a 2-d field for restarts, providing the metadata as individual arguments.
- Parameters
f_ptr :: [in] A pointer to the field to be read or written
name :: [in] variable name to be used in the restart file
mandatory :: [in] If true, the run will abort if this field is not successfully read from the restart file.
cs :: A pointer to a MOM_restart_CS object (intent in/out)
longname :: [in] variable long name
units :: [in] variable units
hor_grid :: [in] variable horizonal staggering, ‘h’ if absent
z_grid :: [in] variable vertical staggering, ‘1’ if absent
t_grid :: [in] time description: s, p, or 1, ‘s’ if absent
- Call to
-
subroutine
mom_restart/register_restart_field_1d(f_ptr, name, mandatory, CS, longname, units, hor_grid, z_grid, t_grid)¶ Register a 1-d field for restarts, providing the metadata as individual arguments.
- Parameters
f_ptr :: [in] A pointer to the field to be read or written
name :: [in] variable name to be used in the restart file
mandatory :: [in] If true, the run will abort if this field is not successfully read from the restart file.
cs :: A pointer to a MOM_restart_CS object (intent in/out)
longname :: [in] variable long name
units :: [in] variable units
hor_grid :: [in] variable horizonal staggering, ‘1’ if absent
z_grid :: [in] variable vertical staggering, ‘L’ if absent
t_grid :: [in] time description: s, p, or 1, ‘s’ if absent
- Call to
-
subroutine
mom_restart/register_restart_field_0d(f_ptr, name, mandatory, CS, longname, units, t_grid)¶ Register a 0-d field for restarts, providing the metadata as individual arguments.
- Parameters
f_ptr :: [in] A pointer to the field to be read or written
name :: [in] variable name to be used in the restart file
mandatory :: [in] If true, the run will abort if this field is not successfully read from the restart file.
cs :: A pointer to a MOM_restart_CS object (intent in/out)
longname :: [in] variable long name
units :: [in] variable units
t_grid :: [in] time description: s, p, or 1, ‘s’ if absent
- Call to
-
function
mom_restart/query_initialized_name(name, CS) [logical]¶ query_initialized_name determines whether a named field has been successfully read from a restart file yet.
- Parameters
name :: [in] The name of the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
mom_error_handler::is_root_pemom_error_handler::mom_errorrestart_error- Called from
query_initialized_0d_namequery_initialized_1d_namequery_initialized_2d_namequery_initialized_3d_namequery_initialized_4d_name
-
function
mom_restart/query_initialized_0d(f_ptr, CS) [logical]¶ Indicate whether the field pointed to by f_ptr has been initialized from a restart file.
- Parameters
f_ptr :: [in] A pointer to the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
-
function
mom_restart/query_initialized_1d(f_ptr, CS) [logical]¶ Indicate whether the field pointed to by f_ptr has been initialized from a restart file.
- Parameters
f_ptr :: [in] A pointer to the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
-
function
mom_restart/query_initialized_2d(f_ptr, CS) [logical]¶ Indicate whether the field pointed to by f_ptr has been initialized from a restart file.
- Parameters
f_ptr :: [in] A pointer to the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
-
function
mom_restart/query_initialized_3d(f_ptr, CS) [logical]¶ Indicate whether the field pointed to by f_ptr has been initialized from a restart file.
- Parameters
f_ptr :: [in] A pointer to the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
-
function
mom_restart/query_initialized_4d(f_ptr, CS) [logical]¶ Indicate whether the field pointed to by f_ptr has been initialized from a restart file.
- Parameters
f_ptr :: [in] A pointer to the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
-
function
mom_restart/query_initialized_0d_name(f_ptr, name, CS) [logical]¶ Indicate whether the field pointed to by f_ptr or with the specified variable name has been initialized from a restart file.
- Parameters
f_ptr :: [in] A pointer to the field that is being queried
name :: [in] The name of the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
mom_error_handler::is_root_pemom_error_handler::mom_errorquery_initialized_namerestart_error
-
function
mom_restart/query_initialized_1d_name(f_ptr, name, CS) [logical]¶ Indicate whether the field pointed to by f_ptr or with the specified variable name has been initialized from a restart file.
- Parameters
f_ptr :: [in] A pointer to the field that is being queried
name :: [in] The name of the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
mom_error_handler::is_root_pemom_error_handler::mom_errorquery_initialized_namerestart_error
-
function
mom_restart/query_initialized_2d_name(f_ptr, name, CS) [logical]¶ Indicate whether the field pointed to by f_ptr or with the specified variable name has been initialized from a restart file.
- Parameters
f_ptr :: [in] A pointer to the field that is being queried
name :: [in] The name of the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
mom_error_handler::is_root_pemom_error_handler::mom_errorquery_initialized_namerestart_error
-
function
mom_restart/query_initialized_3d_name(f_ptr, name, CS) [logical]¶ Indicate whether the field pointed to by f_ptr or with the specified variable name has been initialized from a restart file.
- Parameters
f_ptr :: [in] A pointer to the field that is being queried
name :: [in] The name of the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
mom_error_handler::is_root_pemom_error_handler::mom_errorquery_initialized_namerestart_error
-
function
mom_restart/query_initialized_4d_name(f_ptr, name, CS) [logical]¶ Indicate whether the field pointed to by f_ptr or with the specified variable name has been initialized from a restart file.
- Parameters
f_ptr :: [in] A pointer to the field that is being queried
name :: [in] The name of the field that is being queried
cs :: A pointer to a MOM_restart_CS object (intent in)
- Call to
mom_error_handler::is_root_pemom_error_handler::mom_errorquery_initialized_namerestart_error
-
subroutine
mom_restart/save_restart(directory, time, G, CS, time_stamped, filename, GV, num_rest_files)¶ save_restart saves all registered variables to restart files.
- Parameters
directory :: [in] The directory where the restart files are to be written
time :: [in] The current model time
g :: [inout] The ocean’s grid structure
cs :: The control structure returned by a previous call to restart_init.
time_stamped :: [in] If present and true, add time-stamp to the restart file names.
filename :: [in] A filename that overrides the name in CSrestartfile.
gv :: [in] The ocean’s vertical grid structure
num_rest_files :: [out] number of restart files written
- Call to
get_checksum_loop_rangesmom_error_handler::mom_errorrestart_error- Called from
mom_surface_forcing_gfdl::forcing_save_restartmom_surface_forcing::forcing_save_restartmom_mainocean_model_mod::ocean_model_restartocean_model_mod::ocean_model_save_restart
-
subroutine
mom_restart/restore_state(filename, directory, day, G, CS)¶ restore_state reads the model state from previously generated files. All restart variables are read from the first file in the input filename list in which they are found.
- Parameters
filename :: [in] The list of restart file names or a single character ‘r’ to read automatically named files.
directory :: [in] The directory in which to find restart files
day :: [out] The time of the restarted run
g :: [in] The ocean’s grid structure
cs :: The control structure returned by a previous call to restart_init.
- Call to
get_checksum_loop_rangesmom_error_handler::is_root_pemom_string_functions::lowercasemom_error_handler::mom_erroropen_restart_unitsrestart_error- Called from
mom_ice_shelf::initialize_ice_shelfmom_state_initialization::mom_initialize_statemom_surface_forcing_gfdl::surface_forcing_initmom_surface_forcing::surface_forcing_init
-
function
mom_restart/restart_files_exist(filename, directory, G, CS) [logical]¶ restart_files_exist determines whether any restart files exist.
- Parameters
filename :: [in] The list of restart file names or a single character ‘r’ to read automatically named files.
directory :: [in] The directory in which to find restart files
g :: [in] The ocean’s grid structure
cs :: The control structure returned by a previous call to restart_init.
- Return
undefined :: The function result, which indicates whether any of the explicitly or automatically named restart files exist in directory.
- Call to
-
function
mom_restart/determine_is_new_run(filename, directory, G, CS) [logical]¶ determine_is_new_run determines from the value of filename and the existence automatically named restart files in directory whether this would be a new, and as a side effect stores this information in CS.
- Parameters
filename :: [in] The list of restart file names or a single character ‘r’ to read automatically named files.
directory :: [in] The directory in which to find restart files
g :: [in] The ocean’s grid structure
cs :: The control structure returned by a previous call to restart_init.
- Return
undefined :: The function result, which indicates whether this is a new run, based on the value of filename and whether restart files exist.
- Call to
- Called from
-
function
mom_restart/is_new_run(CS) [logical]¶ is_new_run returns whether this is going to be a new run based on the information stored in CS by a previous call to determine_is_new_run.
- Parameters
cs :: The control structure returned by a previous call to restart_init.
- Return
undefined :: The function result, which indicates whether this is a new run, based on the value of filename and whether restart files exist.
- Call to
-
function
mom_restart/open_restart_units(filename, directory, G, CS, units, file_paths, global_files) [integer]¶ open_restart_units determines the number of existing restart files and optionally opens them and returns unit ids, paths and whether the files are global or spatially decomposed.
- Parameters
filename :: [in] The list of restart file names or a single character ‘r’ to read automatically named files.
directory :: [in] The directory in which to find restart files
g :: [in] The ocean’s grid structure
cs :: The control structure returned by a previous call to restart_init.
units :: [out] The mpp units of all opened files.
file_paths :: [out] The full paths to open files.
global_files :: [out] True if a file is global.
- Return
undefined :: The number of files (both automatically named restart files and others explicitly in filename) that have been opened.
- Call to
- Called from
-
subroutine
mom_restart/restart_init(param_file, CS, restart_root)¶ Initialize this module and set up a restart control structure.
- Parameters
param_file :: [in] A structure to parse for run-time parameters
cs :: A pointer to a MOM_restart_CS object that is allocated here
restart_root :: [in] A filename root that overrides the value
- Call to
- Called from
-
subroutine
mom_restart/restart_init_end(CS)¶ Indicate that all variables have now been registered.
- Parameters
cs :: A pointer to a MOM_restart_CS object
- Call to
- Called from
mom_surface_forcing_gfdl::surface_forcing_initmom_surface_forcing::surface_forcing_init
-
subroutine
mom_restart/restart_end(CS)¶ Deallocate memory associated with a MOM_restart_CS variable.
- Parameters
cs :: A pointer to a MOM_restart_CS object
- Called from
-
subroutine
mom_restart/restart_error(CS)¶ - Parameters
cs :: A pointer to a MOM_restart_CS object
- Call to
- Called from
query_initialized_0dquery_initialized_0d_namequery_initialized_1dquery_initialized_1d_namequery_initialized_2dquery_initialized_2d_namequery_initialized_3dquery_initialized_3d_namequery_initialized_4dquery_initialized_4d_namequery_initialized_namerestore_statesave_restart
-
subroutine
mom_restart/get_checksum_loop_ranges(G, pos, isL, ieL, jsL, jeL)¶ Return bounds for computing checksums to store in restart files.
- Parameters
g :: [in] The ocean’s grid structure
pos :: [in] An integer indicating staggering of variable
isl :: [out] i-start for checksum
iel :: [out] i-end for checksum
jsl :: [out] j-start for checksum
jel :: [out] j-end for checksum
- Called from