# Methods for Grid Generation in CFD Simulations

### Key Takeaways

• Mesh generation in CFD simulations plays the same role as meshing in finite element simulations, where discretization will determine the accuracy and computation time in the simulation.

• The grid generation method that is used in a problem will try to match the mesh to the geometry of the system being simulated.

• More advanced meshing techniques do not use Cartesian or structured grids, instead, they apply polynomial curves and interpolation schemes to generate the mesh and results. Numerical methods for solving partial differential equations are advanced topics not normally taught in undergraduate engineering classes. However, as a working engineer, you can’t work out every problem by hand. Therefore, it’s important to have some knowledge of numerical methods as well as how they are executed in computational simulation. When generating meshes for these simulations, it’s your job to understand how discretization in a numerical model influences accuracy and what you’ll be able to observe in your results.

Grid generation in CFD refers to a set of techniques for defining a numerical mesh throughout the system to be simulated. The grid that is selected for CFD simulations will define the accuracy and resolution of the simulation results, both of which will affect the computation time and level of detail in the results. Using the right grid generation tools, automation and templatization are put in place to ensure that the required expertise and time commitment can be minimal while still ensuring the utmost accuracy in your mesh.

## Grid Generation in CFD Simulations

Grid generation in CFD simulations involves choosing a mathematical technique to represent the arrangement and spacing between each node in the numerical grid for your system. The technique that is chosen can then be used to define grid points along the surface (for 2D or boundary element method problems) or inside the volume (for 3D problems) of the system.

Why is meshing needed in CFD problems? In addition to converting complex differential equations into simpler arithmetic problems, discretization allows a simulation to account for changes in continuous physical properties across the solution domain. An example would be compressible flow, where the density of the fluid varies in space and with flow rate.

The discretization resolution can also be tuned to the problem at hand to ensure the system can be solved with reasonable computational effort. When the generated mesh matches the system geometry, a coarser mesh can be used so that computational cost is reduced. After the simulation converges to a solution, the results can be interpolated for the entire domain.

The five common geometries used in grid generation for CFD problems are detailed below.

### Cartesian Grid Generation

This is the simplest type of grid generation technique. In this method, a rectangular grid is used to represent the boundary and interior of a system for use in a CFD simulation, with grid points constrained to planes aligned with the Cartesian axis system. Cartesian grids are simple systems, with each cell being shaped like a cube or brick, that can provide very high accuracy as long as the geometry only consists of orthogonal surfaces. Systems with curved surfaces or slanted boundaries may require higher meshing density to ensure accuracy, which increases the computation time in the simulation. Another technique for handling curved surfaces is for the grid cells to be cut by the boundaries into non-cubical shapes. Because of these complications, an alternative grid approach is normally used in most systems.

### Structured Grid Generation

A structured grid creates an arrangement of quad (2d) or brick (3d)  grid cells that are arranged in a simple matrix-like structure. Unlike a Cartesian grid in which the cells are always regularly shaped,  a structured grid is warped to follow the boundaries of the system. The node arrangement in the grid follows the same shape as the boundary surface, effectively scaling its interpolated nodes into the interior of the system. This type of grid generation provides much higher accuracy than Cartesian grid generation in CFD problems, as it will closely follow the surface of the curve along the boundary. Example showing a structured grid conforming to the surface of a jet turbine housing

### Unstructured Grid Generation

An unstructured grid is a tessellation across the surface and interior volume of the system, seen as triangles (in 2D problems) or tetrahedra (in 3D problems). These grids can provide comparable accuracy as a structured grid, but they require similarly high node density in regions with high flow gradients. Therefore, the use of an unstructured grid does not always guarantee more efficient computation. However, if the grid resolution can still be tuned across the solution domain, computational complexity can be reduced for certain problems.

### Hybrid Grid Generation

This grid generation method for CFD simulations applies a multi-structured approach to complex shapes that could conform to different coordinate systems. For example, consider square-shaped housing with a round hole; hybrid grid generation would use a structured grid around the curved portion and a Cartesian grid along the orthogonal boundaries. Somewhere between the two regions, the two grid styles would converge on each other and make a smooth transition. The challenge in this grid generation method is to define the transition between different regions. This hybrid grid for an airfoil contains unstructured regions and structured regions around the edge of the structure.

This grid generation method for CFD simulations is applied as part of any of the other grid generation methods shown above. As the grid is applied, the spatial node density is increased near specific regions in the system, or near curves with higher curvature, in order to capture data with higher resolution in specific regions in the system. For electromagnetics problems, this allows regions in the system where higher frequency waves are prominent to be captured with higher accuracy, whereas lower frequency regions can have a coarser grid. The same idea applies to CFD simulations. Adaptive meshing applies higher density grids near curves with high gradients, including in the transition between two surfaces

### High-Order Meshing

High-order meshing is one technique that can be used to apply polynomial meshes to system boundaries with complex shapes. In some systems with curved surfaces, the surface cannot be easily described by analytic equations, so these systems require a parametric approach, interpolation, spline representation, or polynomial approximation to determine the appropriate grid points. Applying a polynomial is a simple way to approximate the surface as a curve, and a standard interpolation approach can then be easily applied between mesh points. Resolving the geometry with curved elements in adaptive meshing, rather than using piecewise linear or piecewise quadratic sections, can provide very high accuracy in regions with large gradients without requiring higher grid density.

## Matching a Solution Method

Technically, any numerical computational scheme can be used in the above grid geometries to calculate the solution to the Navier-Stokes equations in a CFD problem. The finite volume method (FVM) is preferred, particularly for problems that involve convection, as it can handle the nonlinear convective term in the Navier-Stokes equations. FDTD is also useful in CFD simulations and is sometimes discussed in the literature as an FDTD-CFD method. Commercial solvers that can operate directly from your physical layout data will typically use FDM, FEM, or FVM to solve CFD problems.

Our aim is to ensure grid generation is as seamless as possible without sacrificing fidelity. It’s vital that whether you’re implementing Cadence into a pre-existing workflow or working to rebuild your CFD workflow entirely, you get the fidelity you need at the speed you want.