CppNoddy  0.92
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CppNoddy::Example::nonlinear Class Reference
Inheritance diagram for CppNoddy::Example::nonlinear:
CppNoddy::Equation_3matrix< double > CppNoddy::Equation_3matrix< double > CppNoddy::Equation_2matrix< _Type, _Xtype > CppNoddy::Equation_2matrix< _Type, _Xtype > CppNoddy::Equation_1matrix< _Type, _Xtype > CppNoddy::Equation_1matrix< _Type, _Xtype > CppNoddy::Residual_with_coords< _Type, _Xtype > CppNoddy::Residual_with_coords< _Type, _Xtype > CppNoddy::Residual< _Type > CppNoddy::Residual< _Type >

Public Member Functions

 nonlinear ()
 The problem is 2nd order and real. More...
 
void residual_fn (const DenseVector< double > &z, DenseVector< double > &f) const
 Define a nonlinear advection diffusion problem. More...
 
void matrix0 (const DenseVector< double > &z, DenseMatrix< double > &m) const
 Define the BVP terms. More...
 
void matrix1 (const DenseVector< double > &z, DenseMatrix< double > &m) const
 Define the unsteady terms by providing the mass matrix for t evolution. More...
 
void matrix2 (const DenseVector< double > &z, DenseMatrix< double > &m) const
 Define the unsteady terms by providing the mass matrix for x evolution. More...
 
void jacobian (const DenseVector< double > &z, DenseMatrix< double > &jac) const
 Provide the exact Jacobian rather than using finite-differences. More...
 
void get_jacobian_of_matrix0_mult_vector (const DenseVector< double > &state, const DenseVector< double > &vec, DenseMatrix< double > &h) const
 
void get_jacobian_of_matrix1_mult_vector (const DenseVector< double > &state, const DenseVector< double > &vec, DenseMatrix< double > &h) const
 
void get_jacobian_of_matrix2_mult_vector (const DenseVector< double > &state, const DenseVector< double > &vec, DenseMatrix< double > &h) const
 Return the product of the Jacobian-of-the-matrix and a vector 'vec' when the equation has a given 'state'. More...
 
 nonlinear ()
 The problem is 2nd order and real. More...
 
void residual_fn (const DenseVector< double > &z, DenseVector< double > &f) const
 Define a nonlinear advection diffusion problem. More...
 
void matrix0 (const DenseVector< double > &z, DenseMatrix< double > &m) const
 Define the unsteady terms by providing the mass matrix for t evolution. More...
 
void matrix1 (const DenseVector< double > &z, DenseMatrix< double > &m) const
 Providing the matrix for t evolution. More...
 
void matrix2 (const DenseVector< double > &z, DenseMatrix< double > &m) const
 Providing the matrix for x evolution. More...
 
- Public Member Functions inherited from CppNoddy::Equation_3matrix< double >
 Equation_3matrix (const unsigned &order)
 Constructor for equation class. More...
 
virtual ~Equation_3matrix ()
 An empty destructor, virtual since we have virtual methods. More...
 
void update (const DenseVector< double > &state)
 Update the Equation object for the current set of state variables. More...
 
const DenseMatrix< double > & matrix2 () const
 Return a handle to the matrix member data. More...
 
virtual void get_jacobian_of_matrix2_mult_vector (const DenseVector< double > &state, const DenseVector< double > &vec, DenseMatrix< double > &h) const
 Return the product of the Jacobian-of-the-matrix and a vector 'vec' when the equation has a given 'state'. More...
 
- Public Member Functions inherited from CppNoddy::Equation_2matrix< _Type, _Xtype >
 Equation_2matrix (const unsigned &order)
 Constructor for equation class. More...
 
virtual ~Equation_2matrix ()
 An empty destructor, virtual since we have virtual methods. More...
 
void update (const DenseVector< _Type > &state)
 Update the Equation object for the current set of state variables. More...
 
const DenseMatrix< _Type > & matrix1 () const
 Return a handle to the matrix member data. More...
 
virtual void get_jacobian_of_matrix1_mult_vector (const DenseVector< _Type > &state, const DenseVector< _Type > &vec, DenseMatrix< _Type > &h) const
 Return the product of the Jacobian-of-the-matrix and a vector 'vec' when the equation has a given 'state'. More...
 
- Public Member Functions inherited from CppNoddy::Equation_1matrix< _Type, _Xtype >
 Equation_1matrix (const unsigned &order)
 Constructor for equation class. More...
 
virtual ~Equation_1matrix ()
 An empty destructor, virtual since we have virtual methods. More...
 
void update (const DenseVector< _Type > &state)
 Update the Equation object for the current set of state variables. More...
 
const DenseMatrix< _Type > & matrix0 () const
 Return a handle to the matrix. More...
 
virtual void get_jacobian_of_matrix0_mult_vector (const DenseVector< _Type > &state, const DenseVector< _Type > &vec, DenseMatrix< _Type > &h) const
 Return the product of the Jacobian-of-the-matrix and a vector 'vec' when the equation has a given 'state'. More...
 
