## 25.18.1 Monitoring Residuals

At the end of each solver iteration, the residual sum for each of the conserved variables is computed and stored, thus recording the convergence history. This history is also saved in the data file. The residual sum is defined below.

On a computer with infinite precision, these residuals will go to zero as the solution converges. On an actual computer, the residuals decay to some small value ("round-off'') and then stop changing ("level out''). For single-precision computations (the default for workstations and most computers), residuals can drop as many as six orders of magnitude before hitting round-off. Double-precision residuals can drop up to twelve orders of magnitude. Guidelines for judging convergence can be found in Section  25.22.1.

Definition of Residuals for the Pressure-Based Solver

After discretization, the conservation equation for a general variable at a cell can be written as

 (25.18-1)

Here is the center coefficient, are the influence coefficients for the neighboring cells, and is the contribution of the constant part of the source term in and of the boundary conditions. In Equation  25.18-1,

 (25.18-2)

The residual computed by FLUENT's pressure-based solver is the imbalance in Equation  25.18-1 summed over all the computational cells . This is referred to as the "unscaled'' residual. It may be written as

 (25.18-3)

In general, it is difficult to judge convergence by examining the residuals defined by Equation  25.18-3 since no scaling is employed. This is especially true in enclosed flows such as natural convection in a room where there is no inlet flow rate of with which to compare the residual. FLUENT scales the residual using a scaling factor representative of the flow rate of through the domain. This "scaled'' residual is defined as

 (25.18-4)

For the momentum equations the denominator term is replaced by , where is the magnitude of the velocity at cell .

The scaled residual is a more appropriate indicator of convergence for most problems, as discussed in Section  25.22.1. This residual is the default displayed by FLUENT. Note that this definition of residual is also used by Fluent Inc.'s structured grid solver FLUENT 4.

For the continuity equation, the unscaled residual for the pressure-based solver is defined as

 (25.18-5)

The pressure-based solver's scaled residual for the continuity equation is defined as

 (25.18-6)

The denominator is the largest absolute value of the continuity residual in the first five iterations.

The scaled residuals described above are useful indicators of solution convergence. Guidelines for their use are given in Section  25.22.1. It is sometimes useful to determine how much a residual has decreased during calculations as an additional measure of convergence. For this purpose, FLUENT allows you to normalize the residual (either scaled or unscaled) by dividing by the maximum residual value after iterations, where is set by you in the Residual Monitors panel in the Iterations field under Normalization.

 (25.18-7)

Normalization in this manner ensures that the initial residuals for all equations are of and is sometimes useful in judging overall convergence.

By default, . You can also specify the normalization factor (the denominator in Equation  25.18-7) manually in the Residual Monitors panel.

Definition of Residuals for the Density-Based Solver

A residual for the density-based solver is simply the time rate of change of the conserved variable ( ). The RMS residual is the square root of the average of the squares of the residuals in each cell of the domain:

 (25.18-8)

Equation  25.18-8 is the unscaled residual sum reported for all the coupled equations solved by FLUENT's density-based solver.

 The residuals for the equations that are solved sequentially by the density-based solver (turbulence and other scalars, as discussed in Section  25.1.2) are the same as those described above for the pressure-based solver.

In general, it is difficult to judge convergence by examining the residuals defined by Equation  25.18-8 since no scaling is employed. This is especially true in enclosed flows such as natural convection in a room where there is no inlet flow rate of with which to compare the residual. FLUENT scales the residual using a scaling factor representative of the flow rate of through the domain. This "scaled'' residual is defined as

 (25.18-9)

The denominator is the largest absolute value of the residual in the first five iterations.

The scaled residuals described above are useful indicators of solution convergence. Guidelines for their use are given in Section  25.22.1. It is sometimes useful to determine how much a residual has decreased during calculations as an additional measure of convergence. For this purpose, FLUENT allows you to normalize the residual (either scaled or unscaled) by dividing by the maximum residual value after iterations, where is set by you in the Residual Monitors panel in the Iterations field under Normalization.

Normalization of the residual sum is accomplished by dividing by the maximum residual value after iterations, where is set by you in the Residual Monitors panel in the Iterations field under Normalization:

 (25.18-10)

Normalization in this manner ensures that the initial residuals for all equations are of and is sometimes useful in judging overall convergence.

By default, , making the normalized residual equivalent to the scaled residual. You can also specify the normalization factor (the denominator in Equation  25.18-10) manually in the Residual Monitors panel.

Overview of Using the Residual Monitors Panel

All inputs controlling the monitoring of residuals are entered using the Residual Monitors panel (Figure  25.18.1).

Solve Monitors Residual...

or

