How dssat/dssat-csm-os works
Main Components
• Build & Configuration: Includes files like CMakeLists.txt, the cmake/Modules folder, and other build scripts (distclean.cmake). This represents how the project is built and configured (using CMake to set up Fortran compiling, etc.).
• Data Management: The “Data” directory holds genotype, pest, standard model data, and many CDE files. This is the backbone of simulation inputs.
• Input and Preprocessing: The InputModule directory contains blocks and Fortran source files (such as INSOIL.for, INSTGE.for, etc.) that handle data input and initial variable setups for simulation.
• Simulation Modules:
– Soil Module: Found under Soil/ (with submodules for water, nutrients, organic matter, etc.).
– Crop/Plant Modules: The Plant directory includes crop-specific simulation codes (e.g., CERES, CSYCA, CANEGRO, etc.) which simulate the growth of over 45 crop types.
– Management Module: Contains Fortran files under Management/ to simulate agricultural management processes.
– Weather Module: Files in Weather/ deal with weather data, forecasting, and climate inputs.
• Utilities: In the Utilities directory, codes that assist in error processing, output generation, and miscellaneous support functions are located.
• External/Additional Packages: Other folders (like SPAM, Soil subdirectories, etc.) extend the simulation capabilities (e.g., water stress, evapotranspiration, etc.).
Relationships and Interactions
• The Build System (managed by CMake) compiles the various simulation modules.
• At runtime, data from the Data Management module feeds into both the InputModule and Simulation Modules.
• The Simulation Engine acts as the integration point by orchestrating interactions among the Soil, Crop, Weather, and Management modules.
• Utilities support simulation runs (output handling, error checking, etc.).
Architectural Patterns
• Modular/MVC-like Separation: Each scientific discipline (soil, crop, weather, management) is isolated to allow for ease of replacement or extension.
• Data-Driven Design: The project relies on extensive data repositories (genotypes, weather, pest, etc.) which are decoupled from the simulation logic.
• Build-time Flexibility: The use of CMake and multiple IFort/Other Fortran flag configurations provides flexibility in compiling and testing.