Skip to content

Conversation

kuanchihwang
Copy link
Collaborator

@kuanchihwang kuanchihwang commented Sep 18, 2025

Tag name (required for release branches):

None

Originator(s):

kuanchihwang

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

This PR introduces continuous integration (CI) workflows and implements unit tests for MPAS dynamical core. Additionally, pFUnit files (*.pf) are now correctly rendered as Fortran source code on GitHub.

Beyond verifying correctness and robustness, the unit tests also report the numerical accuracy of each computational procedure in terms of units in the last place (ULP) away from the exact answers. For example, below is the output for equation of state:

2:  Start: <test_dyn_procedures_suite.test_equation_of_state_family_by_typical_values>
2: .
2: Error statistics (N = 31512303):
2:  63.81% of sample values (20107401) have accuracy of 0 <= ULP < 1.
2:  34.31% of sample values (10810918) have accuracy of 1 <= ULP < 2.
2:   1.88% of sample values (593637) have accuracy of 2 <= ULP < 3.
2:   0.00% of sample values (347) have accuracy of 3 <= ULP < 4.
2:    end: <test_dyn_procedures_suite.test_equation_of_state_family_by_typical_values>

Whenever changes are made in the path of MPAS dynamical core (src/dynamics/mpas/*), the CI workflows automatically build and run the unit tests with various versions of GCC. Test results are collected as artifacts and retained for 7 days for reference.

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., boundary datasets):

None

List all files eliminated and why:

None

List all files added and what they do:

A       .gitattributes
  * Make GitHub Linguist recognize `*.pf` files as Fortran source code
A       .github/workflows/mpas_dynamical_core_ci.yml
  * Add CI workflow for MPAS dynamical core
A       src/dynamics/mpas/CMakeLists.txt
A       src/dynamics/mpas/tests/unit/CMakeLists.txt
A       src/dynamics/mpas/tests/unit/test_dyn_mpas_procedures.pf
A       src/dynamics/mpas/tests/unit/test_dyn_procedures.pf
  * Implement unit tests for MPAS dynamical core

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

M       src/dynamics/mpas/driver/dyn_mpas_procedures.F90
  * Add support for comparing NaN and Inf with `almost_equal`
M       src/dynamics/mpas/dyn_comp_impl.F90
  * Use `almost_equal` for checking topography data
  * Use `qv_of_sh` for converting specific humidity to water vapor mixing ratio
M       src/dynamics/mpas/dyn_coupling_impl.F90
  * Use `exner_function` for improved readability in dynamics-physics coupling
  * Sort `use` statements
M       src/dynamics/mpas/dyn_procedures.F90
  * New interface for `exner_function`
  * Explicitly specify integers to be `int32` in `sec_to_hour_min_sec`

Regression tests:

No changes to any existing tests. All tests pass with respect to the last baseline, sima0_07_000.

@kuanchihwang kuanchihwang marked this pull request as ready for review September 18, 2025 22:56
@kuanchihwang
Copy link
Collaborator Author

To reviewers, if you are interested in the CI workflow logs, look for "MPAS Dynamical Core CI" in the "Checks" tab of this PR.

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.

1 participant