Skip to content

Add support for reading constituents through input names in MPAS dynamical core - #543

Open
kuanchihwang wants to merge 6 commits into
ESCOMP:developmentfrom
kuanchihwang-ncar:staging/mpas-dycore-input-alias
Open

Add support for reading constituents through input names in MPAS dynamical core#543
kuanchihwang wants to merge 6 commits into
ESCOMP:developmentfrom
kuanchihwang-ncar:staging/mpas-dycore-input-alias

Conversation

@kuanchihwang

@kuanchihwang kuanchihwang commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Tag name

None (Bit-for-bit)

Originator(s)

kuanchihwang

Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number)

Currently, MPAS dynamical core in CAM-SIMA only attempts to read constituents through the standard names. This PR adds support for also attempting the input names defined in the CAM-SIMA registry. Following the design principles of MPAS dynamical core, CAM-SIMA does not directly participate in the reading of constituents. Instead, MPAS dynamical core handles the actual I/O with its internal infrastructure.

Additionally, the dyn_mpas_define_scalar subroutine in the MPAS subdriver has been refactored to improve readability and reduce cyclomatic complexity. Pointer safety has been enhanced in the MPAS subdriver.

Describe any changes made to the build system

None

Describe any changes made to the namelist

None

List any changes to the defaults for the input datasets (e.g., initial, boundary datasets)

None

List all files eliminated and why

None

List all files added and what they do

None

List all existing files that have been modified, and describe the changes

M       src/data/registry.xml
  * Add "qv" to candidate input names for water vapor mixing ratio
M       src/dynamics/mpas/driver/dyn_mpas_subdriver.F90
  * Use more idiomatic syntax for reordering MPAS scalars
  * Simplify algorithm for determining MPAS scalar indexes
  * Add support for reading constituents through input aliases in MPAS subdriver
  * Enhance pointer safety in MPAS subdriver
M       src/dynamics/mpas/dyn_comp_impl.F90
  * Update CAM-SIMA to adopt new `define_scalar` API from MPAS subdriver

Regression tests

  • derecho/aux_sima_gnu

Pass.

  • derecho/aux_sima_intel
  SMS_Ln9.ne3pg3_ne3pg3_mg37.FKESSLER.derecho_intel.cam-outfrq_se_cslam_multitape (Overall: NLFAIL) details:
    FAIL SMS_Ln9.ne3pg3_ne3pg3_mg37.FKESSLER.derecho_intel.cam-outfrq_se_cslam_multitape NLCOMP

Known failing test.

  • derecho/aux_sima_nvhpc

Pass.

…bdriver

Also refactor the `dyn_mpas_define_scalar` subroutine because it is
getting too big and too complex to follow.
The `dyn_mpas_get_pool_pointer` subroutine comes with built-in error
checking. Make use of it more.
By convention, the variable name for water vapor mixing ratio is "Q" in CAM. However,
the MPAS dynamical core in CAM strays from this convention and uses "qv" instead.

As a result, all MPAS IC files in CESM input data are plagued with the unconventional
variable name.

Add "qv" to the candidate input names for water vapor mixing ratio until we can replace
those MPAS IC files.
@kuanchihwang
kuanchihwang temporarily deployed to CI-tests-on-CIRRUS August 20, 2026 19:17 — with GitHub Actions Inactive
@kuanchihwang
kuanchihwang marked this pull request as ready for review August 20, 2026 19:30
@kuanchihwang

kuanchihwang commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

@mgduda

You might be interested in some parts of this PR because it adds a new feature for CAM-SIMA that depends heavily on the internals of MPAS. Thanks for your time in advance!

Specifically, commit b086d37 dynamically constructs a new field called scalars_alias at run-time, with all of its derived type components pointing to those in the scalars field except for constituentnames. The scalars field has the standard names of constituents in its constituentnames character array, while the scalars_alias field has the input aliases of constituents in its constituentnames character array.

The idea is to let the MPAS I/O stream facilities (e.g., mpas_streamaddfield, mpas_readstream) handle the input aliases natively. When these facilities encounter the scalars_alias field, the resulting data array is actually reflected to the scalars field, which is then used by other parts of MPAS transparently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants