Skip to content

Reapply "feat(ccpp): Add CCPP interface with emissions driver schemes"#6

Open
bbakernoaa wants to merge 12 commits into
mainfrom
feature/ccpp_fixed
Open

Reapply "feat(ccpp): Add CCPP interface with emissions driver schemes"#6
bbakernoaa wants to merge 12 commits into
mainfrom
feature/ccpp_fixed

Conversation

@bbakernoaa
Copy link
Copy Markdown
Collaborator

This pull request adds support for optional CCPP and NUOPC/ESMF interfaces in CECE, making their inclusion configurable at build time. It introduces the CCPP driver API, updates the build system to conditionally include interface-specific sources and dependencies, and provides comprehensive documentation for CCPP host model integration. The most important changes are grouped below.

Build System: Interface Option Integration and Conditional Compilation

  • Added CECE_ENABLE_CCPP and CECE_ENABLE_NUOPC CMake options to control building of CCPP and NUOPC/ESMF interfaces. The NUOPC interface is enabled by default, CCPP is off by default.
  • All ESMF/NUOPC dependencies, source files, and test helpers are now only included when CECE_ENABLE_NUOPC is ON. The build outputs a status message when the interface is disabled. [1] [2] [3] [4] [5] [6] [7]
  • CCPP driver sources (src/ccpp/cece_ccpp_*.F90 and src/ccpp/cece_ccpp_api.cpp) and related property-based tests are only built when CECE_ENABLE_CCPP is ON. [1] [2] [3]

API and Source Code: CCPP Driver Interface

  • Introduced the C-linkage CCPP driver API in include/cece/cece_ccpp_api.h, providing initialization, per-scheme execution/finalization, and field marshalling routines for Fortran driver schemes.
  • Updated the main CECE source list to include or exclude interface-specific files based on the chosen options, ensuring a clean separation of core and interface code. [1] [2] [3]

Documentation: CCPP Host Model Integration

  • Added docs/ccpp_host_metadata.md, a comprehensive reference for host model developers integrating CECE via CCPP. This includes required import/export variables, standard name mappings, dimension conventions, and scheme-specific requirements.

These changes make CECE more modular and easier to integrate with different host models and coupler frameworks, while providing clear documentation and a robust API for CCPP-based coupling.

- Update .clang-format ColumnLimit from 100 to 150 characters
- Reformat all header files to comply with new line length standard
- Reformat all source files across core, physics, I/O, and test modules
- Reformat CCPP API declarations and implementations
- Reformat Python bindings and benchmark code
- Improve code readability while maintaining Google style guidelines
@bbakernoaa bbakernoaa added the enhancement New feature or request label Apr 14, 2026
- Consolidate multi-line macro definitions in shr_assert.h to single lines
- Reformat long std::cerr and std::cout statements in tide_yaml_c.cpp to fit within line limit
- Combine split conditional assignments and ternary operators onto single lines
- Improve code readability while maintaining consistency with project formatting standards
- Replace complex version fallback logic with direct pip installation of clang-format==22.1.2
- Ensure consistent clang-format version across CI and local development environments
- Simplify LLVM repository setup by removing version detection loop
- Update comment to reflect new installation method
- Add blank line for code formatting consistency in cece_config_parser.cpp
- Remove LLVM repository setup and apt-based clang-format installation
- Replace with pipx for consistent pinned version (22.1.2) across CI and local dev
- Remove clang-tidy installation as it's no longer needed
- Add PATH export to ensure pipx-installed clang-format is accessible in workflow
- Streamline installation process by eliminating repository configuration steps
@bbakernoaa bbakernoaa added Physics When adding or modifying a physics parameterization please use this. Interface When modifying or adding a new interface use this. CCPP CCPP physics interface labels Apr 21, 2026
Resolved conflicts in:
- .github/workflows/lint.yml: Use setup-python from main (pre-commit handles linting)
- CMakeLists.txt: Merged CCPP/NUOPC conditional build logic with new dust scheme Fortran files (fengsha, ginoux, k14)
- src/cece_config_parser.cpp: Trivial whitespace difference
- Add GitHub Actions workflow for validating CCPP scheme metadata and suite definitions
- Refactor CCPP scheme modules to import C API interfaces from shared state module
- Remove duplicate C API interface declarations from all scheme modules (dms, dust, example, lightning, megan, sea_salt, soil_nox, stacking, volcano)
- Consolidate C API bindings in cece_ccpp_state module to reduce code duplication
- Update all scheme modules to use centralized imports from state module
- Improve maintainability by centralizing interface definitions for CCPP framework integrationre
- Remove loop that iterates through suite groups and prints scheme details
- Simplify validation workflow to only confirm successful suite parsing
- Reduce output verbosity while maintaining essential validation feedback
@bbakernoaa
Copy link
Copy Markdown
Collaborator Author

