23 template <
typename _Type,
typename _Xtype>
36 const double y(
this ->
coord(0) );
49 template <
typename _Type>
61 template <
typename _Type>
83 cout <<
"=== BVP: finite-difference, non-identity matrix0 ====\n";
87 Example::Nonidentity_left_BC <double> BC_left;
97 const double tol = 1.e-4;
104 for (
unsigned i = 0; i < N; ++i )
106 double y = ode.
solution().coord( i );
118 catch (
const std::runtime_error& error )
120 cout <<
" \033[1;31;48m * FAILED THROUGH EXCEPTION BEING RAISED \033[0m\n";
127 for (
unsigned i = 0; i < N; ++i )
129 const double y( ode.
solution().coord(i) );
130 const double exact( sqrt(y*y + problem.
gamma*y*y*y/3 + (2-problem.
gamma/3)*y + 1) );
131 diff = std::max( std::abs( ode.
solution().get_interpolated_vars(y)[
f] - exact ), diff );
137 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
138 cout <<
"Real problem error " << diff <<
"\n";
143 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 harmonic equation by inheriting the Equation base class.
void matrix0(const DenseVector< _Type > &z, DenseMatrix< _Type > &m) const
Define the matrix in terms of the current state vector.
Nonidentity_equation()
The harmonic equation is a 2nd order ODE.
void residual_fn(const DenseVector< _Type > &z, DenseVector< _Type > &g) const
The Berman equation.
void residual_fn(const DenseVector< _Type > &z, DenseVector< _Type > &B) const
A blank virtual residual function method.
void residual_fn(const DenseVector< _Type > &z, DenseVector< _Type > &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.
_Xtype & coord(const unsigned &i)
General handle access to the coordinates.
A base class to be inherited by objects that define residuals.
double g(1.0)
gravitational acceleration
DenseVector< double > uniform_node_vector(const double &lower, const double &upper, const std::size_t &N)
Return a DENSE vector with the nodal points of a uniform mesh distributed between the upper/lower bou...
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...