Prefix all namelist group and option names for MPAS dycore #1285
+91
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When MPAS is used as a dynamical core in a host model (e.g., CAM/CAM-SIMA), it needs to share the namelist file with other model components. Therefore, MPAS namelist groups and options may not be easily recognizable at first sight. The solution, which is implemented by this PR, is to add a unique identifier to all MPAS namelist group and option names.
The following transformations are performed for each MPAS namelist group and option name:
config_
is removed recursively from the name. Case-insensitive.mpas_
is removed recursively from the name. Case-insensitive.mpas_
to the name.As a result, it is now easier to distinguish MPAS namelist groups and options from CAM-SIMA ones. Additionally, the possibility of name collisions with CAM-SIMA ones is also resolved once and for all. Note that only namelist I/O is affected. Internally, MPAS still refers to its namelist options by their original names due to compatibility reasons.
Compared to the implementation in CAM, this PR applies the "name mangling" logic in an algorithmic and predictable way. It works automatically even if there are additions, modifications, or deletions to MPAS namelist groups and options.
The "name mangling" logic is entirely guarded behind the
MPAS_CAM_DYCORE
macro. For stand-alone MPAS, there is no functional change, which can be confirmed by theparse
utility staying bitwise identical. For CAM, it is not affected by this PR because it does not use the code generation functionality of MPAS for namelist reading. For CAM-SIMA, the Fortran include files generated by theparse
utility stay the same. Its regression tests all pass, indicating identical model results to the previous baseline.