@grantfirl

@ligiabernardet suggested that I ping you here to get some feedback.

- Add `frozen_soil_threshold` parameter (default 273.15 K) to Fengsha, Ginoux, and K14 schemes
- Add optional `soil_temperature` import field to all three schemes for frozen ground detection
- Skip dust emissions in cells where soil temperature is below threshold
- Update documentation for all three schemes with new parameter and field descriptions
- Add CCPP Fortran interface modules for Fengsha, Ginoux, and K14 with metadata files
- Implement frozen soil checks in algorithm descriptions and initialization logic
- Enable soil temperature-based emission suppression across all dust emission kernels
…pport

- Add soil_temperature field input to Fengsha, Ginoux, and K14 dust emission schemes
- Add frozen_soil_threshold parameter to all three dust emission kernels
- Update C++ Fortran bridge declarations to include new soil temperature pointer and frozen soil threshold parameters
- Implement optional soil temperature field resolution with Kokkos synchronization in bridge layers
- Update Fortran kernel signatures and implementations to accept and utilize frozen soil threshold in dust emission calculations
- Enable soil freezing conditions to be considered in dust emission parameterizations across all schemes
@dustinswales
Copy link
Copy Markdown

@bbakernoaa Unfortunately, I can't provide a meaningful review for this. I'm not familiar with the CECE system and don't really know where to begin without devoting a large chunk of time, and it's a huge PR.

I want to understand CECE and it's interface to the CCPP. Do you have an example where CECE is hooked up to a host model and is using these CCPP interfaces?

@bbakernoaa
Copy link
Copy Markdown
Collaborator Author

@bbakernoaa Unfortunately, I can't provide a meaningful review for this. I'm not familiar with the CECE system and don't really know where to begin without devoting a large chunk of time, and it's a huge PR.

I want to understand CECE and it's interface to the CCPP. Do you have an example where CECE is hooked up to a host model and is using these CCPP interfaces?

Thanks @dustinswales! I completely understand. I’m working on a simple use case that I could possible use the SCM in a CI with this. Something like add a tracer and see it move with the emission

bbakernoaa and others added 2 commits April 27, 2026 10:52
* Add CI workflow for CCPP interface using CCPP SCM

Introduces a new CI workflow that integrates CECE physics schemes into
the CCPP SCM host model.

Key changes:
- Added `.github/workflows/ccpp_scm_integration.yml` to automate testing
  of the CCPP interface.
- Created `scripts/integrate_cece_scm.py` to programmatically patch
  the SCM with CECE metadata, schemes, and build configuration.
- Added `src/ccpp/suites/suite_SCM_GFS_v16_CECE.xml` which integrates
  CECE emissions into a standard SCM suite.
- The CI verifies metadata consistency, cap generation, and infrastructure
  readiness by running the CCPP prebuild and attempting a build/run
  cycle within the SCM ecosystem.

* Add CI workflow for CCPP interface using CCPP SCM

