How ncar/ccpp-framework works
Main Components
• Core CCPP Framework:
• Located under the “src” directory, this is where the main Fortran modules reside (e.g., ccpp_types.F90, ccpp_constituent_prop_mod.F90). This layer contains the core infrastructure that bridges the physics schemes with a host model interface.
• Stand-Alone Tools and Utilities:
• Found largely in the “scripts” directory, these Python scripts (such as ccpp_capgen.py, metadata_parser.py, fortran_tools, parse_tools, etc.) handle tasks like metadata extraction, code generation, prebuild configuration, variable tracking, and file conversion. These tools form the automation and integration backbone that supports code consistency and host model preparation.
• Host Model / Stub Interface:
• Testing Framework:
• A significant portion of the file tree is dedicated to “test” (and “test_prebuild”). These directories include unit tests, integration tests, and Fortran-based tests that validate components such as capgen, metadata parsing, and host model functionality. They serve as a verification layer and also hint at the modular structure.
• Documentation and Build Configuration:
• The “doc” folder and various top-level files (e.g., CMakeLists.txt) illustrate the integration of build systems and developer documentation. They are key for understanding project configuration and build pipelines.
Relationships and Interactions
• Data and Control Flow:
• Modular and Layered Architecture:
• Build and Deployment Processes:
• Build system via CMake configurations (both in “src”, “doc”, “stub”, etc.) and continuous integration tools (.github/workflows, .travis.yml). This shows how code, tests, and documentation are automatically built and validated.
Architectural Patterns and Design Principles
• Separation of Concerns:
• Clearly distinguish the roles: physics scheme integration (core framework), automation and metadata processing (scripts/tools), and host model demonstration (stub). This separation aids in maintaining a clean architecture.
• Metadata-Driven Code Generation:
• Testing as a First-Class Citizen:
• Since there is an extensive “test” hierarchy, include a dedicated testing component that interacts with both the core framework and the automation layer. Show that tests are responsible for validating data flow, integrity, and integration.
Technologies, Frameworks, and Libraries
• Fortran: Core language used for physics schemes and host model integration.
• Python: Used extensively in the toolset for tasks such as metadata parsing, code generation (e.g., ccpp_capgen.py), and state management.
• CMake: Utilized for building the Fortran source code (with top-level CMakeLists.txt and specific ones in “doc”, “src”, “stub”).
• Continuous Integration: GitHub Actions workflows (.github/workflows) and Travis CI (.travis.yml) for CI/CD.
• XML/XSD: Used in metadata and suite descriptions (e.g., schema/suite_v1_0.xsd, various XML files in tests).