Expand description
§tpt-sci-ode
ODE/DAE solving substrate for the tpt-science pillar.
This crate implements its own ODE integrators from scratch — no
diffsol, nalgebra, or faer in the
shipped dependency graph — so the whole crate is TPT-owned code under
MIT OR Apache-2.0. It carries its own dual-licensed dense linear algebra
(DMat + LU with partial pivoting, in linalg) for the implicit-method
linear solves, and depends on tpt-math-numeric only for the Scalar
numeric trait.
Four methods are provided (see Method):
Method::Tsit45— explicit Runge–Kutta 5(4), non-stiff.Method::TrBdf2— 2-stage SDIRK (TR-BDF2), A-stable, stiff.Method::Esdirk34— 4-stage ESDIRK order 3(4), A-/L-stable, stiff.Method::Bdf— variable-order (1–5) backward differentiation, stiff.
All use a shared adaptive-step driver with Hermite dense output, so
OdeProblem::solve_dense returns exact states at the requested times.
For systems with at least 64 states, the implicit methods build their
Newton matrices through the in-crate sparse CSR/LU path (sparse),
never materialising a dense Jacobian.
diffsol is retained only as an optional, dev-only verification oracle
(feature verify-diffsol, excluded from license scanning).
§Example
use tpt_sci_ode::{OdeProblem, Method};
// dy/dt = -y, y(0) = 1 -> y(1) = e^-1
let prob = OdeProblem::new(
|_t, y, dydt| { dydt[0] = -y[0]; },
vec![1.0],
0.0,
).unwrap();
let y = prob.solve(Method::Tsit45, 1.0).unwrap();
assert!((y[0] - std::f64::consts::E.recip()).abs() < 1e-5);Re-exports§
pub use error::OdeError;pub use jit::JitRhs;pub use jit::JitRhsBuilder;pub use jit::compile_rhs;pub use problem::OdeProblem;pub use problem::OdeProblemBuilder;pub use problem::Rhs;pub use sensitivity::SensitivityResult;pub use sensitivity::forward_sensitivities;pub use solver::Method;pub use trajectory::Trajectory;
Modules§
- error
- events
- Event detection and root-finding during integration.
- jit
- Cranelift-generated call stubs for right-hand-side closures.
- linalg
- In-crate dense linear algebra for the implicit ODE solvers.
- problem
- scalar
- Generic (
f32/f64) dense linear algebra and an explicit integrator. - sensitivity
- Forward sensitivity analysis for ODE models.
- solver
- From-scratch ODE integration for
tpt-sci-ode. - sparse
- In-crate sparse linear algebra for the implicit ODE solvers.
- trajectory
- Named, time-indexed output with CSV export. A named, time-indexed trajectory with CSV output.
Traits§
- RhsCallable
- A callable right-hand side for the ODE solvers.
- Scalar
- A floating-point scalar type usable throughout
tpt-math.