Introduces a new CI workflow that integrates CECE physics schemes into
the CCPP SCM host model.

Key changes:
- Added `.github/workflows/ccpp_scm_integration.yml` to automate testing
  of the CCPP interface.
- Created `scripts/integrate_cece_scm.py` to programmatically patch
  the SCM with CECE metadata, schemes, and build configuration.
- Added `src/ccpp/suites/suite_SCM_GFS_v16_CECE.xml` which integrates
  CECE emissions into a standard SCM suite.
- Fixed formatting in `scripts/integrate_cece_scm.py` to satisfy pre-commit
  hooks.

The CI verifies metadata consistency, cap generation, and infrastructure
readiness by running the CCPP prebuild and attempting a build/run
cycle within the SCM ecosystem.

* Enable CCPP SCM integration CI on all branches

Updates the CI workflow trigger to run on all pushes and pull requests
to facilitate development and verification of the CCPP interface.

* Add CI workflow for CCPP interface using CCPP SCM

- Introduces a new CI workflow that integrates CECE physics schemes into
  the CCPP SCM host model.
- Created `scripts/integrate_cece_scm.py` to programmatically patch
  the SCM with CECE metadata, schemes, and build configuration.
- Added `src/ccpp/suites/suite_SCM_GFS_v16_CECE.xml` which integrates
  CECE emissions into a standard SCM suite.
- Renamed `cece_ccpp_sync_import_to_device` to `cece_ccpp_sync_import_to_dev`
  across the codebase to avoid Fortran line truncation issues when
  integrated into the SCM.

The CI verifies metadata consistency, cap generation, and infrastructure
readiness by running the CCPP prebuild and attempting a build/run
cycle within the SCM ecosystem.

* Add CI workflow for CCPP interface using CCPP SCM

- Introduces a new CI workflow that integrates CECE physics schemes into
  the CCPP SCM host model.
- Created `scripts/integrate_cece_scm.py` to programmatically patch
  the SCM with CECE metadata, schemes, and build configuration.
- Added `src/ccpp/suites/suite_SCM_GFS_v16_CECE.xml` which integrates
  CECE emissions into a standard SCM suite.
- Renamed `cece_ccpp_sync_import_to_device` to `cece_ccpp_sync_import_to_dev`
  across the codebase to avoid Fortran line truncation issues when
  integrated into the SCM.
- Ensured CI runs on all branches.

The CI verifies metadata consistency, cap generation, and infrastructure
readiness by running the CCPP prebuild and attempting a build/run
cycle within the SCM ecosystem.

* Add CI workflow for CCPP interface using CCPP SCM

- Introduces a new CI workflow that integrates CECE physics schemes into
  the CCPP SCM host model.
- Created `scripts/integrate_cece_scm.py` to programmatically patch
  the SCM with CECE metadata, schemes, and build configuration.
- Added `src/ccpp/suites/suite_SCM_GFS_v16_CECE.xml` which integrates
  CECE emissions into a standard SCM suite.
- Renamed `cece_ccpp_sync_import_to_device` to `cece_ccpp_sync_import`
  across the codebase to avoid Fortran line truncation issues when
  integrated into the SCM, and ensured correct line wrapping in
  USE statements.
- Ensured CI runs on all branches.

The CI verifies metadata consistency, cap generation, and infrastructure
readiness by running the CCPP prebuild and attempting a build/run
cycle within the SCM ecosystem.

* Add CI workflow for CCPP interface using CCPP SCM

- Introduces a new CI workflow that integrates CECE physics schemes into
  the CCPP SCM host model.
- Created `scripts/integrate_cece_scm.py` to programmatically patch
  the SCM with CECE metadata, schemes, and build configuration.
- Added `src/ccpp/suites/suite_SCM_GFS_v16_CECE.xml` which integrates
  CECE emissions into a standard SCM suite.
- Renamed `cece_ccpp_sync_import_to_device` to `cece_ccpp_sync_import`
  across the codebase to avoid Fortran line truncation issues when
  integrated into the SCM.
