**3. Stability of CFD simulations and the CFD process**

As indicated in the discussion of **Figures 1** and **2**, many applications of CFD are inherently unsteady. Consider for example CFD for weather forecasting where local velocity, pressure and temperatures are varying continuously. In other cases, the flow situation may initially appear steady, with steady boundary conditions. However, the flow patterns emerge as naturally unsteady. **Figure 3** provides an example of such a situation. There, steady flow approaches a small square cylinder from the left. In the downstream wake region, the flow expresses unsteady alternating vortices (the so-called Karmen vortex structure). Whenever flow experiences unsteadiness, a modeler should consider the time steps required for solution stability. Even with a situation like that of **Figure 3**, integration forward in time and stability criteria are important.

The unsteadiness, in connection with the coupled nature of the nonlinear equations, make the stability of the solutions a particular vexing issue. In fact, the issue of stability was recognized in the early 1900s and criteria for stability were soon

*Introductory Chapter: A Brief History of and Introduction to Computational Fluid Dynamics DOI: http://dx.doi.org/10.5772/intechopen.97235*

**Figure 1.** *Numerical grid distribution, from [2].*

#### **Figure 2.**

*Artist depiction of the Richardson "fantastic weather factory" Image: ink and watercolour © Stephen Conlin 1986. All Rights Reserved. Based on advice from Prof. John Byrne, Trinity College Dublin.*

developed. In 1928 [3] a stability criterion was developed that provided a limitation to the time step that could be used in unsteady problems. The criterion, now termed the (Courant–Friedrichs–Lewy) CFL condition, is still used today. In short, the CFL conditions stipulates that information cannot flow entirely across a computational element in a single time step. Consequently, the local velocity of fluid, multiplied by the time step, must be smaller than the element size. This issue was highlighted in **Figure 2**, by the imagined red and blue spotlights.

#### *Applications of Computational Fluid Dynamics Simulation and Modeling*

**Figure 3.**

*An unsteady flow that results from steady boundary conditions.*

The CFL criterion was developed for explicit numerical schemes but it is also used for implicit schemes as a timestep benchmark. It is worthwhile to discuss "explicit" and "implicit" numerical schemes. To aid in the discussion, **Figure 4** is provided. There, a user begins a CFD analysis by creating the flow geometry (which includes the volume occupied by the fluid). Next, the computational mesh is created (which is a collection of grid cells used to subdivide the domain.

An example of the computational mesh that was used to provide the results set forth in **Figure 3**, is shown below. These images are from the present authors' research but are typical of general CFD mesh deployments. In the figure, a series of images are provided with increasing focus on the fluid region adjacent to a square object. As seen in the series of images, the elements in the vicinity of the object are much finer than elements in further away. The use of locally refined elements is a technique to provide high accuracy in areas that are of critical importance to the analysis.

Typically, a researcher will not know *a priori* whether a particular mesh is suitable for a calculation. The requirements of the mesh depend in part on the necessary accuracy of the simulations. However, it is common for researchers to perform mesh refinement studies to ensure a level of accuracy. In a mesh refinement

**Figure 4.** *The CFD process.*

#### *Introductory Chapter: A Brief History of and Introduction to Computational Fluid Dynamics DOI: http://dx.doi.org/10.5772/intechopen.97235*

study, the user will refine a computational mesh and perform replicate simulations, until further refinement of the mesh does not lead to significant changes in the results. Such a situation is termed "mesh independent". It is standard practice that final solutions are mesh independent and at least within the scientific literature, mesh-independent solutions are standard. For unsteady simulations, the size of the time step is also important and similar time-step independent studies can also be performed.

With the computational mesh now created, the user moves to the next step in the process which is the application of boundary and initial conditions. Traditionally, initial conditions refer to the starting conditions of an unsteady problem. However with CFD, initial conditions are necessary even if the problem is truly steady state. For steady problems, initial conditions are the solution that commences the iterations.

Next, the numerical method and solver controls are defined. This step includes decisions such as:


Next, the actual calculations can commence. The calculations involve iterating to convergence the coupled nonlinear equations. At each computational element (grid cell) the equations of mass, momentum, and energy conservation are applied. So to are the equations of turbulence. For a two-equation turbulent model, each grid cell will require seven equations (mass, three momentum, one energy, two turbulence). Consequently, a 1,000,000 element simulation will result in 7,000,000 coupled, nonlinear equations. Obviously an iteration solution strategy is required.

This iteration procedure results in a solution at the first time step. Since a time step has been taken, the CFL stability criterion is employed. Traditionally, the CFL stability criterion is enforced for explicit time-stepping schemes, but not for implicit methods. With an implicit time-stepping method, the results at the next time step are solely based on the solution at the prior time step. A result of an explicit scheme is that the equations are simpler to formulate and solve, compared to implicit methods.

As an alternative to explicit time stepping, a user may wish to use an implicit approach. With implicit algorithms, the pressure, velocity, temperature and turbulent results at a future time step depend both on the results of the prior time step as well as on the results of the future time step. Obviously, such a definition requires a more comprehensive sub-iteration procedure in order to converge to a solution, but the results are categorically stable (and therefore not subject to the CFL criterion). There are variations in implicit schemes, for example a fully implicit scheme relies only on information at the current time step. On the other hand, a Crank-Nicholson scheme relies equally upon results at a prior and future time step. Regardless of the details, implicit schemes are stable.

In our view, the stability of implicit schemes is not a strength, rather it is a weakness. The basis for this opinion is that it is possible to use a time step that is too large to achieve accurate solutions with an implicit solver, but the solution will nevertheless be stable. An unexperienced CFD research may presume that a stable solution is also an accurate solution – but this presumption is often in error. Therefore, even when using an implicit time stepping scheme, the user should pay close attention to the influence of time step size on accuracy and we recommend that the CFL criterion be applied as a guide for determining the required time step size.

It is also important to recognize that the time step size varies inversely with the element size. Consequently, when elements are made small to improve accuracy, the time steps also must become smaller to ensure convergence. Because of this, for unsteady calculations, a mesh refinement study will require more effort to solve each iteration, and more time steps are required because the time steps must be accordingly smaller.

The above discussion relates to what are often termed "numerical error". But there is another, more nuanced source of error we refer to as "modeling error". Modeling error is not related to element size or time step size, it is instead focused on the inexact input of material properties, boundary conditions, and other features of the simulation. Colloquially, we refer to "garbage in gives garbage out" and this adage is true. Insofar as inputs to the computational model deviate from a real-life situation, a user can expect differences between the simulated and actual results. In our experience, modeling errors are more significant than numerical errors. They are often much harder to diagnose and remove. Our recommendation is that CFD users pay particular attention to ensuring the inputs to their computational model match the expected inputs in real life.