Plot Residuals...

In general, you will only need to enable residual plotting and modify the convergence criteria using this panel. Additional controls are available for disabling monitoring of particular residuals, and modifying normalization and plot parameters.

Printing and Plotting Residuals

By default, residual values for all relevant variables are printed in the text (console) window after each iteration. If you wish to disable this printout, turn off Print under Options. To enable the plotting of residuals after each iteration, turn on Plot under Options. Residuals will be plotted in the graphics window (with the window ID set in the Window field) during the calculation.

If you wish to display a plot of the current residual history, simply click the Plot push button.

Storing Residual History Points

Residual histories for each variable are automatically saved in the data file, regardless of whether they are being monitored. You can control the number of history points to be stored by changing the Iterations entry under Storage. By default, up to 1000 points will be stored. If more than 1000 iterations are performed (i.e., the limit is reached), every other point will be discarded--leaving 500 history points--and the next 500 points will be stored. When the total hits 1000 again, every other point will again be discarded, etc. If you are performing a large number of iterations, you will lose a great deal of residual history information about the beginning of the calculation. In such cases, you should increase the Iterations value to a more appropriate value. Of course, the larger this number is, the more memory you will need, the longer the plotting will take, and the more disk space you will need to store the data file.

Controlling Normalization

By default, scaling of residuals (see Equations  25.18-4 and 25.18-9) is enabled and the default convergence criterion is for energy and P-1 equations and for all other equations. Residual normalization (i.e., dividing the residuals by the largest value during the first few iterations) is also available but disabled by default.

Normalization can be used with both scaled and unscaled residuals. Note that if normalization is enabled, the convergence criterion may need to be adjusted appropriately. See Section  25.22.1 for information about judging convergence based on the different types of residual reports. (Both the raw residuals and scaling factors are stored in the data file, so you can switch between scaled and unscaled residuals.) To report unscaled residuals, simply turn off the Scale option under Normalization.

 If you switch from scaled to unscaled residuals (or vice versa) and you are normalizing the residuals (as described below), you must click the Renorm button to recompute the normalization factors.

If you wish to normalize the residuals (see Equation  25.18-7 or 25.18-10), turn on the Normalize option under Normalization. The Normalization Factor column will be added to the panel at this time. FLUENT will normalize the printed or plotted residual for each variable by the value indicated as the Normalization Factor for that variable. The default Normalization Factor is the maximum residual value after the first 5 iterations. To use the maximum residual value after a different number of iterations (i.e., specify a different value for in Equation  25.18-7 or 25.18-10), you can modify the Iterations entry under Normalization.

In some cases, the maximum residual may occur sometime after the iteration specified in the Iterations field. If this should occur, you can click the Renorm button to set the normalization factors for all variables to the maximum values in the residual histories. Subsequent plots and printed reports will use the new normalization factor.

You can also specify the normalization factor (the denominator in Equation  25.18-7 or 25.18-10) explicitly. To modify the normalization factor for a particular variable, enter a new value in the corresponding Normalization Factor field in the Residual Monitors panel.

If you wish to report unnormalized, unscaled residuals (Equation  25.18-3 or 25.18-8), disable the Normalize and Scale options under Normalization in the Residual Monitors panel. Note that unnormalized, unscaled residuals are stored in the data file regardless of whether the reported residuals are normalized or scaled.

Choosing a Convergence Criterion

The ability to choose certain convergence criteria provides the user with alternative ways to check convergence when using the iterative transient solver. The various convergence criteria can be selected in the Residual Monitors panel from the Convergence Criterion drop-down list.

Solve Monitors Residual...

Four options are available for checking an equation for convergence:

absolute   This is the default. For steady-state cases, absolute and none are the only options available for selection. The residual (scaled and/or normalized) of an equation at an iteration is compared with a user-specified value. If the residual is less than the user-specified value, that equation is deemed to have converged for a timestep.

relative   The residual of an equation at an iteration of a timestep is compared with the residual at the start of the timestep. If the ratio of the two residuals is less than a user-specified value, that equation is deemed to have converged for a timestep.

relative or absolute   If either the absolute convergence criterion or the relative convergence criterion is met, the equation is considered converged.

The Relative Criteria can be set when relative or relative or absolute is selected.

none   Convergence checking is disabled.

