Struct diffsol::ode_solver::sdirk::Sdirk
source · pub struct Sdirk<M, Eqn, LS>where
M: DenseMatrix<T = Eqn::T, V = Eqn::V>,
LS: LinearSolver<SdirkCallable<Eqn>>,
Eqn: OdeEquations,
for<'a> &'a Eqn::V: VectorRef<Eqn::V>,
for<'a> &'a Eqn::M: MatrixRef<Eqn::M>,{ /* private fields */ }
Expand description
A singly diagonally implicit Runge-Kutta method. Can optionally have an explicit first stage for ESDIRK methods.
The particular method is defined by the Tableau used to create the solver.
If the beta
matrix of the Tableau is present this is used for interpolation, otherwise hermite interpolation is used.
Restrictions:
- The upper triangular part of the
a
matrix must be zero (i.e. not fully implicit). - The diagonal of the
a
matrix must be the same non-zero value for all rows (i.e. an SDIRK method), except for the first row which can be zero for ESDIRK methods. - The last row of the
a
matrix must be the same as theb
vector, and the last element of thec
vector must be 1 (i.e. a stiffly accurate method)
Implementations§
source§impl<M, Eqn, LS> Sdirk<M, Eqn, LS>where
LS: LinearSolver<SdirkCallable<Eqn>>,
M: DenseMatrix<T = Eqn::T, V = Eqn::V>,
Eqn: OdeEquations,
for<'a> &'a Eqn::V: VectorRef<Eqn::V>,
for<'a> &'a Eqn::M: MatrixRef<Eqn::M>,
impl<M, Eqn, LS> Sdirk<M, Eqn, LS>where
LS: LinearSolver<SdirkCallable<Eqn>>,
M: DenseMatrix<T = Eqn::T, V = Eqn::V>,
Eqn: OdeEquations,
for<'a> &'a Eqn::V: VectorRef<Eqn::V>,
for<'a> &'a Eqn::M: MatrixRef<Eqn::M>,
pub fn new(tableau: Tableau<M>, linear_solver: LS) -> Self
pub fn get_statistics(&self) -> &BdfStatistics<Eqn::T>
Trait Implementations§
source§impl<M, Eqn, LS> OdeSolverMethod<Eqn> for Sdirk<M, Eqn, LS>where
LS: LinearSolver<SdirkCallable<Eqn>>,
M: DenseMatrix<T = Eqn::T, V = Eqn::V>,
Eqn: OdeEquations,
for<'a> &'a Eqn::V: VectorRef<Eqn::V>,
for<'a> &'a Eqn::M: MatrixRef<Eqn::M>,
impl<M, Eqn, LS> OdeSolverMethod<Eqn> for Sdirk<M, Eqn, LS>where
LS: LinearSolver<SdirkCallable<Eqn>>,
M: DenseMatrix<T = Eqn::T, V = Eqn::V>,
Eqn: OdeEquations,
for<'a> &'a Eqn::V: VectorRef<Eqn::V>,
for<'a> &'a Eqn::M: MatrixRef<Eqn::M>,
source§fn problem(&self) -> Option<&OdeSolverProblem<Eqn>>
fn problem(&self) -> Option<&OdeSolverProblem<Eqn>>
Get the current problem if it has been set
source§fn order(&self) -> usize
fn order(&self) -> usize
Get the current order of accuracy of the solver (e.g. explict euler method is first-order)
source§fn take_state(&mut self) -> Option<OdeSolverState<Eqn::V>>
fn take_state(&mut self) -> Option<OdeSolverState<Eqn::V>>
Take the current state of the solver, if it exists, returning it to the user. This is useful if you want to use this
state in another solver or problem. Note that this will unset the current problem and solver state, so you will need to call
set_problem
again before calling step
or solve
.source§fn set_problem(
&mut self,
state: OdeSolverState<Eqn::V>,
problem: &OdeSolverProblem<Eqn>
)
fn set_problem( &mut self, state: OdeSolverState<Eqn::V>, problem: &OdeSolverProblem<Eqn> )
Set the problem to solve, this performs any initialisation required by the solver. Call this before calling
step
or solve
.
The solver takes ownership of the initial state given by state
, this is assumed to be consistent with any algebraic constraints,
and the time step h
is assumed to be set appropriately for the problemsource§fn step(&mut self) -> Result<OdeSolverStopReason<Eqn::T>>
fn step(&mut self) -> Result<OdeSolverStopReason<Eqn::T>>
Step the solution forward by one step, altering the internal state of the solver.
The return value is a
Result
containing the reason for stopping the solver, possible reasons are: Read moresource§fn set_stop_time(&mut self, tstop: <Eqn as OdeEquations>::T) -> Result<()>
fn set_stop_time(&mut self, tstop: <Eqn as OdeEquations>::T) -> Result<()>
Set a stop time for the solver. The solver will stop when the internal time reaches this time.
Once it stops, the stop time is unset. If
tstop
is at or before the current internal time, an error is returned.source§fn interpolate_sens(
&self,
t: <Eqn as OdeEquations>::T
) -> Result<Vec<<Eqn as OdeEquations>::V>>
fn interpolate_sens( &self, t: <Eqn as OdeEquations>::T ) -> Result<Vec<<Eqn as OdeEquations>::V>>
Interpolate the sensitivity vectors at a given time. This time should be between the current time and the last solver time step
source§fn interpolate(&self, t: Eqn::T) -> Result<Eqn::V>
fn interpolate(&self, t: Eqn::T) -> Result<Eqn::V>
Interpolate the solution at a given time. This time should be between the current time and the last solver time step
source§fn state(&self) -> Option<&OdeSolverState<Eqn::V>>
fn state(&self) -> Option<&OdeSolverState<Eqn::V>>
Get the current state of the solver, if it exists
source§fn state_mut(&mut self) -> Option<&mut OdeSolverState<Eqn::V>>
fn state_mut(&mut self) -> Option<&mut OdeSolverState<Eqn::V>>
Get a mutable reference to the current state of the solver, if it exists
Note that calling this will cause the next call to
step
to perform some reinitialisation to take into
account the mutated state, this could be expensive for multi-step methods.Auto Trait Implementations§
impl<M, Eqn, LS> !Freeze for Sdirk<M, Eqn, LS>
impl<M, Eqn, LS> !RefUnwindSafe for Sdirk<M, Eqn, LS>
impl<M, Eqn, LS> !Send for Sdirk<M, Eqn, LS>
impl<M, Eqn, LS> !Sync for Sdirk<M, Eqn, LS>
impl<M, Eqn, LS> Unpin for Sdirk<M, Eqn, LS>where
&'a <Eqn as OdeEquations>::M: for<'a, 'a> Sized,
&'a <Eqn as OdeEquations>::V: for<'a, 'a, 'b> Sized,
M: Unpin,
<Eqn as OdeEquations>::T: Unpin,
<Eqn as OdeEquations>::V: Unpin,
LS: Unpin,
<<Eqn as OdeEquations>::M as Matrix>::Sparsity: Unpin,
<Eqn as OdeEquations>::M: Unpin,
impl<M, Eqn, LS> !UnwindSafe for Sdirk<M, Eqn, LS>
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 moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.