24-Sep-13
25
A structured mesh has many coding advantages, but it may be difficult to conform a single block to a complicated shape. Code developers have got around this by allowing multiple blocks (multiblock unstructured), but this can make the internal memory strucutres more inefficient. Another way to make the mesh generation simpler, and improve code performance is to throw away the block structure and replace indices with node numbers and a connectivity table. This is known as an unstructured mesh, because it lacks the i,j,k structure.
24-Sep-13
26
9/24/2013
24-Sep-13
27
24-Sep-13
28
9/24/2013
24-Sep-13
29
24-Sep-13
31
Mesh Quality
Rule of thumb: the elements shape and distribution should be pleasing to the eye. There is no written theory when it comes to mesh generation and the whole process depends on user experience. The user can rely on grid dependency studies, but they are time consuming and expensive. No single standard benchmark or metric exists that can effectively assess the quality of a mesh, but you can rely on suggested best practices.
9/24/2013
24-Sep-13
32
Mesh Quality
The most common mesh quality metrics are:
Orthogonality. Skewness. Aspect Ratio. Smoothness.
24-Sep-13
33
Mesh Quality
Mesh orthogonality
It is the angular deviation of the vector S (located at the face center f ) from the vector d connecting the two cell centers P and N. It affects the gradient of the face center f. It adds diffusion to the solution.
9/24/2013
24-Sep-13
34
Mesh Quality
Mesh skewness
Skewness is the deviation of the vector d that connects the two cells P and N, from the face center f. The deviation vector is represented with and the point where the vector d intersects the face f is fi. It affects the interpolation of the cell centered quantities to the face center f. It adds diffusion to the solution.
24-Sep-13
35
Mesh Quality
Mesh aspect ratio AR
Mesh aspect ratio AR is the ratio between the longest side x and the shortest side y . Large AR are fine if gradients in the long direction are small. High AR smear gradients.
9/24/2013
24-Sep-13
36
Mesh Quality
Smoothness
Smoothness, also known as expansion rate, growth factor or uniformity, defines the transition in size between contiguous cells. Large transition ratios between cells add diffusion to the solution. Ideally, the maximum change in mesh spacing should be less than 20%: 2 1 1.2
Steep Transition
Smooth Transition
24-Sep-13
37
Mesh Quality
For the same cell count, hexahedral meshes will give more accurate solutions, especially if the grid lines are aligned with the flow. The mesh density should be high enough to capture all relevant flow features. In areas where the solution change slowly, you can use larger elements. To keep cell count down, use non-uniform meshes to cluster cells only where they are needed. Use local refinements and solution adaption to further refine only on selected areas. In boundary layers, quad, hex, and prism/wedge cells are preferred over triangles, tetrahedras, or pyramids. If you are not using wall functions (turbulence modeling), the mesh adjacent to the walls should be fine enough to resolve the boundary layer flow. This will rocket the cell count.
9/24/2013
24-Sep-13
38
Mesh Quality
In
WM_PROJECT_DIR/src/OpenFOAM/meshes/primitive Mesh/primitiveMeshCheck/primitiveMeshCheck.C you will find the quality metrics used in OpenFOAM.
24-Sep-13
39
Mesh Quality
OpenFOAM comes with the utility checkMesh which checks the validity of the mesh. checkMesh will look for/check for:
Mesh stats and overall number of cells of each type. Check topology (boundary conditions definitions). Check geometry and mesh quality (bounding box, cell volumes, skewness, orthogonality, aspect ratio)
If for any reason checkMesh finds errors, it will give you a message and it will tell you what check failed. It will also write a set with the faulty cells, faces, points. These sets are saved in the directory constant/polyMesh/sets/
9/24/2013
24-Sep-13
40
Mesh Quality
Mesh topology and patch topology errors must be repaired. You will be able to run with mesh quality errors such as skewness, aspect ratio, minimum face area, and non-orthogonality. But remember, they will severely tamper the solution accuracy and eventually can make the solver blow-up. checkMesh does not repair these errors. You will need to check the geometry for possible errors and generate a new mesh.
24-Sep-13
41
Mesh Conversion
It is also possible to export a mesh generated with a third party software and use it in OpenFOAM. Some of the utilities available formesh conversion are listed below:
ansysToFoam: converts an ANSYS input mesh file OpenFOAM format. cfx4ToFoam: converts a CFX 4 mesh to OpenFOAM format. fluent3DMeshToFoam: converts a Fluent mesh to OpenFOAM format. gambitToFoam: converts a GAMBIT mesh to OpenFOAM format. gmshToFoam: reads .msh file as written by Gmsh. ideasUnvToFoam: I-Deas unv format mesh conversion. plot3dToFoam: plot3d mesh (ascii/formatted format) converter. star4ToFoam: converts a STAR-CD (v4) PROSTAR mesh into OpenFOAM format. tetgenToFoam: Converts .ele and .node and .face files, written by tetgen.
9/24/2013
24-Sep-13
42
Mesh Conversion
OpenFOAM also comes with many mesh manipulation utilities. Some of them are listed below:
checkMesh: checks validity of a mesh. refineMesh: utility to refine cells in multiple directions. renumberMesh: renumbers the cell list in order to reduce the bandwidth, reading and renumbering all fields from all the time directories transformPoints: transforms the mesh points in the polyMesh directory according to the translate, rotate and scale options. mirrorMesh: mirrors a mesh around a given plane. setSet: manipulate a cell/face/point/ set or zone intera refineWallLayer: utility to refine cells next to patches.
24-Sep-13
43
Mesh Conversion
blockMesh
For simple geometries, the mesh generation utility blockMesh (supplied with OpenFOAM), can be used. The blockMesh utility creates multiblock meshes. The mesh is generated from a dictionary file named blockMeshDict located in the constant/polyMesh directory.
snappyHexMesh
For complex geometries, the mesh generation utility snappyHexMesh (supplied with OpenFOAM), can be used. The snappyHexMesh utility generates 3D meshes containing hexahedra and split-hexahedra from a triangulated surface geometry in Stereolithography (STL) format. The mesh is generated from a dictionary file named snappyHexMeshDict located in the system directory and a triangulated surface geometry file located in the directory constant/triSurface.