27 f[ 0 ] =
a * (
z[ 1 ] -
z[ 0 ] );
28 f[ 1 ] =
z[ 0 ] * (
b -
z[ 2 ] ) -
z[ 1 ];
29 f[ 2 ] = -
c *
z[ 2 ] +
z[ 0 ] *
z[ 1 ];
45 cout <<
"=== IVP: integrating the Lorenz system ==============\n";
47 cout <<
" Running shoot method - fixed step choice \n";
54 const int num_of_steps( 5000000 );
59 problem.
c = 8.0 / 3.0;
65 const double tol = 1.e-7;
76 catch (
const std::runtime_error &error )
78 cout <<
" \033[1;31;48m * FAILED THROUGH EXCEPTION BEING RAISED \033[0m\n";
91 if ( abs(
u[ 0 ] - 4.0 ) > tol )
93 cout <<
" Difference = " << abs(
u[ 0 ] - 4.0 ) <<
"\n";
94 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
98 cout <<
"\033[1;32;48m * PASSED \033[0m\n";
100 ode.
get_mesh().dump_gnu(
"./DATA/test.dat");
A shorter bundled include file for initial-value problems.
An DenseVector class – a dense vector object.
An equation object base class used in the BVP/IVP classes.
Define the Lorenz equations by inheriting Equation base class.
double a
The usual 3 parameters of the Lorenz eqns.
void residual_fn(const DenseVector< double > &z, DenseVector< double > &f) const
We implement the equation as 3 first-order ODEs.
Lorenz_equations()
Construct a 3rd order ODE.
A templated object for real/complex vector system of first-order ordinary differential equations.
OneD_Node_Mesh< _Type > & get_mesh()
Return the history of the stepped solution.
unsigned & store_every()
Return a handle to the STORE_EVERY object.
DenseVector< _Type > shoot45(DenseVector< _Type > u, const double &tol, const double &h_init)
A Runge-Kutta-Fehlberg integrator.
A simple CPU-clock-tick timer for timing metods.
double get_time() const
Return the time.
void start()
Start the timer & reset stored time to zero.
int & counter()
Increment an internal discrete counter.
void print() const
Write a string to cout stating the time taken.
void stop()
Stop the clock & add the current time interval to the previously stored values ready for printing.
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...