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

Define the system. More...

Inheritance diagram for CppNoddy::Example::NlinAdv:
CppNoddy::OneD_Hyperbolic_System CppNoddy::TwoD_Hyperbolic_System CppNoddy::TwoD_Hyperbolic_System CppNoddy::TwoD_Hyperbolic_System CppNoddy::TwoD_Hyperbolic_System CppNoddy::Uncopyable CppNoddy::Uncopyable CppNoddy::Uncopyable CppNoddy::Uncopyable CppNoddy::Uncopyable

Public Member Functions

 NlinAdv ()
 One dimemsional inviscid Burgers problem. More...
 
void flux_fn (const double &x, const DenseVector< double > &q, DenseVector< double > &f) const
 Define the vector flux. More...
 
double max_charac_speed (const DenseVector< double > &q) const
 Bound the shock speed. More...
 
std::vector< bool > edge_values (const int face_index, const double &x, DenseVector< double > &q, const double &t) const
 Define the edge boundary conditions. More...
 
 NlinAdv ()
 Two dimemsional scalar linear advection problem. More...
 
void flux_fn_x (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
 A virtual flux function for the x-derivative. More...
 
void flux_fn_y (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
 A virtual flux function for the y-derivative. More...
 
void max_charac_speed (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &c) const
 Bound the wave speed. More...
 
 NlinAdv ()
 
void flux_fn_x (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
 A virtual flux function for the x-derivative. More...
 
void flux_fn_y (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
 A virtual flux function for the y-derivative. More...
 
void max_charac_speed (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &c) const
 Bound the wave speed. More...
 
std::vector< bool > edge_values (const int &face_index, const DenseVector< double > &x, DenseVector< double > &q) const
 edge conditions More...
 
 NlinAdv ()
 One dimemsional inviscid Burgers problem. More...
 
void flux_fn_y (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
 Define the vector flux. More...
 
void flux_fn_x (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
 A virtual flux function for the x-derivative. More...
 
void max_charac_speed (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &c) const
 Bound the wave speed. More...
 
std::vector< bool > edge_values (const int &face_index, const DenseVector< double > &x, DenseVector< double > &q) const
 Define the edge boundary conditions. More...
 
 NlinAdv ()
 One dimemsional inviscid Burgers problem. More...
 
void flux_fn_x (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
 A virtual flux function for the x-derivative. More...
 
void flux_fn_y (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
 A virtual flux function for the y-derivative. More...
 
void max_charac_speed (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &c) const
 Bound the wave speed. More...
 
std::vector< bool > edge_values (const int &face_index, const DenseVector< double > &x, DenseVector< double > &q) const
 Define the edge boundary conditions. More...
 
- Public Member Functions inherited from CppNoddy::OneD_Hyperbolic_System
 OneD_Hyperbolic_System (const unsigned &order)
 
virtual ~OneD_Hyperbolic_System ()
 An empty destructor, virtual since we have virtual methods. More...
 
virtual void flux_fn (const double &x, const DenseVector< double > &q, DenseVector< double > &f) const
 A virtual flux function. More...
 
virtual void Jac_flux_fn (const double &x, const DenseVector< double > &q, DenseMatrix< double > &J) const
 A virtual function function to define the Jacobian of the flux function. More...
 
virtual double max_charac_speed (const DenseVector< double > &q) const
 A virtual method that is used to bound the shock speed and must be implemented by the user. More...
 
virtual bool_vec edge_values (const int face_index, const double &x, DenseVector< double > &q, const double &t=0.0) const
 Define the edge boundary conditions. More...
 
virtual void source_fn (const double &x, const DenseVector< double > &q, const DenseVector< double > &slope, DenseVector< double > &r) const
 
unsigned get_order ()
 
- Public Member Functions inherited from CppNoddy::TwoD_Hyperbolic_System
 TwoD_Hyperbolic_System (const unsigned &order)
 
virtual ~TwoD_Hyperbolic_System ()
 An empty destructor, virtual since we have virtual methods. More...
 
virtual void flux_fn_x (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
 A virtual flux function for the x-derivative. More...
 
virtual void flux_fn_y (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &f) const
 A virtual flux function for the y-derivative. More...
 
virtual void Jac_flux_fn_x (const DenseVector< double > &x, const DenseVector< double > &q, DenseMatrix< double > &J) const
 A virtual function function to define the Jacobian of the x-flux function. More...
 
virtual void Jac_flux_fn_y (const DenseVector< double > &x, const DenseVector< double > &q, DenseMatrix< double > &J) const
 A virtual function function to define the Jacobian of the y-flux function. More...
 
virtual void max_charac_speed (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &c) const
 A virtual method that is used to bound the characteristic speed in both directions. More...
 
virtual std::vector< bool > edge_values (const int &face_index, const DenseVector< double > &x, DenseVector< double > &q) const
 Define the edge boundary conditions. More...
 
virtual void edge_slopes (const int &face_index, const DenseVector< double > &x, DenseVector< double > &sigma_n) const
 Define the edge boundary condition slopes. More...
 
virtual void source_fn (const DenseVector< double > &x, const DenseVector< double > &q, DenseVector< double > &r) const
 
unsigned get_order ()
 

Additional Inherited Members

- Protected Attributes inherited from CppNoddy::OneD_Hyperbolic_System
const std::size_t ORDER_OF_SYSTEM
 The order of the system of equations. More...
 
- Protected Attributes inherited from CppNoddy::TwoD_Hyperbolic_System
const unsigned ORDER_OF_SYSTEM
 The order of the system of equations. More...
 

Detailed Description

Define the system.

Definition at line 17 of file HYPNonlinearAdvection.cpp.

Constructor & Destructor Documentation

◆ NlinAdv() [1/5]

CppNoddy::Example::NlinAdv::NlinAdv ( )
inline

One dimemsional inviscid Burgers problem.

Definition at line 23 of file HYPNonlinearAdvection.cpp.

24 {}
A class to represent a one dimensional hyperbolic system of equations.

◆ NlinAdv() [2/5]

CppNoddy::Example::NlinAdv::NlinAdv ( )
inline

Two dimemsional scalar linear advection problem.

Definition at line 23 of file HYP2DLinearAdvectionXY.cpp.

24 {}
A class to represent a two-dimensional hyperbolic system of equations.

◆ NlinAdv() [3/5]

CppNoddy::Example::NlinAdv::NlinAdv ( )
inline

Definition at line 22 of file HYP2DNonlinearAdvectionX.cpp.

23 {}

◆ NlinAdv() [4/5]

CppNoddy::Example::NlinAdv::NlinAdv ( )
inline

One dimemsional inviscid Burgers problem.

Definition at line 22 of file HYP2DNonlinearAdvectionXY.cpp.

23 {}

◆ NlinAdv() [5/5]

CppNoddy::Example::NlinAdv::NlinAdv ( )
inline

One dimemsional inviscid Burgers problem.

Definition at line 23 of file HYP2DNonlinearAdvectionY.cpp.

24 {}

Member Function Documentation

◆ edge_values() [1/4]

std::vector< bool > CppNoddy::Example::NlinAdv::edge_values ( const int &  face_index,
const DenseVector< double > &  x,
DenseVector< double > &  q 
) const
inlinevirtual

edge conditions

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 44 of file HYP2DNonlinearAdvectionX.cpp.

45 {
46 std::vector<bool> inflow( q.size(), false );
47 // x doesn't matter since the conditions are fixed
48 if ( face_index == 1 )
49 {
50 q[ 0 ] = 0.0;
51 inflow[ 0 ] = true;
52 }
53 if ( face_index == 3 )
54 {
55 q[ 0 ] = 0.0;
56 inflow[ 0 ] = true;
57 }
58 return inflow;
59 }
std::size_t size() const
A pass-thru definition to get the size of the vector.
Definition: DenseVector.h:330

References CppNoddy::DenseVector< _Type >::size().

◆ edge_values() [2/4]

std::vector< bool > CppNoddy::Example::NlinAdv::edge_values ( const int &  face_index,
const DenseVector< double > &  x,
DenseVector< double > &  q 
) const
inlinevirtual

Define the edge boundary conditions.

Parameters
face_indexAn index for the face: 0,1,2,3 for S,E,N,W on the TwoD_TVDLF_Mesh
xThe global position vector
qSpecify the unknowns specified along the face
Returns
A vector that defines which components have been set as inflow

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 44 of file HYP2DNonlinearAdvectionXY.cpp.

45 {
46 std::vector<bool> inflow( q.size(), true );
47 q[ 0 ] = 0;
48 return inflow;
49 }

References CppNoddy::DenseVector< _Type >::size().

◆ edge_values() [3/4]

std::vector< bool > CppNoddy::Example::NlinAdv::edge_values ( const int &  face_index,
const DenseVector< double > &  x,
DenseVector< double > &  q 
) const
inlinevirtual

Define the edge boundary conditions.

Parameters
face_indexAn index for the face: 0,1,2,3 for S,E,N,W on the TwoD_TVDLF_Mesh
xThe global position vector
qSpecify the unknowns specified along the face
Returns
A vector that defines which components have been set as inflow

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 45 of file HYP2DNonlinearAdvectionY.cpp.

46 {
47 std::vector<bool> inflow( q.size(), false );
48 // x doesn't matter since the conditions are fixed
49 if ( face_index == 1 )
50 {
51 q[ 0 ] = 0.0;
52 inflow[ 0 ] = true;
53 }
54 if ( face_index == 3 )
55 {
56 q[ 0 ] = 0.0;
57 inflow[ 0 ] = true;
58 }
59 return inflow;
60 }

References CppNoddy::DenseVector< _Type >::size().

◆ edge_values() [4/4]

std::vector< bool > CppNoddy::Example::NlinAdv::edge_values ( const int  face_index,
const double &  x,
DenseVector< double > &  q,
const double &  t 
) const
inlinevirtual

Define the edge boundary conditions.

Parameters
face_indexAn index for the face: -1=left +1=right for OneD_TVDLF_Mesh
xThe position vector along the face
qThe unknowns specified along the face
tA time for unsteady edge conditions

Reimplemented from CppNoddy::OneD_Hyperbolic_System.

Definition at line 40 of file HYPNonlinearAdvection.cpp.

41 {
42 std::vector<bool> inflow( q.size(), false );
43 // x doesn't matter since the conditions are fixed
44 if ( face_index == -1 )
45 {
46 q[ 0 ] = 0.0;
47 inflow[ 0 ] = true;
48 }
49 if ( face_index == 1 )
50 {
51 q[ 0 ] = 0.0;
52 inflow[ 0 ] = true;
53 }
54 return inflow;
55 }

References CppNoddy::DenseVector< _Type >::size().

◆ flux_fn()

void CppNoddy::Example::NlinAdv::flux_fn ( const double &  x,
const DenseVector< double > &  q,
DenseVector< double > &  f 
) const
inlinevirtual

Define the vector flux.

Reimplemented from CppNoddy::OneD_Hyperbolic_System.

Definition at line 27 of file HYPNonlinearAdvection.cpp.

28 {
29 f[ 0 ] = q[ 0 ] * q[ 0 ] / 2;
30 }
@ f
Definition: BVPBerman.cpp:15

References f.

◆ flux_fn_x() [1/4]

void CppNoddy::Example::NlinAdv::flux_fn_x ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  f 
) const
inlinevirtual

A virtual flux function for the x-derivative.

Parameters
xThe vector position
qThe unknowns
fThe flux function

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 26 of file HYP2DLinearAdvectionXY.cpp.

27 {
28 f[ 0 ] = q[ 0 ] / sqrt( 2. );
29 }

References f.

◆ flux_fn_x() [2/4]

void CppNoddy::Example::NlinAdv::flux_fn_x ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  f 
) const
inlinevirtual

A virtual flux function for the x-derivative.

Parameters
xThe vector position
qThe unknowns
fThe flux function

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 25 of file HYP2DNonlinearAdvectionX.cpp.

26 {
27 f[ 0 ] = q[ 0 ] * q[ 0 ] / 2;
28 }

References f.

◆ flux_fn_x() [3/4]

void CppNoddy::Example::NlinAdv::flux_fn_x ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  f 
) const
inlinevirtual

A virtual flux function for the x-derivative.

Parameters
xThe vector position
qThe unknowns
fThe flux function

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 31 of file HYP2DNonlinearAdvectionXY.cpp.

32 {
33 f[ 0 ] = sqrt( 2. ) * q[ 0 ] * q[ 0 ] / 2;
34 }

References f.

◆ flux_fn_x() [4/4]

void CppNoddy::Example::NlinAdv::flux_fn_x ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  f 
) const
inlinevirtual

A virtual flux function for the x-derivative.

Parameters
xThe vector position
qThe unknowns
fThe flux function

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 26 of file HYP2DNonlinearAdvectionY.cpp.

27 {
28 f[ 0 ] = 0;
29 }

References f.

◆ flux_fn_y() [1/4]

void CppNoddy::Example::NlinAdv::flux_fn_y ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  f 
) const
inlinevirtual

A virtual flux function for the y-derivative.

Parameters
xThe vector position
qThe unknowns
fThe flux function

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 31 of file HYP2DLinearAdvectionXY.cpp.

32 {
33 f[ 0 ] = q[ 0 ] / sqrt( 2. );
34 }

References f.

◆ flux_fn_y() [2/4]

void CppNoddy::Example::NlinAdv::flux_fn_y ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  f 
) const
inlinevirtual

A virtual flux function for the y-derivative.

Parameters
xThe vector position
qThe unknowns
fThe flux function

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 30 of file HYP2DNonlinearAdvectionX.cpp.

31 {
32 f[ 0 ] = 0;
33 }

References f.

◆ flux_fn_y() [3/4]

void CppNoddy::Example::NlinAdv::flux_fn_y ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  f 
) const
inlinevirtual

Define the vector flux.

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 26 of file HYP2DNonlinearAdvectionXY.cpp.

27 {
28 f[ 0 ] = sqrt( 2. ) * q[ 0 ] * q[ 0 ] / 2;
29 }

References f.

◆ flux_fn_y() [4/4]

void CppNoddy::Example::NlinAdv::flux_fn_y ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  f 
) const
inlinevirtual

A virtual flux function for the y-derivative.

Parameters
xThe vector position
qThe unknowns
fThe flux function

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 31 of file HYP2DNonlinearAdvectionY.cpp.

32 {
33 f[ 0 ] = q[ 0 ] * q[ 0 ] / 2;
34 }

References f.

◆ max_charac_speed() [1/5]

double CppNoddy::Example::NlinAdv::max_charac_speed ( const DenseVector< double > &  q) const
inlinevirtual

Bound the shock speed.

Reimplemented from CppNoddy::OneD_Hyperbolic_System.

Definition at line 33 of file HYPNonlinearAdvection.cpp.

34 {
35 // maximum shock speed
36 return std::abs( q[ 0 ] );
37 }

◆ max_charac_speed() [2/5]

void CppNoddy::Example::NlinAdv::max_charac_speed ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  c 
) const
inlinevirtual

