16#include "../Utils_Fill.h"
47 jac( 1,
U ) = 2 *
z[
U ];
48 jac( 1,
Ud ) =
z[
V ];
49 jac( 1,
V ) =
z[
Ud ];
50 jac( 1,
W ) = -2 *
z[
W ];
53 jac( 4,
U ) = 2 *
z[
W ];
54 jac( 4,
V ) =
z[
Wd ];
55 jac( 4,
W ) = 2 *
z[
U ];
56 jac( 4,
Wd ) =
z[
V ];
65 class Karman_left_BC :
public Residual<double>
75 B[ 2 ] =
z[
W ] - 1.0;
79 class Karman_right_BC :
public Residual<double>
102 cout <<
"=== BVP: Karman equations with analytic Jacobian ====\n";
121 for (
int i = 0; i < N; ++i )
123 double y = ode.
solution().coord( i );
135 catch (
const std::runtime_error &error )
137 cout <<
" \033[1;31;48m * FAILED THROUGH EXCEPTION BEING RAISED \033[0m\n";
141 const double tol( 1.e-4 );
143 if ( abs( ode.
solution()( N - 1,
V ) + 0.88447 ) > tol )
145 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
146 cout <<
" Difference = " << abs( ode.
solution()( N - 1,
V ) + 0.88447 ) <<
"\n";
151 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 Karman equations.
Karman_equations()
The Karman system is a 5th order real system of ODEs.
void jacobian(const DenseVector< double > &z, DenseMatrix< double > &jac) const
Provide the exact Jacobian of above RHS rather than using finite-differences.
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 > &f) const
Define the Karman system.
Define the boundary conditions.
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.
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.