15#include "../Utils_Fill.h"
67 B[ 0 ] =
z[
fd ] - 1.0;
80 cout <<
"=== BVP: finite-difference solution of Blasius ======\n";
83 cout <<
" Number of points : approx. error \n";
95 const double tol = 1.e-5;
98 for (
int N = 32; N <= 2048; N *= 2 )
104 for (
int i = 0; i < N; ++i )
106 double y = ode.
solution().coord( i );
107 ode.
solution()( i,
f ) = y * ( 1.0 - exp( -y ) );
108 ode.
solution()( i,
fd ) = ( 1.0 - exp( -y ) ) + y * exp( -y );
109 ode.
solution()( i,
fdd ) = 2.0 * exp( -y ) - y * exp( -y );
116 catch (
const std::runtime_error &error )
118 cout <<
" \033[1;31;48m * FAILED THROUGH EXCEPTION BEING RAISED \033[0m\n";
122 const double c = 1.65519036023e0;
123 const double answer = 1. / pow( c, 1.5 );
124 if ( abs( ode.
solution()( 0,
fdd ) - answer ) > tol )
134 std::cout <<
" N=" << N <<
" error=" << abs( ode.
solution()( 0,
fdd ) - answer ) <<
" IVP answer=" << answer <<
"\n";
136 std::string dirname(
"./DATA");
137 mkdir( dirname.c_str(), S_IRWXU );
138 ode.
solution().dump_gnu(
"./DATA/blasius.data");
144 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
149 cout <<
"\033[1;32;48m * PASSED \033[0m\n";
A shorter bundled include file for ODE_BVP and PDE_IBVP codes.
A matrix class that constructs a DENSE matrix as a row major std::vector of DenseVectors.
An DenseVector class – a dense vector object.
An equation object base class used in the IBVP classes (and others).
Define the Blasius equation by inheriting Equation base class.
Blasius_equation()
The Blasius eqn is a 3rd order real ODE.
void matrix0(const DenseVector< double > &x, DenseMatrix< double > &m) const
Define the matrix in terms of the current state vector.
void residual_fn(const DenseVector< double > &z, DenseVector< double > &g) const
Define the Blasius eqn.
void residual_fn(const DenseVector< double > &z, DenseVector< double > &B) const
A blank virtual residual function method.
void residual_fn(const DenseVector< double > &z, DenseVector< double > &B) const
A blank virtual residual function method.
A templated object for real/complex vector system of first-order ordinary differential equations.
OneD_Node_Mesh< _Type, _Xtype > & solution()
void solve2()
Formulate and solve the ODE using Newton iteration and a second-order finite difference scheme.
A base class to be inherited by objects that define residuals.
double g(1.0)
gravitational acceleration
DenseVector< double > power_node_vector(const double &lower, const double &upper, const std::size_t &N, const double &power)
Return a DENSE vector with the nodal points of a non-uniform mesh distributed between the upper/lower...
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...
void fill_identity(CppNoddy::Sequential_Matrix_base< _Type > &A)
Fill diagonal with unit values.