Watching Residuals

This section explains the concept of calculating residuals, as well as working with residual monitors, and residual plots.

For using residuals to monitor a solution, see the section on judging convergence.

What Is a Residual?

The residual in each cell represents the degree to which the discretized equation is satisfied. For example, consider the transport equation for a passive scalar and its component terms (the full description can be found at Passive Scalars Transport). When the solver is run, a discretized version of this equation is solved for each cell in the mesh. The residual of this equation is:

r=|tVαiρχϕjV+αiρχϕj(vvg)a([αiχ(μσ+μtσt)ϕj]a+VSϕjV)|
(89)

where:

r is the absolute error in the solution of a particular variable. In a perfectly converged solution, the residual for each variable for each cell would be equal to machine roundoff.

In Simcenter STAR-CCM+, the RMS (Root Mean Squared) value of a residual for all cells is determined from:

Rrms=1nnr2
(90)

where:

n is the number of cells.

Residual monitors keep a record of this global quantity for each of the transport equations solved in the continua within the simulation. As the residuals can vary widely in absolute value, by default a normalized residual, Rpres, is presented. This function allows you to compare multiple residuals as all residuals have a value from 0 through 1. Rpres is determined from:

Rpres=RrmsRnorm
(91)

The normalization value can be set manually to any non-zero value. However, if left at its default, Rnorm, the normalization is automatic:

Rnorm=max{|R1|,|R2|,...,|Rm|}
(92)

where:

R1,R2,...,Rm are the residuals at each iteration.

m is the Normalization Number property that selects the number of iterations to compare before holding a single normalization value. By default, m is set to 5, as this setting removes the influence of the initialization values (reflected in R1,R2) but provides a sensible value for observing convergence that does not change after every iteration.

In general, use normalized residuals to monitor the behavior of the solvers at each iteration to make sure that the solution is converging toward the machine precision. If the simulation is steady state, the convergence is displayed over the total number of iterations. If the solution is time-dependent, make sure that convergence occurs within each time-step. For more details, see the section on judging convergence.

Adding Residual Monitors

Residual monitors are created automatically after model selection, and cannot be deleted or renamed.



When a solver runs, a residual plot is automatically created that displays the residual monitors on semi-log axes.

Residual Monitors Properties

Active

Read-only property to indicate if the models have been changed in this simulation after a simulation was run.

Activated

The monitor is active in the current simulation.

Deactivated

Any monitors specific to the previous models become deactivated unless you delete them.

Trigger

Defines what action triggers the collection of a sample. The default setting depends on whether you are using the Steady model (iterations) or Implicit Unsteady model (time-steps).

Iteration

A sample is taken every N iterations.

Time-Step

A sample is taken every N time-steps.

Inactive

No sample is taken.

Maximum Plot Samples

Limits the number of sample points that used in the monitor plot.

Frequency

Determines how often the sample is taken using the units that are specified in Trigger.

Normalization Option

Defines how the monitor data is normalized.

Off

Do not normalize.

Auto

Lets Simcenter STAR-CCM+ do the normalization as derived in the Automatic Normalization node that is added as a sub-node when you choose this option.

Manual

Lets you define a specific normalization factor in the Manual Normalization node that is added as a sub-node when you select this option.

What Is a Residual Plot?

The residual plot is a monitor plot that is automatically created from the active residual monitors on semi-log axes when iterating starts. A sample residual plot is shown below.



By default, all active residuals are displayed in the residual plot. The residual plot can be renamed but it cannot be deleted, though individual data series can be deleted from the plot.

The residual plot uses the same properties as the monitor plot.

Adding and Removing Residuals from the Residual Plot

All monitored residuals are displayed in the residual plot by default. Specific residual monitors can be removed from the plot by right-clicking on the node or nodes in the Monitors node under the Residual Plot node and selecting Remove. Alternatively, you can right-click on the Monitors node and select Edit... to access the Customizer dialog to add and remove monitors from the plot.

The residual plot monitors customizer allows you to add and remove specific residual monitors from the plot.



Adding or removing residual monitors does not affect the currently selected models or the stored data; only the plotting of the residuals is affected. However, these changes are not saved to the simulation file. The residual plot is reset to include the residuals from all of the selected models when you change the currently selected models.