Struct ImplicitRungeKutta

Source
pub struct ImplicitRungeKutta<E, F, T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> {
    pub h0: T,
    pub newton_tol: T,
    pub max_newton_iter: usize,
    pub rtol: T,
    pub atol: T,
    pub h_max: T,
    pub h_min: T,
    pub max_steps: usize,
    pub max_rejects: usize,
    pub safety_factor: T,
    pub min_scale: T,
    pub max_scale: T,
    /* private fields */
}
Expand description

Implicit Runge-Kutta solver that can handle:

  • Fixed-step methods with Newton iteration for stage equations
  • Adaptive step methods with embedded error estimation
  • Gauss methods (A-stable, symplectic for Hamiltonian systems)
  • Radau methods (L-stable, good for stiff problems)
  • Lobatto methods (A-stable, good for constrained systems)

§Type Parameters

  • E: Equation type (e.g., Ordinary, Delay, Stochastic)
  • F: Family type (e.g., Adaptive, Fixed, Gauss, Radau, Lobatto)
  • T: Real number type (f32, f64)
  • V: State vector type
  • D: Callback data type
  • const O: Order of the method
  • const S: Number of stages in the method
  • const I: Total number of stages including interpolation (equal to S for methods without dense output)

Fields§

§h0: T§newton_tol: T§max_newton_iter: usize§rtol: T§atol: T§h_max: T§h_min: T§max_steps: usize§max_rejects: usize§safety_factor: T§min_scale: T§max_scale: T

Implementations§

Source§

impl<E, T: Real, V: State<T>, D: CallBackData> ImplicitRungeKutta<E, Adaptive, T, V, D, 4, 2, 2>

Source

pub fn gauss_legendre_4() -> Self

Creates a new Gauss-Legendre 2-stage implicit Runge-Kutta method of order 4.

Source§

impl<E, T: Real, V: State<T>, D: CallBackData> ImplicitRungeKutta<E, Adaptive, T, V, D, 6, 3, 3>

Source

pub fn gauss_legendre_6() -> Self

Creates a new Gauss-Legendre 3-stage implicit Runge-Kutta method of order 6.

Source§

impl<E, T: Real, V: State<T>, D: CallBackData> ImplicitRungeKutta<E, Adaptive, T, V, D, 2, 2, 2>

Source

pub fn lobatto_iiic_2() -> Self

Creates a new Lobatto IIIC 2-stage implicit Runge-Kutta method of order 2.

Source§

impl<E, T: Real, V: State<T>, D: CallBackData> ImplicitRungeKutta<E, Adaptive, T, V, D, 4, 3, 3>

Source

pub fn lobatto_iiic_4() -> Self

Creates a new Lobatto IIIC 3-stage implicit Runge-Kutta method of order 4.

Source§

impl<E, T: Real, V: State<T>, D: CallBackData> ImplicitRungeKutta<E, Fixed, T, V, D, 1, 1, 1>

Source

pub fn backward_euler(h0: T) -> Self

Backward Euler method of order 1 with 1 stage. A-stable and suitable for stiff problems.

Source§

impl<E, T: Real, V: State<T>, D: CallBackData> ImplicitRungeKutta<E, Fixed, T, V, D, 2, 2, 2>

Source

pub fn crank_nicolson(h0: T) -> Self

Crank-Nicolson method of order 2 with 2 stages. A-stable and suitable for stiff problems.

Source§

impl<E, T: Real, V: State<T>, D: CallBackData> ImplicitRungeKutta<E, Fixed, T, V, D, 2, 2, 2>

Source

pub fn trapezoidal(h0: T) -> Self

Trapezoidal method of order 2 with 2 stages. A-stable and suitable for stiff problems.

Source§

impl<E, T: Real, V: State<T>, D: CallBackData> ImplicitRungeKutta<E, Fixed, T, V, D, 3, 2, 2>

Source

pub fn radau_iia_3(h0: T) -> Self

Radau IIA method of order 3 with 2 stages. A-stable and suitable for stiff problems.

Source§

impl<E, T: Real, V: State<T>, D: CallBackData> ImplicitRungeKutta<E, Fixed, T, V, D, 5, 3, 3>

Source

pub fn radau_iia_5(h0: T) -> Self

Radau IIA method of order 5 with 3 stages. A-stable and suitable for stiff problems.

Source§

impl<E, F, T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> ImplicitRungeKutta<E, F, T, V, D, O, S, I>

Source

pub fn rtol(self, rtol: T) -> Self

Set the relative tolerance for error control

Source

pub fn atol(self, atol: T) -> Self

Set the absolute tolerance for error control

Source

pub fn h0(self, h0: T) -> Self

Set the initial step size

Source

pub fn h_min(self, h_min: T) -> Self

Set the minimum allowed step size

Source

pub fn h_max(self, h_max: T) -> Self

Set the maximum allowed step size

Source

pub fn max_steps(self, max_steps: usize) -> Self

Set the maximum number of steps allowed

Source

pub fn max_rejects(self, max_rejects: usize) -> Self

Set the maximum number of consecutive rejected steps before declaring stiffness

Source

pub fn safety_factor(self, safety_factor: T) -> Self

