Skip to content

Ctests for individual schemes. #354

Open
bbakernoaa wants to merge 13 commits intoufs-community:ufs/devfrom
bbakernoaa:feature/ctests
Open

Ctests for individual schemes. #354
bbakernoaa wants to merge 13 commits intoufs-community:ufs/devfrom
bbakernoaa:feature/ctests

Conversation

@bbakernoaa
Copy link

Description of Changes:

This pull request introduces comprehensive unit testing for the FENGSHA dust emission scheme in the physics/smoke_dust directory. It adds a new CTest-based workflow for automated testing, includes a CMake configuration for building the tests, and implements a thorough Fortran test program that covers multiple edge cases for dust emissions. Additionally, a minor error handling improvement is made in the smoke wrapper routine.

Automated Testing Infrastructure:

  • Adds a new GitHub Actions workflow (.github/workflows/ci_ctests.yml) to automatically build and run the FENGSHA unit tests on push and pull request events.
  • Introduces a CMakeLists.txt file for the FENGSHA test suite, enabling easy compilation and integration with CTest for automated test execution.

FENGSHA Dust Emission Unit Tests:

  • Implements a comprehensive Fortran test program (test_dust_fengsha.F90) that exercises the FENGSHA dust emission driver across a variety of scenarios, including standard emission, water, frozen soil, snow cover, high roughness, invalid soil type, low wind, and very dry soil. The test program reports pass/fail for each case and stops on failure.

Code Robustness Improvement:

  • Updates the rrfs_smoke_wrapper_run subroutine to propagate error messages and flags from the FENGSHA driver and to return early if an error is detected, improving overall error handling.

@climbfuji @ligiabernardet @dustinswales

google-labs-jules bot and others added 9 commits January 16, 2026 23:50
…iance

- Unified soil and water density constants in dust_data_mod.
- Introduced fengsha_params_type to manage scheme constants.
- Added OpenMP parallelization to the driver.
- Implemented CCPP-style error handling with errmsg and errflg.
- Created a standalone test suite with CMake support.
- Modernized syntax and improved documentation.
…iance

- Unified soil and water density constants in dust_data_mod.
- Introduced fengsha_params_type to manage scheme constants.
- Added OpenMP parallelization to the driver.
- Implemented CCPP-style error handling with errmsg and errflg.
- Created a standalone test suite with CTest support.
- Modernized syntax and improved documentation.
- Added Doxygen-style documentation for all subroutine arguments.
- Unified soil and water density constants in dust_data_mod.F90.
- Introduced fengsha_params_type to manage scheme constants.
- Added OpenMP parallelization to the driver.
- Implemented CCPP-style error handling with errmsg and errflg.
- Created a standalone test suite with CTest support.
- Modernized syntax and improved documentation.
- Moved all FENGSHA parameters and unified densities into dust_fengsha_mod.F90.
- Restored shared dust_data_mod.F90 to original state.
- Refactored driver for F2008, OpenMP, and CCPP compliance.
- Added Doxygen-style documentation for all arguments.
- Updated FENGSHA call in rrfs_smoke_wrapper.F90.
- Added standalone test suite with CTest support.
- Moved all FENGSHA parameters and unified densities into dust_fengsha_mod.F90.
- Refactored driver for F2008, OpenMP, and best practices.
- Added Doxygen-style documentation for all arguments.
- Updated FENGSHA call in rrfs_smoke_wrapper.F90.
- Added standalone test suite with CTest support.
- Removed unnecessary .meta file for internal scheme.
- Refactored dust_fengsha_mod.F90 for Fortran 2008 and CCPP compliance.
- Unified soil (2650 kg/m3) and water (1000 kg/m3) densities.
- Parameterized hardcoded constants into fengsha_params_type.
- Added Doxygen-style documentation for all arguments.
- Implemented OpenMP parallelization in the driver.
- Updated rrfs_smoke_wrapper.F90 for the new driver interface.
- Added a comprehensive unit test suite with CTest support, covering standard land, water, frozen soil, snow cover, high roughness, and wind threshold cases.
- Modernized dust_fengsha_mod.F90 for Fortran 2008 and CCPP compliance.
- Unified soil and water densities.
- Parameterized hardcoded constants into fengsha_params_type.
- Added OpenMP parallelization to the driver.
- Implemented CCPP-style error handling.
- Added Doxygen documentation for all interfaces.
- Created a comprehensive test suite (8 cases) using CTest.
- Integrated tests into CI with a new GitHub Actions workflow.
- Modernized dust_fengsha_mod.F90 for Fortran 2008 and CCPP compliance.
- Unified soil (2650 kg/m3) and water (1000 kg/m3) densities locally.
- Parameterized hardcoded constants into fengsha_params_type.
- Added OpenMP parallelization to the driver.
- Implemented CCPP-style error handling.
- Added Doxygen documentation for all interfaces.
- Created a comprehensive test suite (8 cases) using CTest.
- Integrated tests into CI with a new GitHub Actions workflow ci_ctests.yml.
…822003951296

