OGS
|
ODE solver Interface.
This class provides an abstract interface for ODE solvers. It provides type-safe and array-bounds checked access to external ODE solver libraries. However, it is agnostic to the specific solver used.
The ODEs solved using this class are first-order ODEs that are given in explicit form, i.e.
\[ \dot y = f(t, y). \]
NumEquations | number of equations in the ODE system. |
Definition at line 37 of file ODESolver.h.
#include <ODESolver.h>
Public Member Functions | |
virtual void | setFunction (Function< NumEquations > f, JacobianFunction< NumEquations > df)=0 |
virtual void | setTolerance (const double abstol, const double reltol)=0 |
virtual void | setTolerance (const std::array< double, NumEquations > &abstol, const double reltol)=0 |
virtual void | setIC (const double t0, std::initializer_list< double > const &y0)=0 |
virtual void | setIC (const double t0, Eigen::Matrix< double, NumEquations, 1, Eigen::ColMajor > const &y0)=0 |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
virtual void | preSolve ()=0 |
virtual bool | solve (const double t)=0 |
virtual unsigned | getNumberOfEquations () const |
Returns the number of equations. | |
virtual MappedConstVector< NumEquations > | getSolution () const =0 |
Returns the solution vector y . | |
virtual double | getTime () const =0 |
virtual Eigen::Matrix< double, NumEquations, 1, Eigen::ColMajor > | getYDot (const double t, const MappedConstVector< NumEquations > &y) const =0 |
virtual | ~ODESolver ()=default |
|
virtualdefault |
|
inlinevirtual |
Returns the number of equations.
Definition at line 114 of file ODESolver.h.
|
pure virtual |
Returns the solution vector y
.
Implemented in MathLib::ODE::ConcreteODESolver< Implementation, NumEquations >.
|
pure virtual |
Returns the time that the solver has reached.
The return value should be equal to the time t
passed to solve() if everything went fine.
Implemented in MathLib::ODE::ConcreteODESolver< Implementation, NumEquations >.
|
pure virtual |
Computes \( \dot y = f(t,y) \).
This method is provided for convenience only.
Implemented in MathLib::ODE::ConcreteODESolver< Implementation, NumEquations >.
|
pure virtual |
Finishes setting up the ODE solver, makes it ready to solve the provided ODE.
This method applies settings to the ODE solver, hence it has to be called after calling setters.
Implemented in MathLib::ODE::ConcreteODESolver< Implementation, NumEquations >.
|
pure virtual |
Sets functions that compute \(\dot y\) and the Jacobian \(\partial \dot y/\partial y\).
If no Jacobian function shall be set, nullptr
can be passed for df
.
Implemented in MathLib::ODE::ConcreteODESolver< Implementation, NumEquations >.
|
pure virtual |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Implemented in MathLib::ODE::ConcreteODESolver< Implementation, NumEquations >.
|
pure virtual |
Sets the conditions.
t0 | initial time. |
y0 | initial values. |
Implemented in MathLib::ODE::ConcreteODESolver< Implementation, NumEquations >.
|
pure virtual |
Sets the tolerances for the ODE solver.
abstol | absolute tolerance, one value for all equations. |
reltol | relative tolerance. |
Implemented in MathLib::ODE::ConcreteODESolver< Implementation, NumEquations >.
|
pure virtual |
Sets the tolerances for the ODE solver.
abstol | absolute tolerance, one value each equation. |
reltol | relative tolerance. |
Implemented in MathLib::ODE::ConcreteODESolver< Implementation, NumEquations >.
|
pure virtual |
Solves the ODE from the set initial condition to time t
.
Implemented in MathLib::ODE::ConcreteODESolver< Implementation, NumEquations >.