22#include "../Utils_Fill.h"
58 class Harmonic_left_BC :
public Residual<D_complex>
66 B[ 1 ] =
z[
fd ] - 1.0;
70 class Harmonic_right_BC :
public Residual<D_complex>
91 cout <<
"=== EVP: Local refinement of an eigenvalue =========\n";
94 cout <<
" Number of points : |local eigenvalue - pi^2| \n";
109 for (
unsigned i = 6; i <= 10; ++i )
112 N = unsigned( std::pow( 2.0,
double( i ) ) );
120 for (
unsigned i = 0; i < N; ++i )
122 double x = ode.
solution().coord( i );
130 double abs_error( std::abs( ode.
solution()( 1,
lambda ) - M_PI * M_PI ) );
132 cout <<
" " << N <<
" : " << abs_error <<
"\n";
133 if ( abs_error < 1.e-4 )
139 cout <<
"\033[1;31;48m * FAILED \033[0m\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 residual_fn(const DenseVector< D_complex > &z, DenseVector< D_complex > &g) const
Define the harmonic eqn.
double lambda
A parameter.
void matrix0(const DenseVector< D_complex > &z, DenseMatrix< D_complex > &m) const
matrix to multiply the BVP coordinate
Harmonic_equation()
The eqn is a 3rd order complex nonlinear ODE because the eigenvalue is an unknown.
void residual_fn(const DenseVector< D_complex > &z, DenseVector< D_complex > &B) const
A blank virtual residual function method.
void residual_fn(const DenseVector< D_complex > &z, DenseVector< D_complex > &B) const
A blank virtual residual function method.
A templated object for real/complex vector system of first-order ordinary differential equations.
void set_monitor_det(bool flag)
Set the flag that determines if the determinant will be monitored The default is to monitor.
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 > 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...
std::complex< double > D_complex
A complex double precision number using std::complex.
void fill_identity(CppNoddy::Sequential_Matrix_base< _Type > &A)
Fill diagonal with unit values.