Skip to content

Commit

Permalink
Add Omega IOStreams to convergence and manufactured_solution
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Sep 27, 2024
1 parent ed88038 commit 37b73fa
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
4 changes: 4 additions & 0 deletions polaris/ocean/convergence/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@ def dynamic_model_config(self, at_setup):
output_interval_str = get_time_interval_string(
seconds=output_interval * s_per_hour)

# For Omega, we want the output interval as a number of seconds
output_freq = int(output_interval * s_per_hour)

replacements = dict(
time_integrator=time_integrator,
dt=dt_str,
btr_dt=btr_dt_str,
run_duration=run_duration_str,
output_interval=output_interval_str,
output_freq=f'{output_freq}'
)

self.add_yaml_file(self.package, self.yaml_filename,
Expand Down
11 changes: 0 additions & 11 deletions polaris/ocean/tasks/manufactured_solution/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ def __init__(self, component, name, resolution, subdir, init):
output_filename='output.nc',
validate_vars=['layerThickness', 'normalVelocity'])

def setup(self):
"""
TEMP: symlink initial condition to name hard-coded in Omega
"""
super().setup()
config = self.config
model = config.get('ocean', 'model')
# TODO: remove as soon as Omega supports I/O streams
if model == 'omega':
self.add_input_file(filename='OmegaMesh.nc', target='init.nc')

def compute_cell_count(self):
"""
Compute the approximate number of cells in the mesh, used to constrain
Expand Down
42 changes: 32 additions & 10 deletions polaris/ocean/tasks/manufactured_solution/forward.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ ocean:
time_integration:
config_dt: {{ dt }}
config_time_integrator: {{ time_integrator }}

mpas-ocean:
bottom_drag:
config_bottom_drag_mode: implicit
config_implicit_bottom_drag_type: constant
config_implicit_constant_bottom_drag_coeff: 0.0
manufactured_solution:
config_use_manufactured_solution: true
debug:
config_disable_vel_hmix: true
streams:
mesh:
filename_template: init.nc
Expand All @@ -22,19 +32,31 @@ ocean:
- layerThickness
- ssh

mpas-ocean:
bottom_drag:
config_bottom_drag_mode: implicit
config_implicit_bottom_drag_type: constant
config_implicit_constant_bottom_drag_coeff: 0.0
manufactured_solution:
config_use_manufactured_solution: true
debug:
config_disable_vel_hmix: true

Omega:
Tendencies:
VelDiffTendencyEnable: false
VelHyperDiffTendencyEnable: false
Dimension:
NVertLevels: 1
IOStreams:
InitialState:
UsePointerFile: false
Filename: init.nc
Mode: read
Precision: double
Freq: 1
FreqUnits: OnStartup
UseStartEnd: false
Contents:
- Restart
History:
UsePointerFile: false
Filename: output.nc
Mode: write
IfExists: replace
Precision: double
Freq: {{ output_freq }}
FreqUnits: Seconds
UseStartEnd: false
Contents:
- Tracers

0 comments on commit 37b73fa

Please sign in to comment.