- Updated `CMakeLists.txt` to conditionally disable ESMF-dependent tests
  and ensure NetCDF is found for standalone builds.

The CI verifies metadata consistency, cap generation, and infrastructure
readiness by running the CCPP prebuild and attempting a build/run
cycle within the SCM ecosystem.

* Add CCPP SCM integration and CI workflow

- Implement .github/workflows/ccpp_scm_integration.yml for automated testing with CCPP SCM.
- Add scripts/integrate_cece_scm.py to programmatically integrate CECE into the SCM build system.
- Create src/ccpp/suites/suite_SCM_GFS_v16_CECE.xml for SCM execution.
- Refactor CCPP API sync function name to 'cece_ccpp_sync_import' to comply with 132-char Fortran line limits.
- Fix CMakeLists.txt flow control nesting errors and remove redundant NetCDF discovery blocks.
- Improve CMake robustness with standalone NetCDF discovery and guarded ESMF dependencies.

* Add CI for CCPP interface with SCM integration and build fixes

- Implement .github/workflows/ccpp_scm_integration.yml for CI.
- Add scripts/integrate_cece_scm.py for programmatic SCM patching.
- Fix CMakeLists.txt nesting and redundant discovery.
- Make NetCDF optional in cece_standalone_writer.cpp to resolve linker errors.
- Refactor CCPP sync API to comply with Fortran line length limits.
- Update property-based tests for API consistency.

* Implement CI for CCPP interface utilizing CCPP SCM

- Add .github/workflows/ccpp_scm_integration.yml for automated SCM integration tests.
- Add scripts/integrate_cece_scm.py to programmatically patch CCPP SCM for CECE integration.
- Create src/ccpp/suites/suite_SCM_GFS_v16_CECE.xml for SCM execution.
- Make NetCDF an optional dependency to resolve build errors in non-NetCDF environments.
- Gate ESMF-dependent tests behind CECE_ENABLE_NUOPC for build portability.
- Refactor CCPP sync API and split long Fortran 'use' statements to satisfy 132-char line limits.
- Fix CMake flow control and formatting issues.

* Add CI for CCPP interface with SCM integration and build fixes

- Implement .github/workflows/ccpp_scm_integration.yml for CI.
- Add scripts/integrate_cece_scm.py for programmatic SCM patching, including suite metadata and dependency discovery.
- Create src/ccpp/suites/suite_SCM_GFS_v16_CECE.xml for SCM execution.
- Fix CMakeLists.txt nesting and redundant discovery; make NetCDF optional to resolve linker errors.
- Refactor CCPP sync API to 'cece_ccpp_sync_import' to comply with Fortran line length limits.
- Update property-based tests for API consistency and fix test linking.

* Add CI for CCPP interface with SCM integration and runtime fixes

- Implement .github/workflows/ccpp_scm_integration.yml for automated CI.
- Add scripts/integrate_cece_scm.py to programmatically patch CCPP SCM.
- NEW: Update integration script to register 'SCM_GFS_v16_CECE' defaults in SCM's 'suite_info.py' to allow successful execution.
- Fix CMakeLists.txt nesting and redundant discovery; make NetCDF optional.
- Refactor CCPP sync API to comply with Fortran line length limits.
- Ensure all tests link correctly with the 'cece' library.

* Add CI for CCPP interface with SCM integration and execution fixes

- Implement .github/workflows/ccpp_scm_integration.yml for automated CI.
- Add scripts/integrate_cece_scm.py for programmatic SCM patching.
- Fix suite_info.py patching in integration script to handle nested dictionaries and ensure correct defaults.
- Use full library paths in SCM's CMake for robust linking of Kokkos and yaml-cpp.
- Fix CMakeLists.txt nesting and make NetCDF optional.
- Refactor CCPP sync API to comply with Fortran line length limits.

