polaris.tasks.ocean.realistic_global.forward.forward.Forward
- class polaris.tasks.ocean.realistic_global.forward.forward.Forward(component, init_condition: InitialCondition, stage: ForwardStage | None = None, name='forward', subdir=None, indir=None, package='polaris.tasks.ocean.realistic_global.forward', yaml_filename='forward.yaml', forcing_yaml_filename='forcing.yaml', forcing_streams_yaml_filename='forcing_streams.yaml', output_filenames: List[str] | None = None, validate_vars=None, validate_class=None, check_properties=None, update_eos=False)[source]
A forward run of the configured ocean model for a realistic global ocean simulation.
The step gets its model inputs from an
InitialConditionand its run settings from aForwardStage. All MPAS-Ocean-vs-Omega branching is handled byOceanModelStepand the single mapping inForwardStage.model_replacements.- Variables:
init_condition (InitialCondition) – The source of the model input files.
stage (ForwardStage or None) – The model-agnostic settings for this run. When
None, they are built from the[realistic_global_forward]config section at setup and run time (so user config overrides take effect).package (str) – The package that contains
yaml_filename.yaml_filename (str) – The Jinja2 model-config template rendered from
stage.forcing_yaml_filename (str) – The model-config file that turns the wind forcing on. Always added.
forcing_streams_yaml_filename (str) – The Jinja2 template that points each model’s input stream at the file that holds the wind stress, which
init_conditionnames. Always added.stream_dirs (list of str) – Directories, relative to the step’s work directory, that Omega’s streams write into. Omega does not create them, so the step does, at setup and again at run time. MPAS-Ocean needs no equivalent, since the MPAS framework creates stream directories itself. Empty unless a task’s yaml files point a stream into a subdirectory.
- __init__(component, init_condition: InitialCondition, stage: ForwardStage | None = None, name='forward', subdir=None, indir=None, package='polaris.tasks.ocean.realistic_global.forward', yaml_filename='forward.yaml', forcing_yaml_filename='forcing.yaml', forcing_streams_yaml_filename='forcing_streams.yaml', output_filenames: List[str] | None = None, validate_vars=None, validate_class=None, check_properties=None, update_eos=False)[source]
Create the step.
- Parameters:
component (polaris.tasks.ocean.Ocean) – The ocean component the step belongs to.
init_condition (InitialCondition) – The source of the model input files (a database file or an upstream
realistic_global/initstep).stage (ForwardStage, optional) – The model-agnostic run settings. When not provided, they are built from the
[realistic_global_forward]config section.name (str, optional) – The name of the step.
subdir (str, optional) – The subdirectory for the step.
indir (str, optional) – The directory the step is in, to which
nameis appended (used whensubdiris not provided).package (str, optional) – The package that contains
yaml_filename.yaml_filename (str, optional) – A YAML file that is a Jinja2 template of model config options.
forcing_yaml_filename (str, optional) – A YAML file of the wind-forcing model config options, always added.
forcing_streams_yaml_filename (str, optional) – A YAML file that is a Jinja2 template of the forcing input streams, always added.
output_filenames (list of str, optional) – The files the run writes, relative to the step’s work directory, each declared as an output;
output.ncby default.validate_vars (list of str, optional) – Variables in each output file to validate against a baseline.
validate_class (str, optional) – A named class of variables from
variables.yamlto validate in each output file, such as'state', in addition tovalidate_vars.check_properties (list of str, optional) – Conservation properties of each output file to check.
update_eos (bool, optional) – Whether to update the equation of state from config options.
Methods
__init__(component, init_condition[, stage, ...])Create the step.
add_cf_check([filename])Check an output file for CF compliance after the step runs.
add_dependency(step[, name])Add step as a dependency of this step (i.e. this step can't run until the dependency has finished).
add_forcing_input_file(**kwargs)Add the surface-forcing input file using a placeholder that is resolved to the configured filename at
process_inputs_and_outputs()time.add_horiz_mesh_input_file(**kwargs)Add the horizontal-mesh input file using a placeholder that is resolved to the configured filename at
process_inputs_and_outputs()time.add_init_input_file(**kwargs)Add the initial-condition input file using a placeholder that is resolved to the configured filename at
process_inputs_and_outputs()time.add_input_file([filename, target, database, ...])Add an input file to the step (but not necessarily to the MPAS model).
add_model_config_options(options[, config_model])Add the replacement model config options to be parsed when generating a namelist or yaml file if and when the step gets set up.
add_namelist_file(package, namelist)Add a file with updates to namelist options to the step to be parsed when generating a complete namelist file if and when the step gets set up.
add_output_file(filename[, validate_vars, ...])Add an output file, optionally resolving
validate_classto a pre-defined list of variables from the Ocean component.add_property_check(filename, check_properties)Add a single conservation comparison for an output file
add_streams_file(package, streams[, ...])Add a streams file to the step to be parsed when generating a complete streams file if and when the step gets set up.
add_vert_coord_input_file([filename])Add the vertical-coordinate input file.
add_yaml_file(package, yaml[, ...])Add a file with updates to yaml config options to the step to be parsed when generating a complete yaml file if and when the step gets set up.
check_cf()Check every file Omega wrote for CF compliance: the first file of each write stream in the step's
omega.yml, since the files of a stream share their metadata.check_properties()Check conservation properties of the output files of this step
Compute the number of cells used to size resources.
constrain_resources(available_cores)Update the number of MPI tasks to use based on the estimated mesh size
dynamic_model_config(at_setup)Render
forward.yamlfrom the stage and add the physics options.get_forcing_filename()Get the configured local filename for the surface forcing file.
get_horiz_mesh_filename()Get the configured local filename for the horizontal mesh file.
get_init_filename()Get the configured local filename for the initial-condition file.
get_vert_coord_filename()Get the configured local filename for the vertical coordinate file.
map_yaml_configs(configs, config_model)A mapping between model sections and config options from MPAS-Ocean to Omega
map_yaml_options(options, config_model)A mapping between model config options from MPAS-Ocean to Omega
map_yaml_streams(streams, config_model)A mapping between model streams from different models.
map_yaml_to_namelist(options)A mapping from yaml model config options to namelist options.
open_model_dataset(filename[, config, ...])Open the given dataset, mapping variable and dimension names from Omega to MPAS-Ocean names if appropriate
partition([graph_file])Partition the domain for the requested number of tasks
process_inputs_and_outputs()Process the model and any configured model-input placeholders.
run()Run the step.
runtime_setup()Update IO task model config options, make graph file, and partition graph file (if any of these are requested)
set_model_resources([ntasks, min_tasks, ...])Update the resources for the step.
set_resources([cpus_per_task, ...])Update the resources for the subtask.
set_shared_config(config[, link])Replace the step's config parser with the shared config parser
setup()Add the initial-condition input files, then set up the model step.
update_io_tasks_config([config_model])Modify model config options so the number of IO tasks and the stride between them are consistent with how MPI tasks are distributed across nodes (one IO task per node).
update_namelist_eos()Modify the namelist to make it consistent with eos config options
update_namelist_pio([config_model])Deprecated alias for
update_io_tasks_config().validate_baselines()Compare variables between output files in this step and in the same step from a baseline run if one was provided.
work_path(*filenames)Get the absolute path to a file or directory in the step's work directory
Attributes
coresthe number of cores this step needs, in total
gpusthe number of GPUs this step needs, in total
may_span_nodeswhether this step's cores and GPUs may come from several nodes
min_coresthe number of cores this step needs in order to run at all
min_gpusthe number of GPUs this step requires, in total
componentconfiginput_datalogger