E3SM-Project / polaris

Testing and analysis for OMEGA, MPAS-Ocean, MALI and MPAS-Seaice
BSD 3-Clause "New" or "Revised" License
6 stars 13 forks source link

Add support for model config described by yaml files #23

Closed xylar closed 1 year ago

xylar commented 1 year ago

Reorganizes the ModelStep class in several ways:

This merge adds a yaml module with a PolarisYaml class and several utility functions for converting to and from namelists and streams file.

Note: translation from yaml to streams files requires access to the processed registry file because the yaml spec doesn't include the type of the entries in a stream (stream, var_struct, var_array or var), which are needed to generate an MPAS streams file. A new registry section with a processed option has been added to locate this file.

An OceanModelStep is added that handles special requirements for ocean steps (e.g. writing a yaml file for Omega but namelists/streams for MPAS-ocean).

I have updated the ocean component and cosine bell test case to make use of this new functionality.

For convenience of translating from compass to polaris, I added an mpas_to_yaml entry point that can be used to convert a namelist and/or streams file into a yaml file. You need to point to a namelist template (e.g. namelist.ocean.forward) because the compass namelist files don't include the namelist sections, required by the yaml format. Note that the model should simply be ocean to indicate a yaml file that can be used by both omega and mpas-ocean.

Checklist

xylar commented 1 year ago

I have not yet updated the documentation (as indicated in the checklist).

xylar commented 1 year ago

Testing

I ran the cosine bell test suite on Chrysalis with Intel and OpenMPI:

/lcrc/group/e3sm/ac.xylar/polaris_0.1/chrysalis/test_20230304/cosine_bell_yaml

Results are bit-for-bit with the current main.

xylar commented 1 year ago

@cbegeman, I believe this is ready for your review. I'm pretty pleased with the results.

xylar commented 1 year ago

@cbegeman, thanks for the excellent suggestions. I have incorporated them all. I want to retest to make sure the cosine bell suite isn't broken by my latest changes. Then, I'll merge.