Skip to content

Commit b548c38

Browse files
committed
Use config option to determine whether to add coeffs_reconstruct to the stream
1 parent 05586c3 commit b548c38

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
mpas-ocean:
2+
streams:
3+
coeffs_reconstruct:
4+
type: output
5+
filename_template: coeffs_reconstruct.nc
6+
output_interval: 0000_00:00:01
7+
clobber_mode: truncate
8+
contents:
9+
- coeffs_reconstruct

polaris/ocean/model/ocean_model_step.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,22 @@ def dynamic_model_config(self, at_setup: bool) -> None:
213213
super().dynamic_model_config(at_setup)
214214
if self.update_eos:
215215
self.update_namelist_eos()
216+
if self.config.has_option('ocean', 'write_coeffs_reconstruct'):
217+
self.write_coeffs_reconstruct = self.config.get(
218+
'ocean', 'write_coeffs_reconstruct'
219+
)
220+
else:
221+
self.write_coeffs_reconstruct = False
222+
if self.write_coeffs_reconstruct:
223+
model = self.config.get('ocean', 'model')
224+
if not model == 'mpas-ocean':
225+
raise ValueError(
226+
'Coefficients for vector reconstruction can only be '
227+
'written for ocean model MPAS-Ocean'
228+
)
229+
self.add_yaml_file(
230+
'polaris.ocean.config', 'coeffs_reconstruct.yaml'
231+
)
216232

217233
def constrain_resources(self, available_cores: Dict[str, Any]) -> None:
218234
"""

polaris/ocean/mpas_ocean.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# This config file has default config options for MPAS-Ocean
22

3+
[ocean]
4+
5+
# Whether to write coeffs for reconstructing vector quantities during
6+
# the forward run
7+
write_coeffs_reconstruct = False
8+
39
# The paths section points polaris to external paths
410
[paths]
511

0 commit comments

Comments
 (0)