CppNoddy  0.92
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
CppNoddy::Example::Berman_residual Class Reference

Define a residual function using the boundary conditions for the Berman equation. More...

Inheritance diagram for CppNoddy::Example::Berman_residual:
CppNoddy::Residual< double >

Public Member Functions

 Berman_residual ()
 
 ~Berman_residual ()
 
void residual_fn (const DenseVector< double > &unknown, DenseVector< double > &BC) const
 implement a residual function. More...
 
- Public Member Functions inherited from CppNoddy::Residual< double >
 Residual (const unsigned &order)
 Constructor for a 'square' residual object that is, N residuals for N unknowns. More...
 
 Residual (const unsigned &order, const unsigned &nvars)
 Constructor for a 'non-square' residual object that is, there are less residual constraints than unknowns. More...
 
virtual ~Residual ()
 An empty destructor, virtual since we have virtual methods. More...
 
void update (const DenseVector< double > &state)
 Update the Residual object for the current set of state variables. More...
 
const DenseVector< double > & residual () const
 Return a handle to the residuals corresponding to the last update state. More...
 
const DenseMatrix< double > & jacobian () const
 Retrun a handle to the Jacobian of the residual corresponding to the last update state. More...
 
double & delta ()
 
const double & delta () const
 
unsigned get_order () const
 Get the order of the residual vector. More...
 
unsigned get_number_of_vars () const
 Get the number of variables that this residual condition is defined for. More...
 
virtual void residual_fn (const DenseVector< double > &state, DenseVector< double > &f) const
 A blank virtual residual function method. More...
 

Public Attributes

ODE_IVP< double > * ode
 

Additional Inherited Members

- Protected Member Functions inherited from CppNoddy::Residual< double >
virtual void jacobian (const DenseVector< double > &state, DenseMatrix< double > &jac) const
 Because the residual evaluation at the current state is assumed to have already been done by the 'update' method, this routine is protected. More...
 
- Protected Attributes inherited from CppNoddy::Residual< double >
DenseMatrix< double > JAC_AT_LAST_STATE
 Jacobian for the last state vector. More...
 
DenseVector< double > FN_AT_LAST_STATE
 Residual for the last state vector. More...
 
DenseVector< double > LAST_STATE
 The last state vector. More...
 
double DELTA
 A default step for FD computation of the Jacobian. More...
 
unsigned ORDER_OF_SYSTEM
 The order of the system of equations. More...
 
unsigned NUMBER_OF_VARS
 The number of elements in the state vector. More...
 

Detailed Description

Define a residual function using the boundary conditions for the Berman equation.

Definition at line 52 of file BermanShooting.cpp.

Constructor & Destructor Documentation

◆ Berman_residual()

CppNoddy::Example::Berman_residual::Berman_residual ( )
inline

Definition at line 58 of file BermanShooting.cpp.

58 : Residual<double> ( 2 )
59 {
60 // instantiate the Berman equation as our problem
61 eqn = new Berman_equation;
62 // set the Reynolds number
63 eqn -> Re = 1.0;
64 // instantiate an ODE in [-1.,1] with a maximum of
65 // 100 integrator steps, using this problem equation
66 ode = new ODE_IVP<double>( eqn, -1.0, 1.0, 500 );
67
68 }
A templated object for real/complex vector system of first-order ordinary differential equations.
Definition: ODE_IVP.h:20
A base class to be inherited by objects that define residuals.
Definition: Residual.h:15
double Re
Globally define the Reynolds number and wavenumber.

References ode, and CppNoddy::Example::Re.

◆ ~Berman_residual()

CppNoddy::Example::Berman_residual::~Berman_residual ( )
inline

Definition at line 70 of file BermanShooting.cpp.

71 {
72 delete ode;
73 delete eqn;
74 }

References ode.

Member Function Documentation

◆ residual_fn()

void CppNoddy::Example::Berman_residual::residual_fn ( const DenseVector< double > &  unknown,
DenseVector< double > &  BC 
) const
inlinevirtual

implement a residual function.

Reimplemented from CppNoddy::Residual< double >.

Definition at line 77 of file BermanShooting.cpp.

78 {
79 DenseVector<double> u( 4, 0.0 ); // 4 variables of Berman problem
80
81 u[ 0 ] = -1.0; // V = 0
82 u[ 1 ] = 0.0; // V' = 0
83 u[ 2 ] = unknown[ 0 ]; // V'' = unknown0
84 u[ 3 ] = unknown[ 1 ]; // A = unknown1
85
86 u = ode -> shoot4( u );
87
88 BC[ 0 ] = u[ 0 ] - 1.;
89 BC[ 1 ] = u[ 1 ];
90 }
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34

References ode, and u.

Member Data Documentation

◆ ode

ODE_IVP<double>* CppNoddy::Example::Berman_residual::ode

Definition at line 55 of file BermanShooting.cpp.

Referenced by Berman_residual(), main(), residual_fn(), and ~Berman_residual().


The documentation for this class was generated from the following file:

© 2012

R.E. Hewitt