Required field
Required field
Required field

# How to Tell When and Where the Simulation Starts Diverging?

In this article, we will present a feature available in SimScale that shows when and where divergence occurs within a simulation.

## Approach

Computational Fluid Dynamics (CFD) simulations are highly iterative processes. In successful runs, the results converge to a final, stable solution. However, for several reasons, the solution may also diverge. When this happens, parameters within the domain can reach unphysical levels.

To help users identify and troubleshoot divergence in their simulations, SimScale has a divergence monitor. The following parameters are tracked: velocity, pressure, density, and temperature. Whenever a parameter reaches unphysical levels in the domain, the simulation automatically stops with an error message:

The error message specifies which parameter diverged and also the exact location in the model. This information is valuable, and can be a starting point for the troubleshooting process.

## Troubleshooting

To gain more insight into the causes of divergence, the following basic steps are useful:

1. Create a ‘probe point‘ result control and input the coordinates displayed in the error message. In doing so, you will see exactly where the divergence occurred;
2. If the point is close to one of the boundaries, double-check all boundary conditions, making sure they are correct;
3. If the point is located inside the domain, inspect the mesh around the area. The ‘mesh quality‘ visualization feature is very useful in this step. Even just a few bad quality cells can create instabilities in the simulation, ultimately leading to divergence.

### Divergence Example

To illustrate the procedure, let’s go through an example. This case is an external compressible flow simulation around a wing. The monitor reports a divergence for the pressure field at a specific point within the domain:

By creating a probe point and specifying the coordinates above, we can see that the divergence started on the tip of the wing:

Upon clicking on ‘mesh quality‘, the post-processing environment opens. A very useful filter to spot bad cells is isovolumes. By selecting a quality parameter and changing the minimum and maximum iso values, the bad cells are easily located:

The mesh contains cells with up to 158 volume ratio, which is too high (recommended value $$\ll$$ 100). Furthermore, the location is the same as reported in the error message. In this case, the mesh requires improvement to run the simulation.

Note