Sandals  v0.0.0
A C++ library for ODEs/DAEs integration
Loading...
Searching...
No Matches
Sandals::Problem< Real, N, M, Integrator > Class Template Referenceabstract

Class container for an boundary value problem (BVP) of ODEs/DAEs. More...

#include <Problem.hh>

Public Types

using SystemPtr = typename Implicit<Real, N, M>::Pointer
using IntegratorPtr = std::shared_ptr<Integrator>
using SolutionPtr = std::shared_ptr<Solution<Real, N, M>>
using VectorX = typename Integrator::VectorX
using MatrixJX = typename Integrator::MatrixJX
using VectorF = typename Implicit<Real, N, M>::VectorF
using MatrixJF = typename Implicit<Real, N, M>::MatrixJF

Public Member Functions

 Problem (std::string t_name, SystemPtr t_system, IntegratorPtr t_integrator)
virtual ~Problem ()
std::string name () const
void name (std::string const t_name)
SystemPtr system ()
void system (SystemPtr t_system)
IntegratorPtr integrator ()
void integrator (IntegratorPtr t_integrator)
SolutionPtr const solution () const
bool verbose_mode ()
void verbose_mode (bool t_verbose)
void enable_verbose_mode ()
void disable_verbose_mode ()
Real tolerance ()
void tolerance (Real const t_tolerance)
Integermax_iterations ()
void max_iterations (Integer const t_max_iterations)
virtual VectorF b (VectorF const &x_ini, VectorF const &x_end) const =0
virtual MatrixJF Jb_x_ini (VectorF const &x_ini, VectorF const &x_end) const =0
virtual MatrixJF Jb_x_end (VectorF const &x_ini, VectorF const &x_end) const =0
bool single_shooting (VectorX const &t_mesh, VectorF const &ics)

Public Attributes

const Real SQRT_EPSILON {std::sqrt(EPSILON)}

Private Attributes

std::string m_name {"(undefined)"}
SystemPtr m_system
IntegratorPtr m_integrator
SolutionPtr m_solution
bool m_verbose {false}
Real m_tolerance {EPSILON_HIGH}
Integer m_max_iterations {100}

Detailed Description

template<typename Real, Integer N, Integer M, typename Integrator>
class Sandals::Problem< Real, N, M, Integrator >

Class container for an boundary value problem (BVP) of ordinary differential equations (ODEs) or differential algebraic equations (DAEs).

Template Parameters
RealThe scalar number type.
NThe dimension of the implicit ODE/DAE system.
MThe dimension of the invariants manifold.

Member Typedef Documentation

◆ IntegratorPtr

template<typename Real, Integer N, Integer M, typename Integrator>
using Sandals::Problem< Real, N, M, Integrator >::IntegratorPtr = std::shared_ptr<Integrator>

Shared pointer to a Runge-Kutta method.

◆ MatrixJF

template<typename Real, Integer N, Integer M, typename Integrator>
using Sandals::Problem< Real, N, M, Integrator >::MatrixJF = typename Implicit<Real, N, M>::MatrixJF

◆ MatrixJX

template<typename Real, Integer N, Integer M, typename Integrator>
using Sandals::Problem< Real, N, M, Integrator >::MatrixJX = typename Integrator::MatrixJX

◆ SolutionPtr

template<typename Real, Integer N, Integer M, typename Integrator>
using Sandals::Problem< Real, N, M, Integrator >::SolutionPtr = std::shared_ptr<Solution<Real, N, M>>

Shared pointer to a solution.

◆ SystemPtr

template<typename Real, Integer N, Integer M, typename Integrator>
using Sandals::Problem< Real, N, M, Integrator >::SystemPtr = typename Implicit<Real, N, M>::Pointer

Shared pointer to an ODE/DAE system.

◆ VectorF

template<typename Real, Integer N, Integer M, typename Integrator>
using Sandals::Problem< Real, N, M, Integrator >::VectorF = typename Implicit<Real, N, M>::VectorF

◆ VectorX

template<typename Real, Integer N, Integer M, typename Integrator>
using Sandals::Problem< Real, N, M, Integrator >::VectorX = typename Integrator::VectorX

Constructor & Destructor Documentation

◆ Problem()

template<typename Real, Integer N, Integer M, typename Integrator>
Sandals::Problem< Real, N, M, Integrator >::Problem ( std::string t_name,
SystemPtr t_system,
IntegratorPtr t_integrator )
inline

Class constructor for the boundary value problem (BVP).

Parameters
[in]t_nameThe name of the problem.
[in]t_systemThe ODE/DAE system shared pointer.
[in]t_integratorThe integrator shared pointer.

