diff --git a/polaris/ocean/config/coeffs_reconstruct.yaml b/polaris/ocean/config/coeffs_reconstruct.yaml new file mode 100644 index 0000000000..947508c07d --- /dev/null +++ b/polaris/ocean/config/coeffs_reconstruct.yaml @@ -0,0 +1,9 @@ +mpas-ocean: + streams: + coeffs_reconstruct: + type: output + filename_template: coeffs_reconstruct.nc + output_interval: 0000_00:00:01 + clobber_mode: truncate + contents: + - coeffs_reconstruct diff --git a/polaris/ocean/model/ocean_model_step.py b/polaris/ocean/model/ocean_model_step.py index 46e2bea1a9..abefbf4b67 100644 --- a/polaris/ocean/model/ocean_model_step.py +++ b/polaris/ocean/model/ocean_model_step.py @@ -213,6 +213,22 @@ def dynamic_model_config(self, at_setup: bool) -> None: super().dynamic_model_config(at_setup) if self.update_eos: self.update_namelist_eos() + if self.config.has_option('ocean', 'write_coeffs_reconstruct'): + self.write_coeffs_reconstruct = self.config.get( + 'ocean', 'write_coeffs_reconstruct' + ) + else: + self.write_coeffs_reconstruct = False + if self.write_coeffs_reconstruct: + model = self.config.get('ocean', 'model') + if not model == 'mpas-ocean': + raise ValueError( + 'Coefficients for vector reconstruction can only be ' + 'written for ocean model MPAS-Ocean' + ) + self.add_yaml_file( + 'polaris.ocean.config', 'coeffs_reconstruct.yaml' + ) def constrain_resources(self, available_cores: Dict[str, Any]) -> None: """ diff --git a/polaris/ocean/mpas_ocean.cfg b/polaris/ocean/mpas_ocean.cfg index a49258494b..86df8f5ef9 100644 --- a/polaris/ocean/mpas_ocean.cfg +++ b/polaris/ocean/mpas_ocean.cfg @@ -1,5 +1,11 @@ # This config file has default config options for MPAS-Ocean +[ocean] + +# Whether to write coeffs for reconstructing vector quantities during +# the forward run +write_coeffs_reconstruct = True + # The paths section points polaris to external paths [paths]