In many situations, the absolute convergence criterion could be too stringent for transient flows causing a large number of iterations per timestep. For example, the scaling of the continuity equation is based on the value of the continuity residual in the first five iterations. The scaling factor could be low if the initial continuity residual is small and thus the scaled residual could fail to meet the absolute convergence criterion. With the relative convergence criterion, convergence is checked by comparing the residual at an iteration of a timestep with the residual at the beginning of the timestep and hence this problem is alleviated. The relative or absolute convergence criterion is useful in situations where the residuals of some of the equations are already very low at the start of a timestep (for example, when a particular variable has reached steady state), and the order of magnitude reduction in residuals is not possible. The none option allows you to disable convergence checking by selecting the option in the Convergence Criterion drop-down list.

 relative and relative or absolute convergence criteria are available only with the unsteady pressure-based solver and unsteady density-based solver.

The text command used to access the convergence criterion is

solve monitors residual criterion-type

When criterion-type is entered, you will have the following choices:

 Criterion Type 0 absolute 1 relative 2 relative or absolute 3 none

For criterion-type 1 or 2, the text command relative-conv-criteria will appear under the residual text menu, where the various relative-conv-criteria can be set.

 If the NITA solver is enabled, no convergence criteria are available for selection.

Modifying Convergence Criteria

Depending on the Convergence Criterion you choose, FLUENT will check for convergence. If convergence is being monitored, the solution will stop automatically when each variable meets its specified convergence criterion. Convergence checks can be performed only for variables for which you are monitoring residuals (i.e., variables for which the Monitor option is enabled).

You can choose whether or not you want to check the convergence for each variable by enabling or disabling the Check Convergence option for it in the Residual Monitors panel. To modify the convergence criterion for a particular variable, enter a new value in the corresponding convergence criterion field.

Disabling Monitoring

If your problem requires the solution of many equations (e.g., turbulence quantities and multiple species), a plot that includes all residuals may be difficult to read. In such cases, you may choose to monitor only a subset of the residuals, perhaps those that affect convergence the most. You can indicate whether or not you want to monitor residuals for each variable by enabling or disabling the relevant check box in the Monitor list of the Residual Monitors panel.

Plot Parameters

If you choose to plot the residual values (either interactively during the solution or using the Plot button after calculations are complete), there are several display parameters you can modify.

In the Window field under Plotting, you can specify the ID of the graphics window in which the plot will be drawn. When FLUENT is iterating, the active graphics window is temporarily set to this window to update the residual plot, and then returned to its previous value. Thus, the residual plot can be maintained in a separate window that does not interfere with other graphical postprocessing.

You can modify the number of residual history points to be displayed in the plot by changing the Iterations entry under Plotting. If you specify points, FLUENT will display the last history points. Since the axis is scaled by the minimum and maximum values of all points in the plot, you can zoom in on the end of the residual history by setting Iterations to a value smaller than the number of iterations performed. If, for example, the residuals jumped early in the calculation when you turned on turbulence, that peak broadens the overall range in residual values, making the smaller fluctuations later on almost indistinguishable. By setting the value of Iterations so that the plot does not include that early peak, your -axis range is better suited to the values that you are interested in seeing. For more information on residual history points, please refer to the discussion of storing residual history points, described earlier in this section.

You can also modify the attributes of the plot axes and the residual curves. Click the Axes... or Curves... button to open the Axes panel or Curves panel. See Sections  28.8.8 and 28.8.9 for details.

 Note that entering a value for Iterations under Plotting does not necessarily mean solved iterations but rather stored (or sampled) data points. Note also that the frequency of the data storage will diminish towards the start of the solution as the number of solved iterations increases. Due to this, whenever the stored iterations is greater than the solved iterations, if you plot n iterations, you actually see a history that goes back further than n solved iterations.

Postprocessing Residual Values

If you are having solution convergence difficulties, it is often useful to plot the residual value fields (e.g., using contour plots) to determine where the high residual values are located. When you use one of the density-based solver, the residual values for all solution variables are available in the Residuals... category in the postprocessing panels. (If you read case and data files into FLUENT, you will need to perform at least one iteration before the residual values are available for postprocessing.) For the pressure-based solver, however, only the mass imbalance in each cell is available by default.

If you want to plot residual value fields for a pressure-based solver calculation, you will need to do the following:

1.   Read in the case and data files of interest (if they are not already in the current session).

2.   Use the expert command in the solve/set/ text menu to enable the saving of residual values.

solve set expert

Among other questions, FLUENT will ask if you want to save cell residuals for postprocessing. Enter yes or y, and keep the default settings for all of the other questions (by pressing the <RETURN> key).

3.   Perform at least one iteration.

The solution variables for which residual values are available will appear in the Residuals... category in the postprocessing panels. Note that residual values are not available for the radiative transport equations solved by the discrete ordinates radiation model.

Previous: 25.18 Monitoring Solution Convergence
Up: 25.18 Monitoring Solution Convergence
Next: 25.18.2 Monitoring Statistics