From 333e3ff3a8b203e2909198b53295cf0408b5021c Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 27 Sep 2024 07:59:29 -0500 Subject: [PATCH] Add Omega IOStreams to convergence and manufactured_solution --- polaris/ocean/convergence/forward.py | 4 ++ .../tasks/manufactured_solution/forward.py | 11 ----- .../tasks/manufactured_solution/forward.yaml | 42 ++++++++++++++----- 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/polaris/ocean/convergence/forward.py b/polaris/ocean/convergence/forward.py index 68c3c15c9..e0ca5416f 100644 --- a/polaris/ocean/convergence/forward.py +++ b/polaris/ocean/convergence/forward.py @@ -139,12 +139,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, diff --git a/polaris/ocean/tasks/manufactured_solution/forward.py b/polaris/ocean/tasks/manufactured_solution/forward.py index 62bd76a4d..fee1db144 100644 --- a/polaris/ocean/tasks/manufactured_solution/forward.py +++ b/polaris/ocean/tasks/manufactured_solution/forward.py @@ -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 diff --git a/polaris/ocean/tasks/manufactured_solution/forward.yaml b/polaris/ocean/tasks/manufactured_solution/forward.yaml index f7aefa138..776359db2 100644 --- a/polaris/ocean/tasks/manufactured_solution/forward.yaml +++ b/polaris/ocean/tasks/manufactured_solution/forward.yaml @@ -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 @@ -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