This is an implementation of the Model Data Passing Interface (MODPI) that works with models written FORTRAN, C, and C++. MODPI is a noninvasive and user-friendly interface for integrating geophysical and environmental system models that allows for read and write access to all model data during simulation by any third-party process (e.g., another model, a visualization program, etc.). Implementing MODPI for models requires only directives placed as comments in the code, and the MODPI integration platform generates event constructs and wrapper programs for the rest of the integration given an XML linkage specification file and an optional custom data conversion module. MODPI utilizes inter-process communication to exchange data between models during execution, rendering it highly interoperable across different programming languages, frameworks, operating systems, compilers, and license requirements (Dozier et al., 2014). Currently both OpenMPI and 0MQ have been used as inter-process communication mechanisms within
fortmodpi. Closed-source models can also implement MODPI to allow a plug-and-play methodology for linking with other models. Computational overhead is minimal, and data structure reconciliation takes place in custom data converters within a wrapper program for each model.
To get started with
fortmodpi, follow this tutorial that implements MODPI for a sample model.
Overview of steps required to implement MODPI for your model
Implementing MODPI is very non-invasive to the code base of your model. Your model is still completely independent of MODPI and can run exactly the same as before. After generating a wrapper for the model, it will only be dependent on the library that implements event constructs (
fortevent objects), which are non-invasive and do not require refactoring the original code base.
- Step 1
- Place model code (or libraries in the case of closed-source models that implement MODPI) into a recommended directory structure
- Step 2
- Add MODPI directives to the model code
- Step 3
- If connecting with another model immediately, build an XML file to describe linkage with the other model and custom subscribers to handle custom data conversion
- Step 4
modpi_generate.pyto automatically generate and attempt to build the integrated modeling system.
- Step 5
modpi_run.pyto automatically build configuration files needed for the inter-process communication mechanism used by
fortmodpi(MPI) and run the integrated modeling system.
fortmodpi model integration platform is built to be multiplatform and has been tested with GNU compilers. Requirements for a compiler to compile
fortmodpi include mixed FORTRAN, C, and C++ programming in addition to C++11 threading support, and the capability to access arguments from a subroutine within a library other than the executing library.
- GNU compilers for C, C++, and FORTRAN that support version 4.8.2 and higher
- The following compiler will build the
fortmodpisystem on Windows:
DayCent-HYDRUS case study
Supplemental data for Dozier et al. (2014) is hosted here:
- Source code to reproduce results (zip, gz, bz2)
- Source repository
- Benchmark models
- Performance results
Reproduce results from the paper by running the following shell file on an Ubuntu machine:
Dozier, A. Q., David, O., Zhang, Y., and Arabi, M. (2014). "MODPI: A parallel model data passing interface for integrating legacy environmental system models" at 7th Int. Congress on Env. Modelling and Software, International Environmental Modelling and Software Society (iEMSs), San Diego, CA, USA, June 15-19, 2014. Available online at http://www.iemss.org/sites/iemss2014/papers/iemss2014_submission_266.pdf
Dozier, A. Q., O. David, M. Arabi, W. Lloyd, and Y. Zhang (2016), A minimally invasive model data passing interface for integrating legacy environmental system models, Environmental Modelling & Software, 80, 265–280, doi:10.1016/j.envsoft.2016.02.031.