* Add CI for CCPP interface with SCM integration and execution fixes

- Implement .github/workflows/ccpp_scm_integration.yml for automated CI.
- Add scripts/integrate_cece_scm.py for programmatic SCM patching.
- Fix suite_info.py patching in integration script to correctly register the 'SCM_GFS_v16_CECE' suite with default namelists and tracers.
- Use full library paths in SCM's CMake for robust linking of Kokkos and yaml-cpp.
- Fix CMakeLists.txt nesting and make NetCDF optional.
- Refactor CCPP sync API to comply with Fortran line length limits.

* Add CI for CCPP interface with SCM integration and execution fixes

- Implement .github/workflows/ccpp_scm_integration.yml for automated CI.
- Add scripts/integrate_cece_scm.py for programmatic SCM patching.
- Fix suite_info.py patching in integration script using dynamic Python registration to ensure correct defaults for the 'SCM_GFS_v16_CECE' suite.
- Use full absolute paths (mapped to CMAKE_SOURCE_DIR) in SCM's CMake for robust linking of libcece, Kokkos, and yaml-cpp.
- Fix CMakeLists.txt nesting and make NetCDF optional.
- Refactor CCPP sync API to comply with Fortran line length limits.

* Add CI for CCPP interface with robust SCM integration

- Implement .github/workflows/ccpp_scm_integration.yml for automated CI.
- Add scripts/integrate_cece_scm.py for programmatic SCM patching.
- Fix suite_info.py patching to correctly register 'SCM_GFS_v16_CECE' in the suite_list format used by SCM.
- Use full paths for linking libcece, Kokkos, and yaml-cpp in SCM's CMake system.
- Fix CMakeLists.txt nesting and redundant discovery; make NetCDF optional.
- Refactor CCPP sync API to comply with Fortran line length limits.

* Add CI for CCPP interface with robust SCM integration and runtime fixes

- Implement .github/workflows/ccpp_scm_integration.yml for automated CI.
- Add scripts/integrate_cece_scm.py for programmatic SCM patching.
- Fix suite_info.py patching in integration script to correctly register 'SCM_GFS_v16_CECE' defaults in both dict and list formats used by SCM.
- Use full paths for linking libcece, Kokkos, and yaml-cpp in SCM's CMake for maximum robustness.
- Fix CMakeLists.txt nesting and redundant discovery; make NetCDF optional.
- Refactor CCPP sync API to comply with Fortran line length limits.

* Add CI for CCPP interface with robust SCM integration

- Implement .github/workflows/ccpp_scm_integration.yml for automated CI.
- Add scripts/integrate_cece_scm.py for programmatic SCM patching.
- Fix suite_info.py patching to correctly register 'SCM_GFS_v16_CECE' defaults.
- Use full paths for linking libcece, Kokkos, and yaml-cpp in SCM's CMake system.
- Fix CMakeLists.txt nesting and redundant discovery; make NetCDF optional.
- Refactor CCPP sync API to comply with Fortran line length limits.

* Add CI for CCPP interface with robust SCM integration

- Implement .github/workflows/ccpp_scm_integration.yml for automated CI.
- Add scripts/integrate_cece_scm.py for programmatic SCM patching.
- Fix suite_info.py patching to correctly register both 'SCM_GFS_v16_CECE' and 'SCM_GFS_v16_CECE_ps' defaults.
- Provide suite XML files for both full and prescribed surface physics.
- Use full paths for linking libcece, Kokkos, and yaml-cpp in SCM's CMake system.
- Fix CMakeLists.txt nesting and make NetCDF optional.
- Refactor CCPP sync API to comply with Fortran line length limits.

---------

Co-authored-by: bbakernoaa <22104759+bbakernoaa@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CCPP CCPP physics interface enhancement New feature or request Interface When modifying or adding a new interface use this. Physics When adding or modifying a physics parameterization please use this.

Projects

Development

Successfully merging this pull request may close these issues.

2 participants