Bound the wave speed.

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 37 of file HYP2DLinearAdvectionXY.cpp.

38 {
39 // maximum wave speed
40 c[ 0 ] = c[ 1 ] = 1.0;
41 }

◆ max_charac_speed() [3/5]

void CppNoddy::Example::NlinAdv::max_charac_speed ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  c 
) const
inlinevirtual

Bound the wave speed.

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 36 of file HYP2DNonlinearAdvectionX.cpp.

37 {
38 // maximum wave speed
39 c[ 0 ] = std::abs( q[ 0 ] );
40 c[ 1 ] = std::abs( q[ 0 ] );
41 }

◆ max_charac_speed() [4/5]

void CppNoddy::Example::NlinAdv::max_charac_speed ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  c 
) const
inlinevirtual

Bound the wave speed.

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 37 of file HYP2DNonlinearAdvectionXY.cpp.

38 {
39 // maximum wave speed
40 c[ 0 ] = c[ 1 ] = std::abs( q[ 0 ] );
41 }

◆ max_charac_speed() [5/5]

void CppNoddy::Example::NlinAdv::max_charac_speed ( const DenseVector< double > &  x,
const DenseVector< double > &  q,
DenseVector< double > &  c 
) const
inlinevirtual

Bound the wave speed.

Reimplemented from CppNoddy::TwoD_Hyperbolic_System.

Definition at line 38 of file HYP2DNonlinearAdvectionY.cpp.

39 {
40 // maximum wave speed
41 c[ 0 ] = c[ 1 ] = std::abs( q[ 0 ] );
42 }

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

© 2012

R.E. Hewitt