Skip to content
5 changes: 1 addition & 4 deletions polaris/ocean/convergence/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(self, component, name, subdir, resolution, mesh, init,
A list of variables to validate against a baseline if requested
"""
super().__init__(component=component, name=name, subdir=subdir,
openmp_threads=1)
openmp_threads=1, graph_filename=graph_filename)

self.resolution = resolution
self.package = package
Expand All @@ -75,9 +75,6 @@ def __init__(self, component, name, subdir, resolution, mesh, init,
self.add_input_file(
filename='init.nc',
work_dir_target=f'{init.path}/initial_state.nc')
self.add_input_file(
filename='graph.info',
work_dir_target=f'{mesh.path}/{graph_filename}')

self.add_output_file(filename=output_filename,
validate_vars=validate_vars)
Expand Down
8 changes: 7 additions & 1 deletion polaris/ocean/model/ocean_model_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ def __init__(self, component, name, subdir=None, indir=None, ntasks=None,
max_memory=max_memory, cached=cached, yaml=yaml,
update_pio=update_pio, make_graph=make_graph,
mesh_filename=mesh_filename, partition_graph=partition_graph,
graph_filename=graph_filename)
graph_filename='graph.info')

self.graph_target = graph_filename
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also rename the parameter from graph_filename to graph_target to avoid confusion.

Then, self.graph_target doesn't need to be an attribute since it's not used except below to add the input file.

self.dynamic_ntasks = (ntasks is None and min_tasks is None)

self.map: Union[None, List[Dict[str, Dict[str, str]]]] = None
Expand All @@ -112,9 +113,14 @@ def setup(self):
self.config_models = ['ocean', 'Omega']
self.yaml = 'omega.yml'
self._read_map()
self.partition_graph = False
elif model == 'mpas-ocean':
self.config_models = ['ocean', 'mpas-ocean']
self.make_yaml = False
self.add_input_file(
filename='graph.info',
work_dir_target=self.graph_target)

else:
raise ValueError(f'Unexpected ocean model: {model}')

Expand Down
2 changes: 1 addition & 1 deletion polaris/ocean/tasks/manufactured_solution/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, component, name, resolution, subdir, init):
resolution=resolution, mesh=init, init=init,
package='polaris.ocean.tasks.manufactured_solution',
yaml_filename='forward.yaml',
graph_filename='culled_graph.info',
graph_filename=f'{init.path}/culled_graph.info',
output_filename='output.nc',
validate_vars=['layerThickness', 'normalVelocity'])

Expand Down
10 changes: 8 additions & 2 deletions polaris/ocean/tasks/manufactured_solution/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ def __init__(self, component, resolution, taskdir):
name=f'init_{mesh_name}',
subdir=f'{taskdir}/init/{mesh_name}')
self.resolution = resolution
for filename in ['culled_mesh.nc', 'initial_state.nc',
'culled_graph.info']:

def setup(self):
super().setup()
output_filenames = ['culled_mesh.nc', 'initial_state.nc']
model = self.config.get('ocean', 'model')
if model == 'mpas-ocean':
output_filenames.append('culled_graph.info')
for filename in output_filenames:
self.add_output_file(filename=filename)

def run(self):
Expand Down