CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Residuals? (

Tom November 26, 2002 06:44


I want to know more about residuals. How is residuals computed during a simulation and what reduction in residual is required before continuing to the next iteration (steady state) or time step (transient)?

Does it imply multiplying the coeffient matrix with the approx. solution and subtracting this from the source vector?

Does residuals only play a role when using iterative solvers and not when using direct solvers?

How does residual normalization work. i.e. that the residuals of all variables solved have the same initial value for example 1 and then reduces to whatever?

What is the link between residual and convergence?

Thank you.

Regards Tom

Praveen November 27, 2002 08:44

Re: Residuals?
Most numerical computations will involve an iterative procedure. If you are interested in the steady state solution then you will monitor the change in some variable from one level to the next. Even for transient simulations you will have inner iterations if you are using an implicit scheme. I use the following definition of the residue,

residue = L2-norm at the current iteration/L2-norm in the first iteration.

I generally use the L2 norm of the density and go upto about 6 decade reduction; in the first iteration residue=1, and I stop when residue<1e-6. Of course this is not a sacrosant number. Also, density may not be a good indicator of convergence always, e.g., very low mach number flows. Try to choose a variable that is expected to change considerably as the simulation progresses.

student November 27, 2002 10:23

Re: Residuals?
what is L2-norm here please. could you define it in general.

Tom November 27, 2002 11:40

Re: Residuals?
Basically the L^2 norm of a function, f say, is the square root of the ingegral of the square of the function over the domain. The L stands for Lebesgue (as in Lebesgue integration) and the 2 denotes the fact it's the integral of a square.

Praveen November 27, 2002 13:06

Re: Residuals?
In the numerical context we might only know the function at discrete number of points. (In FEM the numerical solution if known everywhere in the domain). We must use the discrete L2 norm

||f|| = sqrt( (sum_i f_i^2)/N )

where N is the number of data points at which the function is known. The mathematically correct expression whould be

||f|| = sqrt( (sum_i (f_i h_i)^2) )

where h_i is the size of the i'th cell. Note that this is a discrete analog of the integral L2 norm. When the grid is uniform people usually do not write the h_i. But when the grid is not uniform the second expression should be used, especially if you doing an error analysis by grid refinement, but when your purpose is merely to check convergence the first expression will do. Note that in general h_i is the "volume" of the finite volume, length, area and volume in 1d, 2d and 3d, respectively.

For a nice description of these things in more detail see the notes of Randy Leveque here (Appendices 1, 2)

Tom November 28, 2002 01:50

Re: Residuals?
Thank you for your responses

I have another question on residuals and the solution of PDE. If I am only solving a single equation for exampe the diffusion equation for heat conduction, and the equation is linear, i.e. my coefficients are not a function of temperature:

Then do I still have to iterate to obtain the solution or do I simply solve my system to a reasonable residual tolerance?

In general if we have a system of uncoupled PDE's to solve is iteration still required?

Thank you

Tom November 28, 2002 05:09

Re: Residuals?
It depends on your method. If you use a direct solver then you do not need to iterate - you simply solve the linear matrix problem. However if you don't use a direct solver then you must iterate to get a solution; i.e. you use an iterative matrix solver such as conjugate gradient, multigrid, etc.

(The other) Tom.

All times are GMT -4. The time now is 22:35.