|
CppNoddy
0.92
|
#include <TwoD_TVDLF_Mesh.h>
Public Member Functions | |
| TwoD_TVDLF_Mesh (const DenseVector< double > &X, const DenseVector< double > &Y, TwoD_Hyperbolic_System *ptr, fn_ptr init_ptr) | |
| Constructor for the Finite Volume Mesh using linear elements. More... | |
| virtual | ~TwoD_TVDLF_Mesh () |
| Empty desctructor. More... | |
| void | dump_gnu (std::string filename) |
| Dump the data to a given filename in a gnuplot format. More... | |
| void | dump_nodes_x (std::string filename) const |
| Dump the x-nodal positions to a given filename. More... | |
| void | dump_nodes_y (std::string filename) const |
| Dump the y-nodal positions to a given filename. More... | |
| void | dump_data (std::string filename) |
| Dump the data over the nodal positions to a given filename. More... | |
| void | set_limiter (const unsigned &id) |
| Set the limiter type to be applied in the slope values. More... | |
| double | update (const double &CFL, const double &max_dt=std::numeric_limits< long double >::max()) |
| Update the mesh object. More... | |
| void | update_to (const double &CFL, const double &t_end) |
| Update the mesh object to a set time level. More... | |
| DenseVector< double > | integrate (std::string mesh_colour="black") |
| Integrate the concentration values across the entire mesh. More... | |
| elt_iter | get_elt_iter_from_x (const DenseVector< double > &x, std::string mesh_colour="black") |
| Given a global coordinate, return a pointer to the elt that contains that point. More... | |
| DenseVector< double > | get_point_values (const DenseVector< double > &x) |
| Get the vector of unknowns at a point in the 2D mesh. More... | |
| const double & | get_time () const |
| Get a const reference to the time value for the current mesh. More... | |
| virtual void | actions_before_time_step1 (const double &time_step) |
| A virtual method that is run before the first time update. More... | |
| virtual void | actions_before_time_step2 (const double &time_step) |
| A virtual method that is run before the second time update. More... | |
Public Attributes | |
| vector_of_elts | BLACK_ELTS |
| An STL vector of linear elements – the black mesh. More... | |
| vector_of_elts | RED_ELTS |
| An STL vector of linear elements – the red mesh. More... | |
Protected Types | |
| typedef std::vector< TwoD_TVDLF_Elt > | vector_of_elts |
| iterators for the vector of elements More... | |
| typedef vector_of_elts::const_iterator | celt_iter |
| typedef vector_of_elts::iterator | elt_iter |
| typedef std::vector< TwoD_TVDLF_Elt * > | vector_of_boundary_elts |
| typedef vector_of_boundary_elts::iterator | bdry_elt_iter |
| typedef void(* | fn_ptr) (const double &, const double &, DenseVector< double > &) |
| function pointer used in the initial conditions More... | |
Protected Member Functions | |
| elt_iter | get_elt_iter_from_elt_iter (elt_iter e, std::string target_colour, int corner_index) |
| Given an element in the INITIAL STRUCTURED MESH, this method will return an iterator to an element in the other mesh that overlaps the corner specified by corner_index. More... | |
| vector_of_elts * | get_elts_from_colour (std::string mesh_colour) |
| Given a choice of black or red mesh, return a pointer to the appropriate vector of elements. More... | |
| std::size_t | get_number_elts_in_x (std::string mesh_colour) |
| Given a choice of black or red mesh, return the number of elements in the x-direction. More... | |
| void | calc_slopes (vector_of_elts *elt_vector) |
| Use the appropriate limiter to approximate the slope in each element in the mesh. More... | |
| DenseVector< double > | east_diff (elt_iter e) const |
| Compute a finite difference approximation of the derivative in the compass direction. More... | |
| DenseVector< double > | west_diff (elt_iter e) const |
| Compute a finite difference approximation of the derivative in the compass direction. More... | |
| DenseVector< double > | north_diff (elt_iter e) const |
| Compute a finite difference approximation of the derivative in the compass direction. More... | |
| DenseVector< double > | south_diff (elt_iter e) const |
| Compute a finite difference approximation of the derivative in the compass direction. More... | |
| DenseVector< double > | NS_diff (elt_iter e) |
| Compute a finite difference approximation of the derivative in the compass direction. More... | |
| DenseVector< double > | EW_diff (elt_iter e) |
| Compute a finite difference approximation of the derivative in the compass direction. More... | |
| int | sgn (double a) const |
| Sign of a double. More... | |
| DenseVector< double > | minmod (DenseVector< double > A, DenseVector< double > B) const |
| A vector version of the minmod operator. More... | |
| DenseVector< double > | maxmod (DenseVector< double > A, DenseVector< double > B) const |
| A vector version of the maxmod operator. More... | |
| void | boundary_diff (elt_iter e, const int &face_index, DenseVector< double > &diff) const |
| Given an element iterator and the local coordinate this will return zero for any components specified as inflow boundary conditions in line with Levy & Tadmor (1997) and set the centre nodal value to the edge value. More... | |
| void | set_boundary_Q (vector_of_elts *elts) |
| Loops over all boundary elements and sets the Q values in each one to be the value specified by the edge_values method. More... | |
Protected Attributes | |
| unsigned | LIMITER |
| Slope limiter method. More... | |
| std::size_t | ORDER_OF_SYSTEM |
| order of the conservative system More... | |
| std::size_t | NX |
| number of faces in the x & y directions More... | |
| std::size_t | NY |
| double | MESH_TIME |
| the time level of the mesh More... | |
| fn_ptr | p_Q_INIT |
| function pointer to a funnction that defines the initial distribution More... | |
Definition at line 19 of file TwoD_TVDLF_Mesh.h.
|
protected |
Definition at line 27 of file TwoD_TVDLF_Mesh.h.
|
protected |
Definition at line 23 of file TwoD_TVDLF_Mesh.h.
|
protected |
Definition at line 24 of file TwoD_TVDLF_Mesh.h.
|
protected |
function pointer used in the initial conditions
Definition at line 30 of file TwoD_TVDLF_Mesh.h.
|
protected |
Definition at line 26 of file TwoD_TVDLF_Mesh.h.
|
protected |
iterators for the vector of elements
Definition at line 22 of file TwoD_TVDLF_Mesh.h.
| CppNoddy::TwoD_TVDLF_Mesh::TwoD_TVDLF_Mesh | ( | const DenseVector< double > & | X, |
| const DenseVector< double > & | Y, | ||
| TwoD_Hyperbolic_System * | ptr, | ||
| fn_ptr | init_ptr | ||
| ) |
Constructor for the Finite Volume Mesh using linear elements.
| X | A vector of nodal locations at which the element FACES will positioned |
| Y | A vector of nodal locations at which the element FACES will positioned |
| ptr | A pointer to the hyperbolic system applied to this mesh |
| init_ptr | A pointer to a function that defines the initial conditions |
Definition at line 16 of file TwoD_TVDLF_Mesh.cpp.
References BLACK_ELTS, calc_slopes(), get_elt_iter_from_elt_iter(), LIMITER, MESH_TIME, NX, NY, ORDER_OF_SYSTEM, p_Q_INIT, RED_ELTS, and CppNoddy::DenseVector< _Type >::size().
|
virtual |
|
inlinevirtual |
A virtual method that is run before the first time update.
For user-custom problems.
| time_step | The time step size that is about to be taken |
Definition at line 110 of file TwoD_TVDLF_Mesh.h.
Referenced by update().
|
inlinevirtual |
A virtual method that is run before the second time update.
For user-custom problems.
| time_step | The time step size that is about to be taken |
Definition at line 119 of file TwoD_TVDLF_Mesh.h.
Referenced by update().
|
protected |
Given an element iterator and the local coordinate this will return zero for any components specified as inflow boundary conditions in line with Levy & Tadmor (1997) and set the centre nodal value to the edge value.
| e | Element iterator |
| face_index | The index of the face that is on a boundary |
| diff | A vector of derivatives |
Definition at line 892 of file TwoD_TVDLF_Mesh.cpp.
References ORDER_OF_SYSTEM.
Referenced by east_diff(), EW_diff(), north_diff(), NS_diff(), south_diff(), and west_diff().
|
protected |
Use the appropriate limiter to approximate the slope in each element in the mesh.
The slopes will be sent down to the element objects and then onto the face objects.
| elt_vector | The vector of elements to set the slope for |
superbee
Definition at line 690 of file TwoD_TVDLF_Mesh.cpp.
References east_diff(), EW_diff(), LIMITER, maxmod(), minmod(), north_diff(), NS_diff(), ORDER_OF_SYSTEM, set_boundary_Q(), south_diff(), and west_diff().
Referenced by TwoD_TVDLF_Mesh(), and update().
| void CppNoddy::TwoD_TVDLF_Mesh::dump_data | ( | std::string | filename | ) |
Dump the data over the nodal positions to a given filename.
| filename | The filename to be generated |
Definition at line 465 of file TwoD_TVDLF_Mesh.cpp.
References BLACK_ELTS, and ORDER_OF_SYSTEM.
| void CppNoddy::TwoD_TVDLF_Mesh::dump_gnu | ( | std::string | filename | ) |
Dump the data to a given filename in a gnuplot format.
| filename | The filename to be generated |
Definition at line 405 of file TwoD_TVDLF_Mesh.cpp.
References BLACK_ELTS, and ORDER_OF_SYSTEM.
Referenced by main().
| void CppNoddy::TwoD_TVDLF_Mesh::dump_nodes_x | ( | std::string | filename | ) | const |
Dump the x-nodal positions to a given filename.
This method only applies to regular structured meshes.
| filename | The filename to be generated |
Definition at line 433 of file TwoD_TVDLF_Mesh.cpp.
References BLACK_ELTS, and NX.
| void CppNoddy::TwoD_TVDLF_Mesh::dump_nodes_y | ( | std::string | filename | ) | const |
Dump the y-nodal positions to a given filename.
This method only applies to regular structured meshes.
| filename | The filename to be generated |
Definition at line 449 of file TwoD_TVDLF_Mesh.cpp.
References BLACK_ELTS, NX, and NY.
|
protected |
Compute a finite difference approximation of the derivative in the compass direction.
| e | The iterator to the element that we want the derivative for |
Definition at line 754 of file TwoD_TVDLF_Mesh.cpp.
References boundary_diff(), ORDER_OF_SYSTEM, and west_diff().
Referenced by calc_slopes(), EW_diff(), and west_diff().
|
protected |
Compute a finite difference approximation of the derivative in the compass direction.
| e | The iterator to the element that we want the derivative for |
Definition at line 843 of file TwoD_TVDLF_Mesh.cpp.
References boundary_diff(), east_diff(), ORDER_OF_SYSTEM, and west_diff().
Referenced by calc_slopes().
|
inlineprotected |
Given an element in the INITIAL STRUCTURED MESH, this method will return an iterator to an element in the other mesh that overlaps the corner specified by corner_index.
| e | An element iterator to the source element |
| target_colour | The colour of the target mesh, ie. NOT the one that iterator 'e' is in |
| corner_index | The index of the corner to be considered 0,1,2,3 for SW, SE, NE, NW. |
Definition at line 139 of file TwoD_TVDLF_Mesh.h.
References BLACK_ELTS, m, NX, NY, and RED_ELTS.
Referenced by TwoD_TVDLF_Mesh().
| std::vector< TwoD_TVDLF_Elt >::iterator CppNoddy::TwoD_TVDLF_Mesh::get_elt_iter_from_x | ( | const DenseVector< double > & | x, |
| std::string | mesh_colour = "black" |
||
| ) |
Given a global coordinate, return a pointer to the elt that contains that point.
Because the elts are stored in a vector, and are logically in a rectangular grid, we first hunt for the column, then the appropriate row.
| x | A vector global coordinate |
| mesh_colour | A string identifier of the mesh to be searched |
Definition at line 618 of file TwoD_TVDLF_Mesh.cpp.
References get_elts_from_colour(), and get_number_elts_in_x().
Referenced by get_point_values().
|
protected |
Given a choice of black or red mesh, return a pointer to the appropriate vector of elements.
| mesh_colour | A mesh identifier (black or red) |
Definition at line 660 of file TwoD_TVDLF_Mesh.cpp.
References BLACK_ELTS, and RED_ELTS.
Referenced by get_elt_iter_from_x(), and integrate().
|
protected |
Given a choice of black or red mesh, return the number of elements in the x-direction.
| mesh_colour | A mesh identifier (black or red) |
Definition at line 675 of file TwoD_TVDLF_Mesh.cpp.
References NX.
Referenced by get_elt_iter_from_x().
| DenseVector< double > CppNoddy::TwoD_TVDLF_Mesh::get_point_values | ( | const DenseVector< double > & | x | ) |
Get the vector of unknowns at a point in the 2D mesh.
| x | The global coordinate at which to return the values |
Definition at line 491 of file TwoD_TVDLF_Mesh.cpp.
References get_elt_iter_from_x().
Referenced by main().
| const double & CppNoddy::TwoD_TVDLF_Mesh::get_time | ( | ) | const |
Get a const reference to the time value for the current mesh.
Definition at line 601 of file TwoD_TVDLF_Mesh.cpp.
References MESH_TIME.
Referenced by main().
| DenseVector< double > CppNoddy::TwoD_TVDLF_Mesh::integrate | ( | std::string | mesh_colour = "black" | ) |
Integrate the concentration values across the entire mesh.
| mesh_colour | The identifier of which mesh to integrate over |
Definition at line 605 of file TwoD_TVDLF_Mesh.cpp.
References get_elts_from_colour(), and ORDER_OF_SYSTEM.
|
protected |
A vector version of the maxmod operator.
| A | A vector to compare |
| B | A vector to compare |
Definition at line 883 of file TwoD_TVDLF_Mesh.cpp.
References CppNoddy::DenseVector< _Type >::push_back(), and sgn().
Referenced by calc_slopes().
|
protected |
A vector version of the minmod operator.
| A | A vector to compare |
| B | A vector to compare |
Definition at line 874 of file TwoD_TVDLF_Mesh.cpp.
References CppNoddy::DenseVector< _Type >::push_back(), and sgn().
Referenced by calc_slopes().
|
protected |
Compute a finite difference approximation of the derivative in the compass direction.
| e | The iterator to the element that we want the derivative for |
Definition at line 788 of file TwoD_TVDLF_Mesh.cpp.
References boundary_diff(), ORDER_OF_SYSTEM, and south_diff().
Referenced by calc_slopes(), NS_diff(), and south_diff().
|
protected |
Compute a finite difference approximation of the derivative in the compass direction.
| e | The iterator to the element that we want the derivative for |
Definition at line 822 of file TwoD_TVDLF_Mesh.cpp.
References boundary_diff(), north_diff(), ORDER_OF_SYSTEM, and south_diff().
Referenced by calc_slopes().
|
inlineprotected |
Loops over all boundary elements and sets the Q values in each one to be the value specified by the edge_values method.
| elts | A vector of elements in the mesh |
Definition at line 319 of file TwoD_TVDLF_Mesh.h.
References ORDER_OF_SYSTEM.
Referenced by calc_slopes().
| void CppNoddy::TwoD_TVDLF_Mesh::set_limiter | ( | const unsigned & | id | ) |
Set the limiter type to be applied in the slope values.
| id | The identifier of the limiter. |
Definition at line 497 of file TwoD_TVDLF_Mesh.cpp.
References LIMITER.
Referenced by main().
|
protected |
Sign of a double.
| a | The value to return the sign of |
Definition at line 864 of file TwoD_TVDLF_Mesh.cpp.
|
protected |
Compute a finite difference approximation of the derivative in the compass direction.
| e | The iterator to the element that we want the derivative for |
Definition at line 805 of file TwoD_TVDLF_Mesh.cpp.
References boundary_diff(), north_diff(), and ORDER_OF_SYSTEM.
Referenced by calc_slopes(), north_diff(), and NS_diff().
| double CppNoddy::TwoD_TVDLF_Mesh::update | ( | const double & | CFL, |
| const double & | max_dt = std::numeric_limits<long double>::max() |
||
| ) |
Update the mesh object.
A time step is chosen based upon the CFL constraint.
| CFL | The CFL constraint for the timestep (e.g. 0.49) |
| max_dt | A maximum timestep to be taken irrespective of the CFL value |
Definition at line 501 of file TwoD_TVDLF_Mesh.cpp.
References actions_before_time_step1(), actions_before_time_step2(), BLACK_ELTS, calc_slopes(), MESH_TIME, and RED_ELTS.
Referenced by main(), and update_to().
| void CppNoddy::TwoD_TVDLF_Mesh::update_to | ( | const double & | CFL, |
| const double & | t_end | ||
| ) |
Update the mesh object to a set time level.
A time step is chosen based upon the CFL constraint.
| CFL | The CFL constraint for the timestep (e.g. 0.49) |
| t_end | The target end time. |
Definition at line 594 of file TwoD_TVDLF_Mesh.cpp.
|
protected |
Compute a finite difference approximation of the derivative in the compass direction.
| e | The iterator to the element that we want the derivative for |
Definition at line 771 of file TwoD_TVDLF_Mesh.cpp.
References boundary_diff(), east_diff(), and ORDER_OF_SYSTEM.
Referenced by calc_slopes(), east_diff(), and EW_diff().
| vector_of_elts CppNoddy::TwoD_TVDLF_Mesh::BLACK_ELTS |
An STL vector of linear elements – the black mesh.
Definition at line 126 of file TwoD_TVDLF_Mesh.h.
Referenced by dump_data(), dump_gnu(), dump_nodes_x(), dump_nodes_y(), get_elt_iter_from_elt_iter(), get_elts_from_colour(), TwoD_TVDLF_Mesh(), and update().
|
protected |
Slope limiter method.
Definition at line 373 of file TwoD_TVDLF_Mesh.h.
Referenced by calc_slopes(), set_limiter(), and TwoD_TVDLF_Mesh().
|
protected |
the time level of the mesh
Definition at line 379 of file TwoD_TVDLF_Mesh.h.
Referenced by get_time(), TwoD_TVDLF_Mesh(), update(), and update_to().
|
protected |
number of faces in the x & y directions
Definition at line 377 of file TwoD_TVDLF_Mesh.h.
Referenced by dump_nodes_x(), dump_nodes_y(), get_elt_iter_from_elt_iter(), get_number_elts_in_x(), and TwoD_TVDLF_Mesh().
|
protected |
Definition at line 377 of file TwoD_TVDLF_Mesh.h.
Referenced by dump_nodes_y(), get_elt_iter_from_elt_iter(), and TwoD_TVDLF_Mesh().
|
protected |
order of the conservative system
Definition at line 375 of file TwoD_TVDLF_Mesh.h.
Referenced by boundary_diff(), calc_slopes(), dump_data(), dump_gnu(), east_diff(), EW_diff(), integrate(), north_diff(), NS_diff(), set_boundary_Q(), south_diff(), TwoD_TVDLF_Mesh(), and west_diff().
|
protected |
function pointer to a funnction that defines the initial distribution
Definition at line 381 of file TwoD_TVDLF_Mesh.h.
Referenced by TwoD_TVDLF_Mesh().
| vector_of_elts CppNoddy::TwoD_TVDLF_Mesh::RED_ELTS |
An STL vector of linear elements – the red mesh.
Definition at line 128 of file TwoD_TVDLF_Mesh.h.
Referenced by get_elt_iter_from_elt_iter(), get_elts_from_colour(), TwoD_TVDLF_Mesh(), and update().
1.9.5
© 2012
R.E. Hewitt