◆ ~Problem()

template<typename Real, Integer N, Integer M, typename Integrator>
virtual Sandals::Problem< Real, N, M, Integrator >::~Problem ( )
inlinevirtual

Class destructor.

Member Function Documentation

◆ b()

template<typename Real, Integer N, Integer M, typename Integrator>
virtual VectorF Sandals::Problem< Real, N, M, Integrator >::b ( VectorF const & x_ini,
VectorF const & x_end ) const
pure virtual

Evaluate the boundary conditions function of the problem \( \mathbf{b}(\mathbf{x}_{\text{ini}}, \mathbf{x}_{\text{end}}) \).

Parameters
[in]x_iniInitial states \( \mathbf{x}_{\text{ini}} \).
[in]x_endFinal states \( \mathbf{x}_{\text{end}} \).
Returns
The residual of the boundary conditions.

◆ disable_verbose_mode()

template<typename Real, Integer N, Integer M, typename Integrator>
void Sandals::Problem< Real, N, M, Integrator >::disable_verbose_mode ( )
inline

Disable the verbose mode.

◆ enable_verbose_mode()

template<typename Real, Integer N, Integer M, typename Integrator>
void Sandals::Problem< Real, N, M, Integrator >::enable_verbose_mode ( )
inline

Enable the verbose mode.

◆ integrator() [1/2]

template<typename Real, Integer N, Integer M, typename Integrator>
IntegratorPtr Sandals::Problem< Real, N, M, Integrator >::integrator ( )
inline

Get the integrator pointer.

Returns
The integrator pointer.

◆ integrator() [2/2]

template<typename Real, Integer N, Integer M, typename Integrator>
void Sandals::Problem< Real, N, M, Integrator >::integrator ( IntegratorPtr t_integrator)
inline

Set the integrator pointer.

Parameters
[in]t_integratorThe integrator pointer.

◆ Jb_x_end()

template<typename Real, Integer N, Integer M, typename Integrator>
virtual MatrixJF Sandals::Problem< Real, N, M, Integrator >::Jb_x_end ( VectorF const & x_ini,
VectorF const & x_end ) const
pure virtual

Evaluate the Jacobian of the boundary conditions function \( \mathbf{b}(\mathbf{x}_{\text{ini}}, \mathbf{x}_{\text{end}}) \) with respect to the final states \( \mathbf{x}_{\text{end}} \).

Parameters
[in]x_iniInitial states \( \mathbf{x}_{\text{ini}} \).
[in]x_endFinal states \( \mathbf{x}_{\text{end}} \).
Returns
The Jacobian \( \mathbf{Jb}_{\mathbf{x}_{\text{end}}}(\mathbf{x}_{\text{ini}}, \mathbf{x}_{\text{end}}) \).

◆ Jb_x_ini()

template<typename Real, Integer N, Integer M, typename Integrator>
virtual MatrixJF Sandals::Problem< Real, N, M, Integrator >::Jb_x_ini ( VectorF const & x_ini,
VectorF const & x_end ) const
pure virtual

Evaluate the Jacobian of the boundary conditions function \( \mathbf{b}(\mathbf{x}_{\text{ini}}, \mathbf{x}_{\text{end}}) \) with respect to the initial states \( \mathbf{x}_{\text{ini}} \).

Parameters
[in]x_iniInitial states \( \mathbf{x}_{\text{ini}} \).
[in]x_endFinal states \( \mathbf{x}_{\text{end}} \).
Returns
The Jacobian \( \mathbf{Jb}_{\mathbf{x}_{\text{ini}}}(\mathbf{x}_{\text{ini}}, \mathbf{x}_{\text{end}}) \).

◆ max_iterations() [1/2]

template<typename Real, Integer N, Integer M, typename Integrator>
Integer & Sandals::Problem< Real, N, M, Integrator >::max_iterations ( )
inline

Get the maximum number of iterations.

Returns
The maximum number of iterations.

◆ max_iterations() [2/2]

template<typename Real, Integer N, Integer M, typename Integrator>
void Sandals::Problem< Real, N, M, Integrator >::max_iterations ( Integer const t_max_iterations)
inline

Set the maximum number of iterations.

Parameters
[in]t_max_iterationsThe maximum number of iterations.

◆ name() [1/2]

template<typename Real, Integer N, Integer M, typename Integrator>
std::string Sandals::Problem< Real, N, M, Integrator >::name ( ) const
inline

Get the name of the problem.

Returns
The name of the problem.

◆ name() [2/2]

