• CFD, Fluid Flow, FEA, Heat/Mass Transfer
  • +91 987-11-19-383
  • amod.cfd@gmail.com

Mesh Generation

Meshing for CFD is 50% capability and 50% art!

A good mesh might not lead to the ideal solution, but a bad mesh will always lead to a bad solution - Patrick Baker (Pointwise)

Solid modeling (required to create 3D geometry) and mesh generation are at present separate steps, performed using different programs and software environment, and a greater seamless integration is still in distant future. The first step of meshing is to ensure the "topological consistency" of the 3D geometry when the data is transfered from "Solid Modeling" environment or "mesh generation" environment. The topology refers to the way points, lines and surfaces connect to form a three-dimensional space.

Meshing is not same as Tessellation.

This step involves division of the computational domain into small sub-divisions called a grid or mesh of cells/elements/control volumes. The 2D boundaries of this smaller (discretized) domains are called Faces, the 1D boundaries are called Edges and 0-D boundaries are called Nodes or Vertices. The solution of flow problems are defined at the nodes of the cells. In general, the accuracy of CFD simulation is governed by cell size. Finer the mesh (lower the cell size), better is the result. However, the hardware resource increase with increase in no. of cells (elements) in the mesh. Hence, a trade-off is required.

  1. The mesh resolution near walls affect calculation of wall shear as well as separation zone and location of separation. Appropriate mesh sizing is critical because fidelity of local wall shear predictions affects the prediction of frictional drag for external flows or pressure drop (which is also a form of frictional drag) for internal flows. Both the frictional and pressure drag for bluff bodies is dependent upon extent of separation zones.
  2. When you use the Spalart-Allmaras model or any other eddy-viscosity model with enhanced wall function, you should check that y+ of the wall-adjacent cells is either very small (on the order of y+ = 1), or y+ ≥ 30.
  3. The requirement of a non-uniform mesh is a necessity and not a limitation. The cell size is smaller is the regions of sharp gradients of field variables (velocity, pressure, temperature, shear stress, etc) and larger in the regions of less gradients.
  4. Though the region of sharp gradients cannot be anticipated a priori, this is the time where an insight into the physics of the problem is helpful.
  5. Most modern solvers come with a feature called "mesh-adaption". The solver automatically refines the mesh based on various setting such as y+ refinement. However care should be taken so that enough memory is available after such refinements as the mesh size (no. of cells / elements) can increase significantly after such adaptation.
  6. If machine time in computation is ignored, it takes approximately 70~80% of the overall simulation time in a good mesh generation activity.
Some of the jargons associated with meshing are:
  • Bi-directional associativity between CAD environment and pre-processing environment: This refers to the automatic updation of mesh when associated CAD geometry is updated.
  • Virtual topology such as slicing in Ansys Workbench, imprint in STAR-CCM+: This refer to changing the geometry to suit meshing requirements without affecting the underlying geometrical description. Note that there is a difference the way CAD environment treats geometrical entities and the way mesh generator software use those information.
  • Swept meshing, Multi-zone meshing, Paving, Blocking
Types of elements: note that a node is a 0-D element, an edge is an 1-D element, triangles and quadrilaterals are 2-D elements and tetrahedrons, hexahedrons, pyramids and wedges are 3-D elements. The 2-D elements which constitute the boundaries of a 3-D elements are called faces. Element which define the boundary of a computational domain will always have dimension 1 less than the dimension of the flow domain. For example, for 1-D cases the boundaries will be represented by nodes, for 2-D cases the boundaries will be of type edge elements and for 3-D cases the boundaries will have 2D elements.

Types of Elements

A wedge or prism element is normally created by slicing a tetrahedron parallel to its base. Since, this element is created by rule near the boundaries namely of type walls, they will appear triangles from one side and quadrilateral from other side.

The elements defining the flow domains other than boundaries are called interior elements. Note that the mesh topology used to specify simulation parameters may be different than the mesh topology internally created by the solver. For example, a solver may create a mesh around each node by connecting the centroids of all the elements associated with it. This is called a vertex-based scheme (e.g. CFX). In some cases, the mesh supplied to the solver will be used as provided such as FLUENT. This is known as cell-centred scheme.

Cell-centred vs. vertex-centred approach

Mesh Duality

Mesh Top Down Approach

Hangind Node
A surface is bounded by edges and edges are connected at vertices or keypoints or nodes. So, a rectangular surface is bound by 4 edges and the 4 edges themselves make 4 corners and thus 4 nodes, vertics or keypoints. Any straight edge of surface must be a connection between two nodes. Any node not meeting this requirement is called a a "hanging node" as described below.

Hanging Node Definition

Hanging nodes are considered crack in FE solvers for structural simulations. However, hanging nodes are acceptable in most of of the CFD solvers and FLUENT even has a method of mesh adaption based on handing nodes creation.
Non-Manifold Vertices (Nodes)
A mesh or finite element representation of a real geometry is a connection of edges and points in a certain way. When the connection is representing a real geometry, it is said to be topologically correct. However, since edges and point can be connected in any arbitrary manner, they may not always represent the physically plausible geometry. Thus:

