Skip to content

Commit

Permalink
Merge pull request #239 from cbegeman/fixup-convergence-time-integrator
Browse files Browse the repository at this point in the history
Map time integrator for convergence tests

This PR uses a mapping between MPAS-O and Omega time integrator namelist options in the convergence forward step rather than in the manufactured solution test case. As more non-convergence Omega tests and supported Omega time integration schemes are added, this mapping may be moved.
  • Loading branch information
cbegeman authored Oct 31, 2024
2 parents 39c06b7 + b25f885 commit 6a5b748
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 10 additions & 1 deletion polaris/ocean/convergence/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def dynamic_model_config(self, at_setup):
section = config['convergence_forward']

time_integrator = section.get('time_integrator')

# dt is proportional to resolution: default 30 seconds per km
if time_integrator == 'RK4':
dt_per_km = section.getfloat('rk4_dt_per_km')
Expand All @@ -139,6 +138,16 @@ def dynamic_model_config(self, at_setup):
output_interval_str = get_time_interval_string(
seconds=output_interval * s_per_hour)

time_integrator_map = dict([('RK4', 'RungeKutta4')])
model = config.get('ocean', 'model')
if model == 'omega':
if time_integrator in time_integrator_map.keys():
time_integrator = time_integrator_map[time_integrator]
else:
print('Warning: mapping from time integrator '
f'{time_integrator} to omega not found, '
'retaining name given in config')

replacements = dict(
time_integrator=time_integrator,
dt=dt_str,
Expand Down
10 changes: 0 additions & 10 deletions polaris/ocean/tasks/manufactured_solution/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,3 @@ def __init__(self, component):
self.config.add_from_package(
'polaris.ocean.tasks.manufactured_solution',
'manufactured_solution.cfg')

def configure(self):
"""
Set omega default config options
"""
super().configure()
config = self.config
model = config.get('ocean', 'model')
if model == 'omega':
config.set('convergence_forward', 'time_integrator', 'RungeKutta4')

0 comments on commit 6a5b748

Please sign in to comment.