- Public Member Functions inherited from CppNoddy::Residual_with_coords< _Type, _Xtype >
 Residual_with_coords (const unsigned &order, const unsigned &ncoords)
 Constructor for a 'square' residual object that is, N residuals for N unknowns. More...
 
 Residual_with_coords (const unsigned &order, const unsigned &nvars, const unsigned &ncoords)
 Constructor for a 'non-square' residual object that is, there are less residual constraints than unknowns. More...
 
virtual ~Residual_with_coords ()
 An empty destructor. More...
 
_Xtype & coord (const unsigned &i)
 General handle access to the coordinates. More...
 
const _Xtype & coord (const unsigned &i) const
 General handle access to the coordinates. More...
 
- Public Member Functions inherited from CppNoddy::Residual< _Type >
 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< _Type > &state)
 Update the Residual object for the current set of state variables. More...
 
const DenseVector< _Type > & residual () const
 Return a handle to the residuals corresponding to the last update state. More...
 
const DenseMatrix< _Type > & jacobian () const
 Retrun a handle to the Jacobian of the residual corresponding to the last update state. More...
 
_Type & delta ()
 
const _Type & 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< _Type > &state, DenseVector< _Type > &f) const
 A blank virtual residual function method. More...
 

Additional Inherited Members

virtual void matrix2 (const DenseVector< double > &state, DenseMatrix< double > &m) const
 Define the matrix for the current state vector. More...
 
- Protected Member Functions inherited from CppNoddy::Equation_2matrix< _Type, _Xtype >
virtual void matrix1 (const DenseVector< _Type > &state, DenseMatrix< _Type > &m) const
 Define the matrix in terms of the current state vector. More...
 
- Protected Member Functions inherited from CppNoddy::Equation_1matrix< _Type, _Xtype >
virtual void matrix0 (const DenseVector< _Type > &x, DenseMatrix< _Type > &m) const
 Define the matrix in terms of the current state vector. More...
 
