Skip to content

About

An example of wrapping a model written in Rust with a BMI

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

bmi-example-rust

AI Declaration Format DOI

An example of implementing the Rust specification for the CSDMS Basic Model Interface (BMI).

Overview

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.

Build/Run

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 test

Use

Run the heat model through its BMI with the supplied configuration:

cargo run -- heat.cfg

The 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.

Contributing

See CONTRIBUTING.md for development instructions and AI usage declaration guidance.

License

Apache-2.0. See LICENSE.

About

An example of wrapping a model written in Rust with a BMI

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages