pub struct DiffusionSubModel { /* private fields */ }Expand description
A SubModel integrating the 1-D diffusion equation on a uniform grid
with explicit Euler time stepping.
The discrete semi-discrete system is
∂u/∂t = D · L u + s, where L is the laplacian_1d assembled by
tpt_sci_grid, D is the diffusion coefficient, and s is an optional
per-node forcing term. The forcing is held in the model’s input buffer,
so a coupling can drive the field from another sub-model’s state — the
canonical cross-scale pattern (e.g. a fast reaction ODE feeding a slow
diffusion field).
Implementations§
Source§impl DiffusionSubModel
impl DiffusionSubModel
Sourcepub fn new(
id: &str,
grid: UniformGrid1D,
coeff: f64,
bc: Boundary,
u0: Vec<f64>,
) -> Result<Self, SimError>
pub fn new( id: &str, grid: UniformGrid1D, coeff: f64, bc: Boundary, u0: Vec<f64>, ) -> Result<Self, SimError>
Build a diffusion sub-model on grid with diffusion coefficient coeff
and boundary condition bc. The initial field is u0 (one value per
grid node).
§Errors
Returns SimError::Advance if u0’s length does not match the number
of grid nodes.
Sourcepub fn set_max_step(&mut self, max_step: f64)
pub fn set_max_step(&mut self, max_step: f64)
Largest stable internal step (derived from the explicit-Euler stability
limit on construction; can be overridden with set_max_step).
Trait Implementations§
Source§impl SubModel for DiffusionSubModel
impl SubModel for DiffusionSubModel
Source§fn id(&self) -> &str
fn id(&self) -> &str
Simulation.Source§fn max_step(&self) -> f64
fn max_step(&self) -> f64
advance
call. The orchestrator never asks a model to advance by more than this.