template<typename Real, Integer N, Integer M, typename Integrator>
void Sandals::Problem< Real, N, M, Integrator >::name ( std::string const t_name)
inline

Set the name of the problem.

Parameters
[in]t_nameThe name of the problem.

◆ single_shooting()

template<typename Real, Integer N, Integer M, typename Integrator>
bool Sandals::Problem< Real, N, M, Integrator >::single_shooting ( VectorX const & t_mesh,
VectorF const & ics )
inline

Solve the boundary value problem (BVP) using the Runge-Kutta method uning a single shooting method.

Parameters
[in]t_meshIndependent variable (or time) mesh \( \mathbf{t} \).
[in]icsInitial conditions \( \mathbf{x}(t = 0) \).
[out]solThe solution of the system over the mesh of independent variable.
Returns
True if the system is successfully solved, false otherwise.
Warning
Do not use the solution for internal backtracking, as the step callback may directly modify the solution.

◆ solution()

template<typename Real, Integer N, Integer M, typename Integrator>
SolutionPtr const Sandals::Problem< Real, N, M, Integrator >::solution ( ) const
inline

Get the solution pointer.

Returns
The solution pointer.

◆ system() [1/2]

template<typename Real, Integer N, Integer M, typename Integrator>
SystemPtr Sandals::Problem< Real, N, M, Integrator >::system ( )
inline

Get the ODE/DAE system pointer.

Returns
The ODE/DAE system pointer.

◆ system() [2/2]

template<typename Real, Integer N, Integer M, typename Integrator>
void Sandals::Problem< Real, N, M, Integrator >::system ( SystemPtr t_system)
inline

Set the ODE/DAE system pointer.

Parameters
[in]t_systemThe ODE/DAE system pointer.

◆ tolerance() [1/2]

template<typename Real, Integer N, Integer M, typename Integrator>
Real Sandals::Problem< Real, N, M, Integrator >::tolerance ( )
inline

Get the solution tolerance.

Returns
The solution tolerance.

◆ tolerance() [2/2]

template<typename Real, Integer N, Integer M, typename Integrator>
void Sandals::Problem< Real, N, M, Integrator >::tolerance ( Real const t_tolerance)
inline

Set the solution tolerance.

Parameters
[in]t_toleranceThe solution tolerance.

◆ verbose_mode() [1/2]

template<typename Real, Integer N, Integer M, typename Integrator>
bool Sandals::Problem< Real, N, M, Integrator >::verbose_mode ( )
inline

Get the verbose mode.

Returns
The verbose mode.

◆ verbose_mode() [2/2]

template<typename Real, Integer N, Integer M, typename Integrator>
void Sandals::Problem< Real, N, M, Integrator >::verbose_mode ( bool t_verbose)
inline

Set the verbose mode.

Parameters
[in]t_verboseThe verbose mode.

Member Data Documentation

◆ m_integrator

template<typename Real, Integer N, Integer M, typename Integrator>
IntegratorPtr Sandals::Problem< Real, N, M, Integrator >::m_integrator
private

Runge-Kutta method.

◆ m_max_iterations

template<typename Real, Integer N, Integer M, typename Integrator>
Integer Sandals::Problem< Real, N, M, Integrator >::m_max_iterations {100}
private

Maximum number of iterations.

◆ m_name

template<typename Real, Integer N, Integer M, typename Integrator>
std::string Sandals::Problem< Real, N, M, Integrator >::m_name {"(undefined)"}
private

Name of the problem.

◆ m_solution

template<typename Real, Integer N, Integer M, typename Integrator>
SolutionPtr Sandals::Problem< Real, N, M, Integrator >::m_solution
private

Solution of the problem.

◆ m_system

template<typename Real, Integer N, Integer M, typename Integrator>
SystemPtr Sandals::Problem< Real, N, M, Integrator >::m_system
private

ODE/DAE system.

◆ m_tolerance

template<typename Real, Integer N, Integer M, typename Integrator>
Real Sandals::Problem< Real, N, M, Integrator >::m_tolerance {EPSILON_HIGH}
private

Tolerance for the solution.

◆ m_verbose

template<typename Real, Integer N, Integer M, typename Integrator>
bool Sandals::Problem< Real, N, M, Integrator >::m_verbose {false}
private

Verbose mode boolean.

◆ SQRT_EPSILON

template<typename Real, Integer N, Integer M, typename Integrator>
const Real Sandals::Problem< Real, N, M, Integrator >::SQRT_EPSILON {std::sqrt(EPSILON)}

< Basic constants. Square root of machine epsilon epsilon static constant value.


The documentation for this class was generated from the following file: