Skip to content

Commit f075490

Browse files
committed
Add Omega forcing to initial state, uodate namelist and streams
1 parent 69e6e44 commit f075490

File tree

4 files changed

+49
-23
lines changed

4 files changed

+49
-23
lines changed

polaris/ocean/model/mpaso_to_omega.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,21 @@ config:
6767
config_use_mom_del4: VelHyperDiffTendencyEnable
6868
config_mom_del4: ViscDel4
6969

70+
- section:
71+
forcing: Tendencies
72+
options:
73+
config_use_bulk_wind_stress: WindForcingTendencyEnable
74+
75+
- section:
76+
debug: Tendencies
77+
options:
78+
config_disable_vel_explicit_bottom_drag: BottomDragTendencyEnable
79+
80+
- section:
81+
bottom_drag: Tendencies
82+
options:
83+
config_explicit_bottom_drag_coeff: BottomDragCoeff
84+
7085
- section:
7186
manufactured_solution: ManufacturedSolution
7287
options:

polaris/tasks/ocean/barotropic_gyre/forward.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ def __init__(
8888
self.add_yaml_file('polaris.ocean.config', 'output.yaml')
8989

9090
self.add_input_file(filename='init.nc', target='../init/init.nc')
91-
self.add_input_file(filename='forcing.nc', target='../init/forcing.nc')
9291

9392
self.add_output_file(
9493
filename='output.nc',
@@ -150,6 +149,7 @@ def dynamic_model_config(self, at_setup):
150149

151150
if self.run_time_steps is not None:
152151
output_frequency_units = 'seconds'
152+
output_frequency = '12'
153153
run_duration = ceil(self.run_time_steps * dt)
154154
stop_time_str = time.strftime(
155155
'0001-01-01_%H:%M:%S', time.gmtime(run_duration)
@@ -170,9 +170,11 @@ def dynamic_model_config(self, at_setup):
170170
if time_integrator in time_integrator_map.keys():
171171
time_integrator = time_integrator_map[time_integrator]
172172
else:
173-
print('Warning: mapping from time integrator '
174-
f'{time_integrator} to omega not found, '
175-
'retaining name given in config')
173+
print(
174+
'Warning: mapping from time integrator '
175+
f'{time_integrator} to omega not found, '
176+
'retaining name given in config'
177+
)
176178

177179
replacements = dict(
178180
dt=dt_str,

polaris/tasks/ocean/barotropic_gyre/forward.yaml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,21 @@ ocean:
1212
config_mom_del2: {{ nu }}
1313
hmix_del4:
1414
config_use_mom_del4: false
15+
forcing:
16+
config_use_bulk_wind_stress: true
17+
bottom_drag:
18+
config_explicit_bottom_drag_coeff: 0.001
19+
debug:
20+
config_disable_vel_explicit_bottom_drag: false
1521

1622
mpas-ocean:
1723
run_modes:
1824
config_ocean_run_mode: forward
1925
decomposition:
2026
config_block_decomp_file_prefix: graph.info.part.
2127
bottom_drag:
28+
config_bottom_drag_mode: explicit
2229
config_implicit_constant_bottom_drag_coeff: 0.
23-
forcing:
24-
config_use_bulk_wind_stress: true
2530
debug:
2631
config_disable_vel_hadv: true
2732
config_disable_vel_hmix: false
@@ -33,7 +38,7 @@ mpas-ocean:
3338
input:
3439
filename_template: init.nc
3540
forcing:
36-
filename_template: forcing.nc
41+
filename_template: init.nc
3742
input_interval: initial_only
3843
type: input
3944
contents:
@@ -62,19 +67,27 @@ Omega:
6267
NVertLevels: 1
6368
IOStreams:
6469
InitialState:
70+
UsePointerFile: false
6571
Filename: init.nc
72+
Mode: read
73+
Precision: double
74+
Freq: 1
75+
FreqUnits: OnStartup
76+
UseStartEnd: false
6677
Contents:
67-
- LayerThickness
68-
- NormalVelocity
78+
- State
79+
- WindStressZonal
80+
- WindStressMeridional
6981
History:
82+
UsePointerFile: false
7083
Filename: output.nc
7184
Freq: {{ output_frequency }}
7285
FreqUnits: {{ output_frequency_units }}
73-
IfExists: append
86+
IfExists: replace
7487
# effectively never
7588
FileFreq: 9999
7689
FileFreqUnits: years
90+
UseStartEnd: false
7791
Contents:
78-
- LayerThickness
79-
- NormalVelocity
80-
- SshCellDefault
92+
- State
93+
- SshCell

polaris/tasks/ocean/barotropic_gyre/init.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def __init__(self, component, subdir):
3737
'base_mesh.nc',
3838
'culled_mesh.nc',
3939
'culled_graph.info',
40-
'forcing.nc',
4140
]:
4241
self.add_output_file(file)
4342
self.add_output_file('init.nc', validate_vars=['layerThickness'])
@@ -135,30 +134,27 @@ def run(self):
135134
normal_velocity = normal_velocity.expand_dims(dim='Time', axis=0)
136135
ds['normalVelocity'] = normal_velocity
137136

138-
# write the initial condition file
139-
write_netcdf(ds, 'init.nc')
140-
141137
# set the wind stress forcing
142-
ds_forcing = xr.Dataset()
143138
# Convert from km to m
144139
ly = ly * 1e3
145140
wind_stress_zonal = -tau_0 * np.cos(
146141
np.pi * (ds.yCell - ds.yCell.min()) / ly
147142
)
148143
wind_stress_meridional = xr.zeros_like(ds.xCell)
149-
ds_forcing['windStressZonal'] = wind_stress_zonal.expand_dims(
144+
ds['windStressZonal'] = wind_stress_zonal.expand_dims(
150145
dim='Time', axis=0
151146
)
152-
ds_forcing['windStressMeridional'] = (
153-
wind_stress_meridional.expand_dims(dim='Time', axis=0)
147+
ds['windStressMeridional'] = wind_stress_meridional.expand_dims(
148+
dim='Time', axis=0
154149
)
155-
write_netcdf(ds_forcing, 'forcing.nc')
150+
# write the initial condition file
151+
write_netcdf(ds, 'init.nc')
156152

157153
cell_mask = ds.maxLevelCell >= 1
158154

159155
plot_horiz_field(
160156
ds_mesh,
161-
ds_forcing['windStressZonal'],
157+
ds['windStressZonal'],
162158
'forcing_wind_stress_zonal.png',
163159
cmap='cmo.balance',
164160
show_patch_edges=True,

0 commit comments

Comments
 (0)