payu-org / payu

A workflow management tool for numerical models on the NCI computing systems
Apache License 2.0
18 stars 25 forks source link

Read MOM6 parameter filenames from experiment #325

Closed angus-g closed 9 months ago

angus-g commented 2 years ago

At the moment, the list of parameter filenames for MOM6/SIS2 is hardcoded: https://github.com/payu-org/payu/blob/3f00d4b72390053ab9182e340c582fbd0a67683f/payu/models/mom6.py#L39-L55

For the non-FMS components of these models, the filenames are actually specified in the input.nml, under the parameter_filename entry of the MOM_input_nml and SIS_input_nml namelists:

        output_directory = '.',
        input_filename = 'n',
        restart_input_dir = 'INPUT',
        restart_output_dir = 'RESTART',
        parameter_filename = 'MOM_input'
/

&SIS_input_nml
        output_directory = '.',
        input_filename = 'n',
        restart_input_dir = 'INPUT',
        restart_output_dir = 'RESTART',
        parameter_filename = 'SIS_input'
/
aidanheerdegen commented 2 years ago

An example from MOM6 0.25 global config with a few more names:

 &MOM_input_nml
         output_directory = '.',
         input_filename = 'n'
         restart_input_dir = 'INPUT',
         restart_output_dir = 'RESTART',
         parameter_filename = 'MOM_input',
                              'MOM_layout',
                              'MOM_saltrestore',
                              'MOM_override'
/

 &SIS_input_nml
        output_directory = './',
        input_filename = 'n'
        restart_input_dir = 'INPUT/',
        restart_output_dir = 'RESTART/',
        parameter_filename = 'SIS_input',
                             'SIS_layout',
                             'SIS_override' /

It might be tricky initialising the allowable config files dynamically, as this is set in __init__() and config files are generally parsed in setup().

Could be worth checking at setup() that all the files listed in parameter_filename exist in set(self.config_files, self.optional_config_files) and emitting a warning/error if not. Presumably the model will crash in this instance though, as the config file will be missing from the work directory, but better to give a nice informative error maybe.