CppNoddy  0.92
Loading...
Searching...
No Matches
ODE_IVP.h
Go to the documentation of this file.
1/// \file ODE_IVP.h
2/// A specification for a class to solve initial value problems of the form
3/// \f[ \underline{ \dot f} (t) = \underline R ( \underline f (t), t) \,, \f]
4/// where \f$ \underline f (0) \f$ is known.
5
6#ifndef ODE_IVP_H
7#define ODE_IVP_H
8
9#include <Types.h>
10#include <Equation.h>
11#include <OneD_Node_Mesh.h>
12#include <Uncopyable.h>
13
14namespace CppNoddy {
15
16 /// A templated object for real/complex vector system
17 /// of first-order ordinary differential equations.
18
19 template <typename _Type>
20 class ODE_IVP : private Uncopyable {
21 public:
22
23 /// The class is defined by a vector function for the system.
24 /// \param equation_ptr A pointer to an inherited Equation object.
25 /// \param x_init The starting point of the domain for the ODE.
26 /// \param x_final The end point of the domain for the ODE.
27 /// \param num_of_steps A maximum/default number of steps to be taken.
28 ODE_IVP(Equation<_Type > *equation_ptr,
29 const double &x_init,
30 const double &x_final,
31 const std::size_t &num_of_steps);
32
33 ~ODE_IVP();
34
35 /// A fixed step 4th order Runge-Kutta method.
36 /// \param u An NVector of initial values.
37 /// \return An NVector of the final values.
39
40 /// A Runge-Kutta-Fehlberg integrator.
41 /// \param u An Nvector of initial values.
42 /// \param tol The tolerance used in choosing the step length.
43 /// \param h_init The initial step length.
44 /// \return An NVector of the final values.
45 DenseVector<_Type> shoot45(DenseVector<_Type> u, const double& tol, const double& h_init);
46
47 /// Return the history of the stepped solution.
48 /// \return A reference to the mesh solution
50
51 /// Return a handle to the STORE_EVERY object
52 /// \return A reference to the STORE_EVERY variable
53 unsigned& store_every();
54
55 private:
56
57 /// initial and final step points
58 double X_INIT, X_FINAL;
59 /// initial step size
60 double H_INIT;
61 /// maximum number of steps to take
62 std::size_t N;
63 /// The function associated with this instance.
64 Equation<_Type > *p_EQUATION;
65 /// Store every
66 unsigned STORE_EVERY;
67 /// In-class storage of the solution
69 }
70 ; // end class
71
72
73} // end namespace
74
75
76#endif
77
A templated class for equations that can be inherited from to allow instantiation of ODE/PDE objects ...
A specification for a one dimensional mesh object.
Some standard typedefs.
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
An equation object base class used in the BVP/IVP classes.
Definition: Equation.h:22
A templated object for real/complex vector system of first-order ordinary differential equations.
Definition: ODE_IVP.h:20
OneD_Node_Mesh< _Type > & get_mesh()
Return the history of the stepped solution.
Definition: ODE_IVP.cpp:242
unsigned & store_every()
Return a handle to the STORE_EVERY object.
Definition: ODE_IVP.cpp:247
DenseVector< _Type > shoot4(DenseVector< _Type > u)
A fixed step 4th order Runge-Kutta method.
Definition: ODE_IVP.cpp:36
DenseVector< _Type > shoot45(DenseVector< _Type > u, const double &tol, const double &h_init)
A Runge-Kutta-Fehlberg integrator.
Definition: ODE_IVP.cpp:95
A one dimensional mesh utility object.
An object to block copying.
Definition: Uncopyable.h:8
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...

© 2012

R.E. Hewitt