An example of implementing the Rust specification for the CSDMS Basic Model Interface (BMI).
This example implements a BMI for a simple model that solves the two-dimensional heat equation on a uniform rectangular plate with fixed boundary temperatures. The model and its BMI are written in Rust. Tests of the BMI are provided.
The repository contains:
src/heat.rs: the heat model.src/lib.rs: the BMI implementation.src/main.rs: a sample program that runs the model through its BMI.tests/: tests of the model's BMI.
Install a Rust toolchain supporting edition 2024. Cargo downloads the bmi-rust
dependency from crates.io automatically.
Build the example and run the tests from this directory:
cargo build
cargo testRun the heat model through its BMI with the supplied configuration:
cargo run -- heat.cfgThe program heats the center node to 300 K and prints its temperature at each
time step. Run cargo run without an argument to use the default configuration.
Configuration files contain four comma-separated values: diffusivity, end time, number of columns, and number of rows. See heat.cfg for an example.
See CONTRIBUTING.md for development instructions and AI usage declaration guidance.
Apache-2.0. See LICENSE.