a non-manifold geometry or 3D shape cannot be unfolded into a 2D surface with all its normals pointing the same direction. In other words, a 3D model can be represented digitally but there is no geometry which can physically support it in the real world. In the following picture, a hexahedral element has internal tetrahedral element which is not necessary at all.

Non-manifold hexahedron

Similarly, if a vertex is attached to the interior of a surface or if surrounded by a volume but not connected with any of the edges defining that volume, it is called a non-manifold vertex.

One important aspect of mesh is the node-element relation for tri/tetra and quad/hexa elements. It is worth noting the fact that the ratio of nodes/elements tend to 1.0 for quadrilaterals and the ratio of number of nodes and number of elements defined by those nodes tend to 0.5 for triangles. They are explained in two sketches below. Hence, the memory space required to store triangle elements would be approx twice that of quadrilateral elements.

Node-Element Topology for Quad elements
Node-Element Topology for Quad elements

Node-Element Topology for Tri elements
Node-Element Topology for Triangle elements

One important consideration in generating mesh is also to capture the physics of the flow. Most of the time, we are focused on the boundary layer resolution over the walls and near the separation and reattachment regions. The underlying principle is to capture the gradient of field variables, in whatever direction they might be present. One such similar consideration is flow gradient in the entrance region when "uniform flow velocity" is to be applied. Here the gradient is along the direction of flow, similar to the one we observe perpendicular to the wall. Following images demonstrates the recommended mesh in the entrance region.

Mesh in Entrance Region
Mesh Not OK for Entrance Region

Mesh in Entrance Region
Mesh OK for Entrance Region

All hexa mesh in T- and Y-Junction

The O-grid techniques can be used to generate hexahedron meshed in complicated geometries such as Tee-junctions and Wye-junctions as demonstrated in following image.

Mesh: Y- and T-junction

Some tips and tricks of mesh generation:
  • Delaunay method of mesh generation typically results in smoother transition from coarse mesh to fine mesh regions. Most of the meshing programs have provision to use an existing surface mesh to generate the volume mesh.
  • Sometimes, ICEM CFD is not able to generate surface mesh if the surface has strong curvature or iso-lines are not well defined. The surface mesh can be generated by
    • creating volume mesh using more robust OCTREE method
    • deleting volume mesh
    • repairing surface mesh
    • smoothing surface mesh with Laplacian smoothing switched OFF
    • smoothing surface mesh with Laplacian smoothing switched ON and finally
    • smoothing surface mesh with Laplacian smoothing switched OFF.
  • Once a good quality surface mesh is available, Delaunay method can be used to generate good quality volume mesh with better transition from coarse mesh region to fine mesh region and vice versa.

Mesh Types

A mesh is designated as structured, unstructured, hybrid, overset, conformal or non-conformal. These are based on the connectivity of the cells, nodes and edges. One of the misunderstanding is that a mesh consisting of only quad elements are always structured. This is not true and a strctured mesh is identified by a pattern where each node is connected to same number of elements.

A mesh consisting of more than 1 element types such as tetrahedrons and hexahedrons are called hybrid. They may or may not be conformal. In case a hybrid mesh consisting of tetrahedrons and hexahedrons are conformal, pyramid elements need to be used to transition from tetra to hexa elements.

A non-conformal mesh has grid nodes which do not match up along an interface. This type of mesh is useful for design study where parts can be replaced without regeneration of the entire mesh. Sometimes, this type of mesh becomes a necessity for meshing complex geometries. Recommended approach to have number of nodes / elments in the ratio 2:1 or less on the two sides of a non-conformal interface.

For complex geometries such as engine under-hood thermal management, structured mesh quad/hex meshes are neighter possible nor show any numerical advantage, thus one can save meshing effort by using a mesh consisting of tri/tetra elements.

Mesh Quality

The quality of mesh is a collective summary of quality of individual elements. Aspect ratio, skewness, orthogonality, determinant and Jacobian are some of the methods used to designate the quality of elements. One of the key quality metrics for mesh used in CFD simulations is skewness.

Skewness definition

Mesh skewness reduces the accuracy of face integrals (calculation of face flux) since the interpolated face value does not lie in the center of the face F, but instead lies at the intersection of vector joining cell centres and the common face, denoted by R above.

Warp: It applies only to quadrilateral elements and is defined as the variation of normals between the two triangular faces that can be constructed from the quadrilateral face. Warp value is the maximum of the two possible ways triangles can be created in a quadrilateral/rectangular face.

Mesh Formats

In its simplest form, a mesh is a collection of list desscribing coordinates of nodes and its connectivity with neighbouring nodes. Additionally, it may contain material information, name of a zone or domain a node and element belong to.
STL format
solid part0
  facet normal n1 n2 n3
    outer loop
      vertex x1 y1 z1
      vertex x2 y2 z2
      vertex x3 y3 z3
  facet normal ...
endsolid part0

solid part1
Contact us
Disclaimers and Policies

The content on CFDyna.com is being constantly refined and improvised with on-the-job experience, testing, and training. Examples might be simplified to improve insight into the physics and basic understanding. Linked pages, articles, references, and examples are constantly reviewed to reduce errors, but we cannot warrant full correctness of all content.