Required field
Required field
Required field
Required field
• Set up your own cloud-native simulation in minutes.

• Documentation

# 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
4. If you do have bad cells, make sure to inspect the CAD model around the problematic region. Look for very small faces, very detailed topology, and small gaps. These can sometimes cause poor mesh quality.

### 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 (the recommended value is $$\ll$$ 100). Furthermore, the location is the same as reported in the error message. In this case, two main workflows are possible:

• CAD clean-up around the problematic region
• Improving the mesh settings (for example, by applying additional local refinement, or improving the small feature suppression configuration)

Note