flec01

Objectives

Lecture

Labs

Order of Class

ANSYS Fluent CFD

Fluent is one of the two computational fluid dynamics (CFD) packages included with the ANSYS computational mechanical software suite. Fluent is a Green-Gauss Finite Volume Method with a Cell-Centered formulation (and we'll cover what that means in a few minutes). The major point is the finite volume method (FVM).

The Finite Volume Method

Computational engineers solve partial differential equations. There are three numerical methods for the solution of partial differential equations we'll compare in this class. Essentially, - the finite difference method (FDM) discretizes the classical form of the PDE; - the finite element method (FEM) discretizes the weak form of the PDE; and - the finite volume method (FVM) discretizes the conservation form of the PDE.

FVM has the relative advantage of being mathematically straightforward (particularly over some of the more abstruse versions of FEM) and in particular is excellent for problems in which quantity conservation is vital. The following exposition follows Moukalled2016 in broad outlines; LongND presents another development.

The Semi-Discretized Equation

The conservation equation for a general scalar φ may be written,


$$ \frac{ \partial \left( \rho \varphi \right) }{ \partial t } + \nabla \cdot \left( \rho \vec{v} \varphi \right) = \nabla \cdot \left( \Gamma ^{\varphi} \nabla \varphi \right) + Q ^{\varphi} \text{,} $$

respectively, a transient term, convective term, diffusive term, and source term. Γ represents the diffusive coefficient. Recollect the physical definitions of the convective and diffusive terms: "Convection is a physical process that occurs in a flow of gas in which some property is transported by the ordered motion of the flow. Diffusion is a physical process that occurs in a flow of gas in which some property is transported by the random motion of the molecules of the gas."[NASA]

Assuming that the foregoing equation (1) is steady-state (the transient term goes to zero) and (2) applies to a single control volume C, this becomes


$$ \int_{V_C} dV\, \nabla \cdot \left( \rho \vec{v} \varphi \right) = \int_{V_C} dV\, \nabla \cdot \left( \Gamma ^{\varphi} \nabla \varphi \right) + \int_{V_C} dV\, Q ^{\varphi} \text{.} $$

Finally, we apply the Gaussian divergence theorem to replace the volume integrals over the control volume by surface integrals over the control surface:


$$ \oint_{\partial V_C} d\vec{S} \cdot \nabla \cdot \left( \rho \vec{v} \varphi \right) = \oint_{\partial V_C} d\vec{S} \cdot \left( \Gamma ^{\varphi} \nabla \varphi \right) + \int_{V_C} dV\, Q ^{\varphi} \text{.} $$

This final form represents the conservative form of the PDE, and FVM focuses on efficiently solving this statement. (This is what we mean by cell-centered FVM; LongND summarizes alternative formulations.) There are two types of quantities represented: surface flux terms and a volume source term.

Figure. Partial differential equation terms in a finite volume cell.

Conservative Surface Flux

The key challenge in solving the semi-discretized equation arises from the flux integration requirement over the element faces. For simplicity, we write the convective, diffusive, and total flux terms as


$$ \begin{eqnarray} \vec{J}^{\varphi,C} & = \rho \vec{v} \varphi \\ \vec{J}^{\varphi,D} & = - \Gamma^{\varphi} \nabla \varphi \\ \vec{J}^{\varphi} & = \vec{J}^{\varphi,C} + \vec{J}^{\varphi,D} \text{.} \end{eqnarray} $$

Replace the surface integral over C by a summation of flux terms at each face:


$$ \oint_{\partial V_C} d\vec{S} \cdot \vec{J}^{\varphi} = \sum_{\text{faces}(V_C)} \left( \int_{\text{faces}} \vec{J}^{\varphi}_{\text{face}} \right) $$

This result conserves quantities extremely well, the primary advantage of FVM.

Gaussian Quadrature

A conventional means of solution for the surface flux exploits the technique of Gaussian quadrature. Gaussian quadrature integrates across the domain by evaluating the integrand at selected points and weighting the values by certain rules. For instance, to evaluate


−1+1dxex

with a 2-point quadrature, one calculates as follows:

xi ex wi wiex
$-\sqrt{1/3}$ 0.5614 1 0.5614
$+\sqrt{1/3}$ 1.7813 1 1.7813
iwiex = 2.3427

The absolute error is 2.3504 − 2.3427 = 0.0077, and the method is far more efficient for most practical integrals than other rules of integration.

A very similar technique holds for surface integration of the flux.

Figure. Surface flux integration with one, two, and three quadrature points per cell face.

Volumetric Source

The volume integral may be solved using Gaussian quadrature as well over the control volume C. Although only four integration points are depicted graphically, the number involved may vary by squares as well (1, 4, 9, etc.).

Figure. Volumetric source integration with four quadrature points per control volume (cell).

Further Development

The finite volume method can proceed along several lines of generalization at this point based on the quadrature rule for discrete integration and the closure of the integration point fluxes in each discrete volume. These are typically chosen to enforce the constraint that the approximation of the fluxes (both advective and diffusive) leaving one cell are the same as those entering its neighbor (via that interface). The FVM, in practice, often uses only a single integration point for its methods, a balance between computational cost and reliability of results.

Figure. Cell-centered finite volume method terminology.

Cell-centered schemes require between 2–6× the number of data points that vertex schemes do. On the other hand, they provide a comparable increase in accuracy for the same mesh size[CFD forum thread]. (This seems to be something of an open question, being solved by increased total computational power rather than a really tight theoretical argument[Venkatakrishnan1995].)

In some sense, FVM is more natural to implement on a unstructured mesh, and offers better stability. You can think of think of FVM as a simplified or zeroth-order FEM formulation via the divergence theorem, with element properties averaged to the cell center or vertices rather than calculated at nodes. The accuracy is somewhat lower, but in many cases you are looking for qualitative behavior instead of quantitative precision.

If you are interested in knowing more about this topic, ME 412 deals with FVM and the various CFD solution algorithms in the context of heat transfer. AT SCI 502 is also a solid introduction to numerical CFD.

Finally, a strong caveat to the finite volume method: it will almost always yield a converged solution, but it is incumbent upon you to verify whether this solution is physically meaningful or accurate. FVM also introduces more numerical diffusion than FEM typically (which may require a finer mesh to alleviate).

Computational Fluid Dynamics

The foregoing development, although evocative of fluid flow with its discussion of flux and cells, strictly limited itself to a general conserved quantity φ. What does φ become in a fluids simulation?

Fluid mechanics generally concerns the solution of the Navier–Stokes equations or some coherent simplification of these. These equations collectively circumscribe continuum hydrodynamics. The momentum conservation equations (in cartesian form) are:


$$ \begin{align} \rho \left(\frac{\partial u_x}{\partial t} + u_x \frac{\partial u_x}{\partial x} + u_y \frac{\partial u_x}{\partial y} + u_z \frac{\partial u_x}{\partial z}\right) =& -\frac{\partial p}{\partial x} + \mu \left(\frac{\partial^2 u_x}{\partial x^2} + \frac{\partial^2 u_x}{\partial y^2} + \frac{\partial^2 u_x}{\partial z^2}\right) \\ & - \mu \frac{\partial}{\partial x} \left( \frac{\partial u_x}{\partial x} + \frac{\partial u_y}{\partial y} + \frac{\partial u_z}{\partial z} \right) + \rho g_x \\ \rho \left(\frac{\partial u_y}{\partial t} + u_x \frac{\partial u_y}{\partial x} + u_y \frac{\partial u_y}{\partial y}+ u_z \frac{\partial u_y}{\partial z}\right) =& -\frac{\partial p}{\partial y} + \mu \left(\frac{\partial^2 u_y}{\partial x^2} + \frac{\partial^2 u_y}{\partial y^2} + \frac{\partial^2 u_y}{\partial z^2}\right) \\ & - \mu \frac{\partial}{\partial y} \left( \frac{\partial u_x}{\partial x} + \frac{\partial u_y}{\partial y} + \frac{\partial u_z}{\partial z} \right) + \rho g_y \\ \rho \left(\frac{\partial u_z}{\partial t} + u_x \frac{\partial u_z}{\partial x} + u_y \frac{\partial u_z}{\partial y}+ u_z \frac{\partial u_z}{\partial z}\right) =& -\frac{\partial p}{\partial z} + \mu \left(\frac{\partial^2 u_z}{\partial x^2} + \frac{\partial^2 u_z}{\partial y^2} + \frac{\partial^2 u_z}{\partial z^2}\right) \\ & - \mu \frac{\partial}{\partial z} \left( \frac{\partial u_x}{\partial x} + \frac{\partial u_y}{\partial y} + \frac{\partial u_z}{\partial z} \right) + \rho g_z. \end{align} $$

The associated mass continuity equation is
$$ {\partial \rho \over \partial t} + {\partial (\rho u_x ) \over \partial x} + {\partial (\rho u_y) \over \partial y} + {\partial (\rho u_z) \over \partial z} = 0. $$

(The right-hand side may be non-zero if multiple phases are involved, as this is where phase transitions express themselves mathematically.)

There are a number of matters of taste involved in this derivation, like the sign of the stress tensor, but generally this is the equation one needs to simplify and solve[Wikipedia].

FVM does very well with directly-expressed quantities such as mass and momentum preservation (but not necessarily second-order properties such as vorticity or kinetic energy).

Fluent Implementation & Physical Theory

What other quantities does Fluent model?

For all flows, ANSYS Fluent solves conservation equations for mass and momentum. For flows involving heat transfer or compressibility, an additional equation for energy conservation is solved. For flows involving species mixing or reactions, a species conservation equation is solved or, if the non-premixed combustion model is used, conservation equations for the mixture fraction and its variance are solved.

Fluent also supports compressible flow, turbulence, multiphase flow, magnetohydrodynamics, combustible flow, and other models. You can even designate whether a simulation is Eulerian or Lagrangian. An Eulerian model involves a mesh which the fluid flows through (like a pipe or mesh of control volumes). A Lagrangian model, by contrast, describes the fluid itself flowing and deforming, with no material transfer between cells[Wikiversity].

Turbulence manifests as a cascade of self-similar flows across many scales. Thus to resolve turbulence requires an extremely fine grid, down to the millimeter level in some cases. This is impractical (a 100 × 100 × 1000 grid already contains 107 cells with their associated data!). Thus the effect of turbulence is often "bundled" into a kinetic or dissipative energy term with its own governing equation.

Fluent is probably the best general-purpose CFD program available today. Among competitors, COMSOL excels at pores and low-Reynolds-number flows (Stokes flow—think of lava) and has the reputation of a steep learning curve to perform CFD correctly. OpenFOAM and SU2 are both powerful open-source packages, but they are very demanding of the user since they essentially require you to program your governing equations directly. ANSYS CFX is better for turbomachinery. Fluent tends to be good at large turbulent flows as well.

Fluent Workflow

See the associated step-by-step guide to get started using Fluent.

References