Skip to content

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

Merged
kuanchihwang merged 10 commits into
ESCOMP:developmentfrom
kuanchihwang-ncar:staging/mpas-dycore-input-alias
Sep 24, 2026
Merged

kuanchihwang merged 10 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
SMS_Ln9.ne3pg3_ne3pg3_mg37.F2000_C7.derecho_gnu.cam-outfrq_se_cslam_analy_ic (Overall: FAIL) details:
  FAIL SMS_Ln9.ne3pg3_ne3pg3_mg37.F2000_C7.derecho_gnu.cam-outfrq_se_cslam_analy_ic RUN

Known failing test.

  • derecho/aux_sima_intel
SMS_Ln9.ne3pg3_ne3pg3_mg37.F2000_C7.derecho_intel.cam-outfrq_se_cslam_analy_ic (Overall: FAIL) details:
  FAIL SMS_Ln9.ne3pg3_ne3pg3_mg37.F2000_C7.derecho_intel.cam-outfrq_se_cslam_analy_ic RUN
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 tests.

  • 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.

@nusbaume
nusbaume requested a review from peverwhee August 31, 2026 16:53

@peverwhee peverwhee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one hopefully easy question!

Comment thread src/data/registry.xml
@kuanchihwang
kuanchihwang deployed to CI-tests-on-CIRRUS September 16, 2026 20:12 — with GitHub Actions Active

@nusbaume nusbaume left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kuanchihwang!

@kuanchihwang
kuanchihwang deployed to CI-tests-on-CIRRUS September 23, 2026 00:19 — with GitHub Actions Active
@kuanchihwang
kuanchihwang merged commit fcd5d7b into ESCOMP:development Sep 24, 2026
30 checks passed
@kuanchihwang
kuanchihwang deleted the staging/mpas-dycore-input-alias branch September 24, 2026 22:25

This branch was successfully deployed

1 active deployment
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.

4 participants