Set the safety factor for step size control (default: 0.9)

Source

pub fn min_scale(self, min_scale: T) -> Self

Set the minimum scale factor for step size changes (default: 0.2)

Source

pub fn max_scale(self, max_scale: T) -> Self

Set the maximum scale factor for step size changes (default: 10.0)

Source

pub fn newton_tol(self, newton_tol: T) -> Self

Set the Newton iteration tolerance (default: 1e-10)

Source

pub fn max_newton_iter(self, max_newton_iter: usize) -> Self

Set the maximum number of Newton iterations per stage (default: 50)

Source

pub fn order(&self) -> usize

Get the order of the method

Source

pub fn stages(&self) -> usize

Get the number of stages in the method

Source

pub fn dense_stages(&self) -> usize

Get the number of terms in the dense output interpolation polynomial

Trait Implementations§

Source§

impl<E, F, T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> Default for ImplicitRungeKutta<E, F, T, V, D, O, S, I>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> Interpolation<T, V> for ImplicitRungeKutta<Ordinary, Adaptive, T, V, D, O, S, I>

Source§

fn interpolate(&mut self, t_interp: T) -> Result<V, Error<T, V>>

Interpolate between previous and current step Read more
Source§

impl<T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> Interpolation<T, V> for ImplicitRungeKutta<Ordinary, Fixed, T, V, D, O, S, I>

Source§

fn interpolate(&mut self, t_interp: T) -> Result<V, Error<T, V>>

Interpolate between previous and current step Read more
Source§

impl<T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> OrdinaryNumericalMethod<T, V, D> for ImplicitRungeKutta<Ordinary, Adaptive, T, V, D, O, S, I>

Source§

fn init<F>( &mut self, ode: &F, t0: T, tf: T, y0: &V, ) -> Result<Evals, Error<T, V>>
where F: ODE<T, V, D>,

Initialize OrdinaryNumericalMethod before solving ODE Read more
Source§

fn step<F>(&mut self, ode: &F) -> Result<Evals, Error<T, V>>
where F: ODE<T, V, D>,

Step through solving the ODE by one step Read more
Source§

fn t(&self) -> T

Access time of last accepted step
Source§

fn y(&self) -> &V

Access solution of last accepted step
Source§

fn t_prev(&self) -> T

Access time of previous accepted step
Source§

fn y_prev(&self) -> &V

Access solution of previous accepted step
Source§

fn h(&self) -> T

Access step size of next step
Source§

fn set_h(&mut self, h: T)

Set step size of next step
Source§

fn status(&self) -> &Status<T, V, D>

Status of solver
Source§

fn set_status(&mut self, status: Status<T, V, D>)

Set status of solver
Source§

impl<T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> OrdinaryNumericalMethod<T, V, D> for ImplicitRungeKutta<Ordinary, Fixed, T, V, D, O, S, I>

Source§

fn init<F>( &mut self, ode: &F, t0: T, tf: T, y0: &V, ) -> Result<Evals, Error<T, V>>
where F: ODE<T, V, D>,

Initialize OrdinaryNumericalMethod before solving ODE Read more
Source§

fn step<F>(&mut self, ode: &F) -> Result<Evals, Error<T, V>>
where F: ODE<T, V, D>,

Step through solving the ODE by one step Read more
Source§

fn t(&self) -> T

Access time of last accepted step
Source§

fn y(&self) -> &V

Access solution of last accepted step
Source§

fn t_prev(&self) -> T

Access time of previous accepted step
Source§

fn y_prev(&self) -> &V

Access solution of previous accepted step
Source§

fn h(&self) -> T

Access step size of next step
Source§

fn set_h(&mut self, h: T)

Set step size of next step
Source§

fn status(&self) -> &Status<T, V, D>

Status of solver
Source§

fn set_status(&mut self, status: Status<T, V, D>)

Set status of solver

Auto Trait Implementations§

§

impl<E, F, T, V, D, const O: usize, const S: usize, const I: usize> Freeze for ImplicitRungeKutta<E, F, T, V, D, O, S, I>
where T: Freeze, V: Freeze, D: Freeze,

§

impl<E, F, T, V, D, const O: usize, const S: usize, const I: usize> RefUnwindSafe for ImplicitRungeKutta<E, F, T, V, D, O, S, I>

§

impl<E, F, T, V, D, const O: usize, const S: usize, const I: usize> Send for ImplicitRungeKutta<E, F, T, V, D, O, S, I>
where V: Send, D: Send, F: Send, E: Send,

§

impl<E, F, T, V, D, const O: usize, const S: usize, const I: usize> Sync for ImplicitRungeKutta<E, F, T, V, D, O, S, I>
where V: Sync, D: Sync, F: Sync, E: Sync,

§

impl<E, F, T, V, D, const O: usize, const S: usize, const I: usize> Unpin for ImplicitRungeKutta<E, F, T, V, D, O, S, I>
where T: Unpin, V: Unpin, D: Unpin, F: Unpin, E: Unpin,

§

impl<E, F, T, V, D, const O: usize, const S: usize, const I: usize> UnwindSafe for ImplicitRungeKutta<E, F, T, V, D, O, S, I>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.