- Protected Member Functions inherited from CppNoddy::Residual< _Type >
virtual void jacobian (const DenseVector< _Type > &state, DenseMatrix< _Type > &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_with_coords< _Type, _Xtype >
std::vector< _Xtype > coords
 The coordinates stored for this residual. More...
 
- Protected Attributes inherited from CppNoddy::Residual< _Type >
DenseMatrix< _Type > JAC_AT_LAST_STATE
 Jacobian for the last state vector. More...
 
DenseVector< _Type > FN_AT_LAST_STATE
 Residual for the last state vector. More...
 
DenseVector< _Type > LAST_STATE
 The last state vector. More...
 
_Type 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

Definition at line 33 of file IBVPNonlinearFast.cpp.

Constructor & Destructor Documentation

◆ nonlinear() [1/2]

CppNoddy::Example::nonlinear::nonlinear ( )
inline

The problem is 2nd order and real.

Definition at line 37 of file IBVPNonlinearFast.cpp.

An equation object base class used in the PDE_double_IBVP class.

◆ nonlinear() [2/2]

CppNoddy::Example::nonlinear::nonlinear ( )
inline

The problem is 2nd order and real.

Definition at line 35 of file IBVPNonlinearSlower.cpp.

Member Function Documentation

◆ get_jacobian_of_matrix0_mult_vector()

void CppNoddy::Example::nonlinear::get_jacobian_of_matrix0_mult_vector ( const DenseVector< double > &  state,
const DenseVector< double > &  vec,
DenseMatrix< double > &  h 
) const
inline

Definition at line 75 of file IBVPNonlinearFast.cpp.

76 {
77 // constant matrix
78 }

◆ get_jacobian_of_matrix1_mult_vector()

void CppNoddy::Example::nonlinear::get_jacobian_of_matrix1_mult_vector ( const DenseVector< double > &  state,
const DenseVector< double > &  vec,
DenseMatrix< double > &  h 
) const
inline

Definition at line 79 of file IBVPNonlinearFast.cpp.

80 {
81 h( 1, U ) = - vec[ 0 ];
82 }
@ U
Definition: BVPKarman.cpp:20

References h, and U.

◆ get_jacobian_of_matrix2_mult_vector()

void CppNoddy::Example::nonlinear::get_jacobian_of_matrix2_mult_vector ( const DenseVector< double > &  state,
const DenseVector< double > &  vec,
DenseMatrix< double > &  h 
) const
inlinevirtual

Return the product of the Jacobian-of-the-matrix and a vector 'vec' when the equation has a given 'state'.

The user should overload this if concerned about performance of the solver. If not overloaded, the default is to finite difference the Jacobian-of-the-matrix.

Parameters
stateThe current state variables – used for clarity when overloaded by the user instead of expecting the user to access the member data.
vecThe vector that will be multiplied by the Jacobian-of-the-matrix
hThe resulting 2D matrix

Reimplemented from CppNoddy::Equation_3matrix< double >.

Definition at line 83 of file IBVPNonlinearFast.cpp.

84 {
85 // constant matrix
86 }

◆ jacobian()

void CppNoddy::Example::nonlinear::jacobian ( const DenseVector< double > &  z,
DenseMatrix< double > &  jac 
) const
inline

Provide the exact Jacobian rather than using finite-differences.

Definition at line 71 of file IBVPNonlinearFast.cpp.

72 {
73 jac( 0, Ud ) = 1.0;
74 }
@ Ud
Definition: BVPKarman.cpp:20

References Ud.

◆ matrix0() [1/2]

void CppNoddy::Example::nonlinear::matrix0 ( const DenseVector< double > &  z,
DenseMatrix< double > &  m 
) const
inline

Define the BVP terms.

Definition at line 49 of file IBVPNonlinearFast.cpp.

50 {
52 }
void fill_identity(CppNoddy::Sequential_Matrix_base< _Type > &A)
Fill diagonal with unit values.
Definition: Utils_Fill.h:22

References Utils_Fill::fill_identity(), and m.

◆ matrix0() [2/2]

void CppNoddy::Example::nonlinear::matrix0 ( const DenseVector< double > &  z,
DenseMatrix< double > &  m 
) const
inline

Define the unsteady terms by providing the mass matrix for t evolution.

Definition at line 46 of file IBVPNonlinearSlower.cpp.

47 {
49 }

References Utils_Fill::fill_identity(), and m.

◆ matrix1() [1/2]

void CppNoddy::Example::nonlinear::matrix1 ( const DenseVector< double > &  z,
DenseMatrix< double > &  m 
) const
inline

Define the unsteady terms by providing the mass matrix for t evolution.

Definition at line 55 of file IBVPNonlinearFast.cpp.

56 {
57 // eqn 1 variable 0
58 m( 1, 0 ) = -1.0;
59 }

References m.

◆ matrix1() [2/2]

void CppNoddy::Example::nonlinear::matrix1 ( const DenseVector< double > &  z,
DenseMatrix< double > &  m 
) const
inline

Providing the matrix for t evolution.

Definition at line 52 of file IBVPNonlinearSlower.cpp.

53 {
54 // eqn 1 variable 0
55 m( 1, 0 ) = -1.0;
56 }

References m.

◆ matrix2() [1/2]

void CppNoddy::Example::nonlinear::matrix2 ( const DenseVector< double > &  z,
DenseMatrix< double > &  m 
) const
inlinevirtual

Define the unsteady terms by providing the mass matrix for x evolution.

Reimplemented from CppNoddy::Equation_3matrix< double >.

Definition at line 62 of file IBVPNonlinearFast.cpp.

63 {
64 // eqn 1 variable 0
65 m( 1, 0 ) = -z[ U ];
66 }

References m, U, and CppNoddy::Example::z().

◆ matrix2() [2/2]

void CppNoddy::Example::nonlinear::matrix2 ( const DenseVector< double > &  z,
DenseMatrix< double > &  m 
) const
inlinevirtual

Providing the matrix for x evolution.

Reimplemented from CppNoddy::Equation_3matrix< double >.

Definition at line 59 of file IBVPNonlinearSlower.cpp.

60 {
61 // eqn 1 variable 0
62 m( 1, 0 ) = -z[ U ];
63 }

References m, U, and CppNoddy::Example::z().

◆ residual_fn() [1/2]

void CppNoddy::Example::nonlinear::residual_fn ( const DenseVector< double > &  z,
DenseVector< double > &  f 
) const
inline

Define a nonlinear advection diffusion problem.

Definition at line 40 of file IBVPNonlinearFast.cpp.

41 {
42 // The system
43 f[ U ] = z[ Ud ];
44 // x,y,t
45 f[ Ud ] = source( coord(2), coord(0), coord(1) );
46 }
@ f
Definition: BVPBerman.cpp:15
_Xtype & coord(const unsigned &i)
General handle access to the coordinates.
double source(const double &x, const double &y, const double &t)
Definition: IBVPLinear.cpp:26

References CppNoddy::Residual_with_coords< _Type, _Xtype >::coord(), f, CppNoddy::Example::source(), U, Ud, and CppNoddy::Example::z().

◆ residual_fn() [2/2]

void CppNoddy::Example::nonlinear::residual_fn ( const DenseVector< double > &  z,
DenseVector< double > &  f 
) const
inline

Define a nonlinear advection diffusion problem.

Definition at line 38 of file IBVPNonlinearSlower.cpp.

39 {
40 // The system
41 f[ U ] = z[ Ud ];
42 f[ Ud ] = source( coord(2), coord(0), coord(1) );
43 }

References CppNoddy::Residual_with_coords< _Type, _Xtype >::coord(), f, CppNoddy::Example::source(), U, Ud, and CppNoddy::Example::z().


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

© 2012

R.E. Hewitt