Comment on gmd-2021-311

Stephan C. KramerOpenalex Unknown 2021 · OpenAlex

Abstract

Ocean models are long-living software systems facing challenges with increasing complexity, architecture erosion, and managing legacy code. These challenges increase maintenance costs in development and use, which reduces the time and resources available for research. Software engineering addresses these challenges by separation of concerns and modularization. One particular approach is to separate concerns by tailor-made notations, i.e. Domain-Specific Languages (DSLs). Using DSLs, the model developer can focus on one concern at a time without the need to consider other concerns of a software system simultaneously. In ocean and climate models, DSL tooling, like PSyclone and Dusk/Dawn, is used for instance to separate scientific and technical code. CP-DSL complements this approach with a focus on configuration and parametrization, which play an important role in ocean models, especially in parameter optimization and scenario-based simulations. CP-DSL is designed to be model agnostic and provides a unified interface to different ocean models. Furthermore, the DSL can be integrated into tools and processes used by domain experts. In this paper we report on the DSL design, implementation, and the evaluation with scientists and research software engineers. The implementation of CP-DSL is available as open source software and a replication package for configuration and parameterization of UVic and MITgcm is provided.

Introduction

Ocean models such as the MIT General Circulation Model (MITgcm) and the University of Victoria Earth System Climate Model (UVic) are essential tools for climate research. However, as these systems age, they often suffer from "architecture erosion," where scientific logic becomes entangled with technical configuration. Currently, researchers must manage a fragmented landscape of Fortran namelists, C-preprocessor directives, and external parameter files. This complexity hinders model portability, complicates automated parameter optimization, and increases the risk of errors, such as unit inconsistencies. CP-DSL (Configuration and Parameterization Domain-Specific Language) addresses these issues by providing a "single source of truth" for model settings, independent of the underlying source code.

Methods and Implementation

CP-DSL was developed using a model-driven software engineering approach, leveraging the Eclipse Modeling Framework (EMF) and Xtext. This foundation allows for advanced features like syntax highlighting, real-time error checking, and integration with the Language Server Protocol (LSP), making the tool compatible with common editors like Vim, Emacs, and JupyterLab.

The language utilizes a two-layer architecture:

  1. Declaration Model: This layer defines the "vocabulary" of a specific ocean model, outlining available parameters and features.
  2. Configuration Model: This layer defines the specific values for an experiment. By separating these, the same experiment configuration can theoretically be applied across different models.

A "megamodel" approach facilitates a two-step transformation: the DSL is first converted into an intermediary model, which is then used to generate the human-readable, model-specific files required by the target system (e.g., data.pkg for MITgcm or control.in for UVic).

Evaluation and Results

The effectiveness of CP-DSL was evaluated using MITgcm (version 67w) and UVic (version 2.9) as case studies. The researchers replicated three standard MITgcm experiments: a Barotropic Ocean Gyre, a modified Barotropic adjustment problem, and a global ocean simulation.

Key findings include:

  • Functional Equivalence: Regression tests confirmed that models configured via CP-DSL produced results identical to those configured manually.
  • Improved Usability: Initial feedback led to a shift from a JSON-style curly brace syntax to a YAML-like syntax, which domain experts found more intuitive and readable.
  • Unit Safety: The integrated unit system prevents "silent" failures by automatically handling conversions (e.g., meters to kilometers) or flagging errors when units are incompatible.
  • Maintainability: The generated output files include comments derived from the DSL documentation, ensuring that research remains reproducible even if the DSL tool itself is not used.

Discussion and Conclusion

While CP-DSL successfully manages general parameters and modules, domain experts noted that the syntax for "diagnostics" (logging model states) requires further refinement to be sufficiently expressive. Additionally, the current parameter override logic needs more robust scoping to prevent accidental redefinitions.

Future development will focus on expanding support to other major models, such as NEMO and ICON, and improving integration with external diagnostic tools like XIOS. By providing a unified, model-agnostic interface, CP-DSL significantly reduces the technical debt associated with ocean model configuration, allowing researchers to focus more on scientific discovery.

Summary updated

Abstract

Ocean models are long-living software systems facing challenges with increasing complexity, architecture erosion, and managing legacy code. These challenges increase maintenance costs in development and use, which reduces the time and resources available for research. Software engineering addresses these challenges by separation of concerns and modularization. One particular approach is to separate concerns by tailor-made notations, i.e. Domain-Specific Languages (DSLs). Using DSLs, the model developer can focus on one concern at a time without the need to consider other concerns of a software system simultaneously. In ocean and climate models, DSL tooling, like PSyclone and Dusk/Dawn, is used for instance to separate scientific and technical code. CP-DSL complements this approach with a focus on configuration and parametrization, which play an important role in ocean models, especially in parameter optimization and scenario-based simulations. CP-DSL is designed to be model agnostic and provides a unified interface to different ocean models. Furthermore, the DSL can be integrated into tools and processes used by domain experts. In this paper we report on the DSL design, implementation, and the evaluation with scientists and research software engineers. The implementation of CP-DSL is available as open source software and a replication package for configuration and parameterization of UVic and MITgcm is provided.
BibTeX
@inproceedings{kramer2021comment,
  author = {Stephan C. Kramer},
  title = {{Comment on gmd-2021-311}},
  booktitle = {Openalex Unknown},
  year = {2021},
  doi = {10.5194/gmd-2021-311-rc2},
}
Figure