# Part 2: Judging Convergence

# 1.0 Introduction

How do you know when the computer finishes solving? Computational Fluid Dynamics (CFD) utilizes an iterative process to solve CFD problems. The computer continuously guesses and refines its solution. As the CFD engineer, you need to specify criteria and determine when to stop the solution process. The exact criteria depend on the specifics of your problem; they require you read the situation and adapt to new requirements. This is the art of judging convergence.

A CFD engineer employs three main tools to judge converge:

- Monitors
- Flow patterns
- Residuals

Today we learn about these tools. How to use them, where to use them, and what to expect from each tool.

# 2.0 Monitors

Monitors are real time measurements tied to relevant physical outputs from your simulation. For example, if the simulation predicts water resistance on a ship, the CFD engineer may create a monitor of force in the X-direction on the ship body. Not exactly the same as the final output, but directly related to it. Monitors provide relevant context. They show variation in the calculated outputs planned for that simulation.

The engineer should prepare one monitor for each major simulation output. These monitors change during simulation initialization, but they should eventually stabilize to a constant value (for steady state simulations). That is the point of convergence. In some simulations, they may also oscillate, but the oscillations should be regular with steady amplitude. They key for a converged simulation requires a stable monitor value with a regular pattern.

# 3.0 Flow Patterns

Flow patterns provide another check for a converged simulation; these act more as a form of quality control. The monitors and residuals focus on the mathematical accuracy of the simulation, but the flow patterns check the practical sensibility. Remember that the CFD solver is essentially a giant math equation solver. It doesn’t care if the equations have practical meaning; it only knows if the equations balance. Equations can balance with both sensible and ridiculous solutions. As engineers, we prefer the sensible solution. After completing the simulation, the CFD engineer should check flow patterns to ensure they make sense.

- Ensure all flow patterns match reasonable expectations for the relevant physical features
- Check for any irregular patterns. These might indicate a problem with the solution
- Look for sharp velocity spikes or pressure spikes
- Check for lack of any flow patterns. Regions with no change in velocity or pressure. This might indicate a trivial solution.

# 4.0 Residuals

The residuals plot is the main tool for judging convergence; it monitors the solution of the fundamental equations for the a CFD simulation. A typical CFD simulation includes equations for momentum, pressure, and turbulence, and the solver performs iterative solutions of these equations. The residuals plot shows the **difference** between **successive** solutions of these equations.

The solutions are aggregated and normalized so that each equation gets represented by a single number, with all numbers scaled to a common range. All residuals get plotted on one graph (with Y-axis as log scale) to allow the CFD engineer to study interactions between the equations. (Figure 4‑1)

A good residuals plot has several characteristics to identify. The key element is decreasing lines, downward slopes. Residuals should always decrease. The sawtooth pattern in Figure 4‑1 happens in unsteady simulations. Each spike represents a new timestep. Successive spikes should show decreasing peaks, or at least show each peak at the same height.

CFD engineers also expect general targets for the residuals in converged simulations. The lowest value that the residual achieves is the minimum iteration error for that simulation (or for that timestep in an unsteady simulation). Use the following targets as guidelines on corresponding simulation quality:

- 1x10
^{-3}: Just a pretty picture. Don’t trust the numbers - 1x10
^{-5}: Excellent, reliable result - 1x10
^{-6}: Insane quality. No need for that much - For free surface flows, add 1x10
^{2}to all levels.

These are generalized targets. Your own experiences may vary, depending on the simulation. Sometimes the residuals plot lies. And some solvers normalize their residuals differently, making these targets completely irrelevant. Now you see why CFD engineers rely on more than one tool to judge convergence.

## 4.1 Troubleshooting Residuals

The residuals are more than just a tool for judging convergence. They also provide feedback for troubleshooting bad simulations. The pattern of the residuals provide clues to why a simulation fails.

**If the residuals for a single equation go bad, look for trouble spots in the mesh.** That residual may initially shoot in a downward trend, and then suddenly spike upward and diverge. Or start to diverge almost from simulation initialization. In this case, the problem is almost always a problem somewhere in the simulation mesh. The specific equation that diverged may provide clues the source of your trouble.

**If the residuals are constantly bad, change the order of interpolation. **The residuals for a specific equation may simply refuse to converge, but they don’t actually diverge. Yet all the other residuals show stable convergence. In this case, try changing the order of interpolation from 2^{nd} order down to 1^{st} order for your single problem equation. A simpler order of interpolation may add greater stability to the equations. This will also reduce simulation accuracy, which is a compromise that you may not want to make, depending on the equation.

**If the residuals are oscillating and not showing a strong downward trend, try reducing the under-relaxation factor.** This may help introduce some more stability and dampen out those oscillations. Remember that reducing the under-relaxation factor also reduces the effective update to the solution per iteration. You may need to apply more iterations per timestep to ensure you get a converged solution.

# 5.0 Conclusion

Convergence is not an exact science. As the CFD engineer, you do not have the luxury of judging a binary system: pass / fail. Instead, you build a preponderance of evidence. You employ three tools to judge convergence: monitors, flow patterns, and residuals. Each tool fails in its own way, with weakness in the information it reports. As the CFD engineer, you have the flexibility. You combine all three tools and build a composite picture to reliably judge convergence in any simulation.

# 6.0 References

[1] | TCFD, “Axial Compressor CFD,” TCFD, 31 Dec 2018. [Online]. Available: https://www.cfdsupport.com/axial-compressor-cfd-simulation.html. [Accessed 31 Dec 2018]. |

[2] | Atsushi Ueyama, “Progress of Time,” Cradle MSC Software Company, 31 Dec 2018. [Online]. Available: https://www.cradle-cfd.com/tec/column01/017.html. [Accessed 31 Dec 2018]. |

[3] | YouTube Author: Holzmann CFD, “Holzmann CFD & OpenFOAM® – Dynamic Meshes in Multiphase Flows #2 (Topology Change, Ship Simulation),” YouTube, 10 Feb 2018. [Online]. Available: https://www.youtube.com/watch?v=B9KjnyDpsx0. [Accessed 31 Dec 2018]. |