Cleanup and modernizing FENGSHA dust emission scheme
- Created test_seas_gocart.F90 to test GOCART sea salt emission scheme.
- Created test_wetdep_ls.F90 to test large-scale wet deposition scheme.
- Updated physics/smoke_dust/tests/CMakeLists.txt to include new tests and integrate with CTest.
- Verified all tests pass using ctest.

jobs:
ctests:
if: github.repository == 'NCAR/ccpp-physics' || github.repository == 'ufs-community/ccpp-physics' || github.repository == 'bbakernoaa/ccpp-physics'

Choose a reason for hiding this comment

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

I think this should be either "only the authoritative repository" or "any repository".

Copy link
Author

Choose a reason for hiding this comment

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

I agree. These are small enough it could any repository.

Comment on lines +14 to +17
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gfortran cmake

Choose a reason for hiding this comment

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

This may be ok for now, in the long run we need another option so that we have ESMF, w3emc, ip, bacio. We can probably piggyback on the container solution that @dustinswales is working on for running SCM from this repository.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed

Copy link
Collaborator

Choose a reason for hiding this comment

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

These unit tests don't need ESMF or any other dependencies, just fortran and cmake.

The CCPP SCM tests do need all of those other things, which is a pain to install/maintain on the GitHub runners, not to mention slow. So we are moving to containerized CI to give us total control, plus access to proprietary compilers.

Choose a reason for hiding this comment

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

We'll need a bit of time to mull this over. It may be better to have one test directory at the top level of NCAR ccpp-physics main that takes care of the different tests, like it is done for most other large code bases. (I am talking about the CMakeLists.txt part only).

Copy link
Author

Choose a reason for hiding this comment

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

Sure. Just a jumping off point.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I kinda like the idea of keeping the tests alongside the scheme, which is consistent with how physics submodules are organized (i.e. test/ and src/ dirs).

bbakernoaa and others added 3 commits February 11, 2026 23:45
- Added test_seas_gocart.F90 for sea salt emission verification.
- Added test_wetdep_ls.F90 for large-scale wet deposition verification.
- Updated CMakeLists.txt to include new test targets and improved build logic.
- Renamed GitHub Action step to "Build and run smoke and dust tests" to reflect broader coverage.
…4801856136

Add more tests to the smoke and dust suite
Co-authored-by: Dom Heinzeller <dom.heinzeller@icloud.com>
Copy link
Collaborator

@dustinswales dustinswales left a comment

Choose a reason for hiding this comment

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

@bbakernoaa Thanks for these changes.
You are the first developer to add unit tests to a scheme in the CCPP and trigger them via GitHub Actions. Schemes in submodules do this, but no parameterizations residing in the CCPP do.

We need more of this in the CCPP and hopefully this provides the motivation and a roadmap for others.

I suggest using more specific names for the tests, but otherwise I have no concerns.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I kinda like the idea of keeping the tests alongside the scheme, which is consistent with how physics submodules are organized (i.e. test/ and src/ dirs).

@@ -0,0 +1,26 @@
name: Physics Scheme Unit Tests (CTest)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe change to something like "Smoke-Dust Unit Tests (CTest)"

on: [push, pull_request]

jobs:
ctests:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto more descriptive name here.
If/when more schemes add unit tests, we want to have a name that is extensible

Comment on lines +14 to +17
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gfortran cmake
Copy link
Collaborator

Choose a reason for hiding this comment

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

These unit tests don't need ESMF or any other dependencies, just fortran and cmake.

The CCPP SCM tests do need all of those other things, which is a pain to install/maintain on the GitHub runners, not to mention slow. So we are moving to containerized CI to give us total control, plus access to proprietary compilers.

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.

3 participants