pub struct OdeProblem<S: Scalar, F>{
pub f: F,
pub t0: S,
pub tf: S,
pub y0: Vec<S>,
}Expand description
ODE initial value problem.
Represents: dy/dt = f(t, y), y(t0) = y0, solve from t0 to tf
Fields§
§f: FRight-hand side function
t0: SInitial time
tf: SFinal time
y0: Vec<S>Initial state
Implementations§
Source§impl<S: Scalar, F> OdeProblem<S, F>
impl<S: Scalar, F> OdeProblem<S, F>
Sourcepub fn new(f: F, t0: S, tf: S, y0: Vec<S>) -> Self
pub fn new(f: F, t0: S, tf: S, y0: Vec<S>) -> Self
Create a new ODE problem.
Examples found in repository?
examples/radau5_step_audit.rs (line 14)
10fn run<F>(name: &str, rhs: F, t0: f64, tf: f64, y0: Vec<f64>, rtol: f64, atol: f64)
11where
12 F: Fn(f64, &[f64], &mut [f64]) + Copy,
13{
14 let problem = OdeProblem::new(rhs, t0, tf, y0.clone());
15 let opts = SolverOptions::default().rtol(rtol).atol(atol);
16 let res = Radau5::solve(&problem, t0, tf, &y0, &opts).expect("solve failed");
17 println!(
18 "{:<32} acc={:>4} rej={:>3} rhs={:>5} jac={:>3} lu={:>4}",
19 name,
20 res.stats.n_accept,
21 res.stats.n_reject,
22 res.stats.n_eval,
23 res.stats.n_jac,
24 res.stats.n_lu,
25 );
26}Trait Implementations§
Source§impl<S: Scalar, F> OdeSystem<S> for OdeProblem<S, F>
impl<S: Scalar, F> OdeSystem<S> for OdeProblem<S, F>
Source§fn jacobian(&self, t: S, y: &[S], jac: &mut [S])
fn jacobian(&self, t: S, y: &[S], jac: &mut [S])
Optionally compute the Jacobian:
J = ∂f/∂y, row-major
(jac[i*n + j] = ∂f_i/∂y_j, length n²). Read moreSource§fn is_autonomous(&self) -> bool
fn is_autonomous(&self) -> bool
Is the system autonomous? (f does not depend on t explicitly)
Source§fn has_mass_matrix(&self) -> bool
fn has_mass_matrix(&self) -> bool
Does this system have a mass matrix?
Source§fn mass_matrix(&self, mass: &mut [S])
fn mass_matrix(&self, mass: &mut [S])
Get the mass matrix M for the DAE: M * y’ = f(t, y) Read more
Source§fn is_singular_mass(&self) -> bool
fn is_singular_mass(&self) -> bool
Is the mass matrix singular? (i.e., is this a DAE?)
Auto Trait Implementations§
impl<S, F> Freeze for OdeProblem<S, F>
impl<S, F> RefUnwindSafe for OdeProblem<S, F>where
F: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, F> Send for OdeProblem<S, F>where
F: Send,
impl<S, F> Sync for OdeProblem<S, F>where
F: Sync,
impl<S, F> Unpin for OdeProblem<S, F>
impl<S, F> UnsafeUnpin for OdeProblem<S, F>where
F: UnsafeUnpin,
S: UnsafeUnpin,
impl<S, F> UnwindSafe for OdeProblem<S, F>where
F: UnwindSafe,
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more