An unstructured grid is a subdivision of a domain by hexahedra, pyramids, prisms, and tetrahedra.
Up to now we implemented only subdivisions by hexahedra!
The class Unstructured_grid is the general class to describe an unstructured grid.
There exist several predefined geometries and corresponding subdivisions by hexahedra.
Hexahedron::Hexahedron(double lx, double ly, double lz); |
hexahedron
|
---|---|
Cylinder::Cylinder(double R, double r, double l); |
Cylinder with radius R and height 1. The size of the inner block is r x r . |
Periodic_Cylinder::Periodic_Cylinder( double R, double l); |
Cylinder with radius R and height 1. Periodic boundary conditions at cylinder faces. |
Example:
Cylinder my_cylinder(2.0,1.0,4.0);
General unstructured grids can be constructed by objects of class Unstructured_grid. This hast to be done in 8 steps:
Define an object of class Unstructured_grid :
Unstructured_grid my_ug;
Set the number of grid points by the member function
Unstructured_grid::set_number_points(int number_grid_points);
Set the coordinates of each grid point with number 0,...,number_grid_points by:
Unstructured_grid::Set_coordinate_point(int number, D3vector coordinate);
Set the number of hexahedra by the member function
Unstructured_grid::set_number_points(int number_hexahedra);
Set the numbers (id) of the corner points of each hexahedron by:
Unstructured_grid::Set_hexahedron(int number, int WSDid, int ESDid, int WNDid, int ENDid, int WSTid, int ESTid, int WNTid, int ENTid);
In case of periodic boundary conditions, one has to apply a different member function for certain hexahedra. This member function is needed, if a corner point of a hexahedron has a different coordinate as the coordinate described by Unstructured_grid::Set_coordinate_point(...). Then, one has to apply the member function:
Unstructured_grid::Set_hexahedron(int number, int WSDid, int ESDid, int WNDid, int ENDid,
int WSTid, int ESTid, int WNTid, int ENTid, D3vector coordWSD, D3vector coordESD, D3vector coordWND, D3vector coordEND, D3vector coordWST, D3vector coordEST, D3vector coordWNT, D3vector coordENT);
One has to be careful using this member function. The grid generator can get confused, if one does not obey the following rule: Construction rule for periodic boundary conditions: Let x,y be two grid points with the same number id. Then, minimal number of edges connecting x and y is 3.
Apply the member function
Unstructured_grid::construction_hexahedron_points_done();
If necessary, transform certain edges by
Unstructured_grid::Set_transformation_edge(int id_low, int id_high,
D3vector (*transform)(double));
Here, transform has to represent a transformation formula of the formid_low has to be a smaller id of a corner than the id id_high . Then, the function transform transforms the edge from id_low to id_high .
Apply the member function Unstructured_grid::construction_done();
Example:
class Hexahedron : public Unstructured_grid {
public:
Hexahedron(double lx, double ly, double lz);
~Hexahedron(){};
};
Hexahedron::Hexahedron(double l_x, double l_y, double l_z) {
Set_number_points(8); // 8 an den Ecken
Set_coordinate_point(WSDd, D3vector(0.0,0.0,0.0));
Set_coordinate_point(ESDd, D3vector(l_x,0.0,0.0));
Set_coordinate_point(WNDd, D3vector(0.0,l_y,0.0));
Set_coordinate_point(ENDd, D3vector(l_x,l_y,0.0));
Set_coordinate_point(WSTd, D3vector(0.0,0.0,l_z));
Set_coordinate_point(ESTd, D3vector(l_x,0.0,l_z));
Set_coordinate_point(WNTd, D3vector(0.0,l_y,l_z));
Set_coordinate_point(ENTd, D3vector(l_x,l_y,l_z));
Set_number_hexahedra(1);
Set_hexahedron(0, WSDd, ESDd, WNDd, ENDd, WSTd, ESTd, WNTd, ENTd);
construction_hexahedron_points_done();
// no transformations of the edges and faces
construction_done();
}
Last modified: Thu Feb 10 11:53:29 MET 2000