The Basic Model Interface

When you climb in the driver’s seat of an unfamiliar car, you are nonetheless presented with a familiar sight. Whatever the make or model may be, we take it for granted that the vehicle will provide a steering wheel, brake pedal, and speedometer, alongside the various other controls and readouts that are common to essentially all cars and trucks on the planet. Although we don’t usually think of it this way, drivers across the globe benefit from a standard interface: a set of control mechanisms and information displays that have essentially the same design regardless of whether the vehicle is a tiny electric two-seater or a giant stretch limousine. This standard interface makes the job of operating a vehicle much easier than it would be if each one presented a radically different interface. Imagine a world where switching from a sports car to a pickup truck required months of study and practice! Similarly, railroads benefit from a standard for coupling rail cars together. The result: trains can be assembled from combinations of all sorts of different rail cars, built by different companies, in different places, and with different purposes.

We believe that numerical models, and the sub-components that make up those models, should offer a similar kind of standardization. To this end, the Community Surface Dynamics Modeling System (CSDMS) has developed the Basic Model Interface (BMI): a set of standard control and query functions that, when added to a model code, make that model both easier to learn and easier to couple with other software elements.

While a BMI can be written for any language, CSDMS currently supports five languages: C, C++, Fortran, Java, and Python. The specification for each language is given in Table 1, along with a corresponding example in which the BMI is implemented.

Table 1: BMI languages.

Language

Specification

Repository

Example

C

bmi.h

bmi-c

bmi-example-c

C++

bmi.hxx

bmi-cxx

bmi-example-cxx

Fortran

bmi.f90

bmi-fortran

bmi-example-fortran

Java

bmi.java

bmi-java

bmi-example-java

Python

bmi.py

bmi-python

bmi-example-python

BMI is a community standard. Table 2 lists community-contributed language specifications and examples for two languages, Javascript and Julia.

Table 2: Community-contributed BMI languages.

Language

Specification

Repository

Example

Javascript

bmi.js

bmi-js

bmi-example-js

Julia

bmi.jl

bmi-julia

bmi-example-julia

Along with the examples, two documents may be particularly helpful when writing a BMI:

A complete description of the functions that make up the BMI is given next.

BMI is an element of the CSDMS Workbench, an integrated system of software tools, technologies, and standards for building and coupling models.