tpt-sci-sim-core
Multi-scale simulation orchestration for the tpt-science pillar: the layer
above tpt-sci-ode and tpt-sci-grid that a "multi-scale computational
platform" actually needs and that neither solver crate provides alone.
It provides:
- Time-stepping across heterogeneous sub-models. Each
SubModeladvances on its own internal time scale (max_step) while aSimulationdrives them all forward to a shared target time, taking the largest sub-step that no model would overshoot. - Cross-scale coupling. A
Couplingmaps the state of one model onto the input buffer of another after every sub-step. - Checkpointing.
Simulation::snapshot/Simulation::restorecapture and restore every model's state and the global clock, for resumable / reproducible runs.
Two ready-made SubModel implementations are provided: OdeSubModel wraps a
tpt-sci-ode problem, and DiffusionSubModel wraps a 1-D diffusion field
built on a tpt-sci-grid Laplacian.
Depends on tpt-sci-ode, tpt-sci-grid. The multi_scale_cookbook example
additionally dev-depends on tpt-sci-reaction-network to drive an
OdeSubModel from a reaction-network model.
Example
use ;
// A single fast exponential-decay sub-model: dy/dt = -y, y(0) = 1.
let decay = new;
let mut sim = new;
sim.add_model.unwrap;
sim.step_until.unwrap;
let y = sim.model.unwrap.state;
assert!;
License
Licensed under either of MIT or Apache-2.0 at your option.