CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Numerical diffusion error (

Z.Zeng October 20, 1999 07:52

Numerical diffusion error
In CFD, is there any scheme which is free of numerical diffusion error ?

Duane Baker October 20, 1999 08:54

Re: Numerical diffusion error
Hi Z.Zeng,

the numerical error is not just a function of the scheme, it also depends on the field being solved, specifiallygradient of a gradient or higher gradients thereof, etc. So, for simple problems we can develop a schem which has no error such as has been done for 1-D transinet advection equations and for the ss-1D advection-diffusion problem (exponential upwinding scheme) BUT this often has little to do with real problems, especially the NS equations! Schemes also have dispersive error which disperses (spreads) out different component wavelengths which then looks like wiggles in the numerical solution! A good place to start is reading Ferziger and Pericīs Computional Methods for Fluid Dynamics.

Best of luck...........................Duane

Patrick Godon October 20, 1999 09:44

Re: Numerical diffusion error
High order methods have naturally less numerical diffusion than low order methods.

A usual finite difference method is of order 2, 3 or even more. In this case it means that you represent the derivatives of the function (say f) at a point (say i) using the values of the function at a few points (for example the points i+2, i+1, i, i-1, i-2).

A high order method uses a large number of point to calculate the derivatives, and is therefore more accurate (which leads to less numerical diffusion).

Spectral Methods are high order methods. If you have N grid points, the order of the method is actually N. This means that you use all the points given, to compute the derivative of the function at a given point. This enable people to study the fine structure of the flow, however, the problem is that these high order methods can poorly help to solve problems involving shocks and jump in functions.

For example the Fourier Spectral method uses discrete Fourier Transform (FFT on the computer) to compute the derivatives.

Here are some good reference book for Spectral Methods:

Gottlieb and Orszag, 1977, Numerical Analysis of Spectral Methods: Theory and Applications, NSF-CBMS Monograph, n.26, Soc. Ind. and Appl. Math., Philadelphia, PA.

Voigt, Gottlieb, Hussaini, 1984, Spectral Methods for Partial Differential Equations, SIAM-CBMS, Philadelphia, PA

and mainly this one:

Canuto, Hussaini, Quarteroni and Zang, 1988, Spectral Methods in Fluid DYnamics, Springer-Verlag, Berlin.

Adrin Gharakhani October 20, 1999 14:41

Re: Numerical diffusion error
With all due respect, I disagree with the previous assessments of the cause of numerical diffusion. While evaluating gradients accurately helps _minimize_ numerical diffusion, the implication that field gradients and numerical diffusion are synonomous is false!

In the Navier Stokes equations, the highest gradients are those of the Laplacian for the diffusion process. Does this mean that evaluating this laplacian with low accuracy is the same as introducing false diffusion? Absolutely not! Otherwise we would have to sweep all accuracy and convergence studies under the rug of false diffusion.

As discussed by Patankar in his book, false diffusion develops due to the inaccurate discretization of the _nonlinear convective_ term in N-S equations. One can easily show that "low order" discretization of the _convective_ term yields a Laplacian term - thus the terminology false diffusion.

False diffusion is a function of a few parameters - most important being the alignment of the local streamlines with respect to the local grids. The second parameter of importance is the grid size. So, if a scheme is devised that continually aligns the local grids with the local streamline one will have a numerical scheme with ZERO false diffusion. You can actually devise such a scheme with the _lowest_ order differencing scheme possible. Thus the argument that you need to resolve gradients with high order accuracy really ignores the root cause of the problem (the alignment business). Naturally, high order gradients are in practice equivalent to implementing this alignment stuff as well as reducing the "effective" grid size. But one has to be careful with cause and effects.

Having said that, the answer to the original question is yes you can devise schemes that are (theoretically) free of numerical diffusion. These are called Lagrangian methods and they are the underlying theme for grid-free vortex methods. Note, that Lagrangian schemes are not unique to grid-free methods and can be used with grid-based solutions as well (The idea behind the famous ALE approach is exactly this). In the Lagrangian approach (grid-based or grid-free) the collocation points move with the local velocity (which means that they are aligned with the streamline/streakline) and thus "totally" remove false diffusion. In this case, one really need not evaluate spatial gradients to begin with because the material derivative (which includes a space derivative) is just a time derivative in the Lagrangian coordinate system. So, accurate time integration is the only thing one has to work on.

Again, read Patankar's book on the derivation of the parameters causing numerical diffusion. And read papers on ALE methods and grid free vortex methods

Adrin Gharakhani

John C. Chien October 20, 1999 18:08

Re: Numerical diffusion error
(1). There is no such thing as "numerical scheme with numerical diffusion error". (2). But there is artificial viscosity and artificial diffusion terms. These are explicit terms which are artificially added to the original equations in order to control the convergence or the behavior of the solution. Without such artificially added diffusion terms, most of the time, wiggles in the solution to the inviscid equation will appear. Sometimes, it will give you negative density, or even diverged solution. (3). The use of artificially added diffusion terms in the original equation to stabilize the solution has been used since 50's. So, even today, if you run into stability problem in solving compressible flow problem, you would consider this option to control the convergence or stability problem. (4). Back to this "numerical error" term. I think it is related to the behavior of FDM using first-order one-sided approximation for convection term relative to that using second-order central difference approximation for convection term. (5). For example, the diffusion-convection model equation can be approximated as zmu*(T3-2*T2+T1)-u2*(T3-T1)/2=epsilon1. where the first term is the diffusion term, the second term is the convection term. The grid spacing is 1.0, and (T3-T1)/2 is the central difference approximation. And epsilon1 is the trancation error. In the original equation, the right-hand side would be zero, but for the FDM the right-hand side is the truncation error. Or the so-called numerical error terms.(6). If we use the first-order upwind approximation for the convection term, the model equation becomes zmu*(T3-2*T2+T1)-u2*(T2-T1)=kapa1. for positive u2. where T1 is T(i-1), T2 is T(i), and T3 is T(i+1). kapa1 is the truncation error for this FD equation, and (T2-T1) is the upwind difference approximation. (7). The truncation error terms epsilon1 and kapa1 should go to zero when the grid spacing goes to zero. But in reality, we are dealing with problem having finite grid spacings.(or grid size) (8). For finite grid size problem, the truncation error epsilon1 and kapa1 are not the same (not equal). (9). If we substract the first equation from the second equation, we get kapa1-epsilon1=-u2*(T2-T1)+u2*(T3-T1)/2. Which is kapa1-epsilon1=u2*(T3-2*T2+T1)/2. And this is the difference between two approximated equations. Actually, the grid size dx should appear in the above equation as kapa1-epsilon1=dx*u2*(T3-2*T2+T1)/2. (10). That's all we have. (11). But some people would say that (T3-2*T2+T1) is a second-order central difference template, just like the real diffusion term. Thus, we call kapa1-epsilon1 the numerical diffusion error term, mainly because of its appearance. (12). If we use other type of approximation for the convection term, the truncation error term (kapa1-epsilon1) will be function of (dx,c1*u2,c2*T1,c3*T2,c4*T3) in certain general form. Where c1,c2,c3,and c4 could be zero or non-zero coefficients. Then it is very hard to give it a familiar name such as"numerical diffusion". (13). So, you can try out several different approximation schemes, and see whether the truncation error (kapa1-epsilon1) will take certain familiar form or not. (14). If you can make (kapa1-epsilon1)=0, then both schemes are second-order accurate. Each one still has its own truncation error in the FD equation though.

Adrin Gharakhani October 20, 1999 21:24

Re: Numerical diffusion error
>These are explicit terms which are artificially added to the original equations in order to control the convergence or the behavior of the solution. Without such artificially added diffusion terms, most of the time, wiggles in the solution to the inviscid equation will appear. Sometimes, it will give you negative density, or even diverged solution. (3). The use of artificially added diffusion terms in the original equation to stabilize the solution has been used since 50's

The description above is nothing but the diagnosis for the proposition for bad numerical schemes (as well as bad programming)

1- Numerical/artifical/false diffusion/viscosity origininally was a byproduct of developing _poor_ & lower order differencing schemes. It was NOT an intentional additive term which is in common use these days with "high order schemes" - hyperviscosity, etc..

2- If one gets negative density or other unphysical values one should start looking for the root causes of these problems not shoving them under the rug by adding unphysical numerical diffusion terms. These are all manifestations of bad programming and/or devising of bad schemes - schemes which are inconsistent with the original equation.

3- If one is solving the Euler's equation one should actually expect the solution to exist for short times only. If the solution methodology is truly inviscid in character then there is no reason to add viscosity - afterall there are no diffusion terms in the Euler equations - what's the obsession with getting so-called stable solutions from an equation that is inherently unstable?!

Adrin Gharakhani

Duane Baker October 21, 1999 09:24

Re: Numerical diffusion error
1. If one reads carefully one may note:

I said:

"the numerical error is not just a function of the scheme, it also depends on the field being solved, specifially a gradient of a gradient or higher gradients thereof, etc"

I did not discuss the cause nor the cure or any such synonyms!

I may possibly have failed to fully explain the perspective of the analysis. The following may clear this up:

The simplest equation which illustrates streamwise and cross-stream NUMERICAL DIFFUSION is the 2-D steady scalar advection equation:

U_x*Diff(Phi)/Diff(x) + U_y*Diff(Phi)/Diff(y)=0

Applying UDS in both dirrections results in the MODIFIED EQUATION:

U_x*Diff(Phi)/Diff(x) + U_y*Diff(Phi)/Diff(y)=u_x*del_x*Diff^2(Phi)/(Diff x^2) + u_y*del_y*Diff^2(Phi)/(Diff y^2)

see pp 82-83 in Ferziger and Peric

The MODIFIED EQUATION is what is actually being solved on a given grid, for a given field and low and behold the error looks like diffusion and IS a function of the gradient of the gradient of the scalar field (in addition to the relative skew of the advecting velocity field, grid spacing and the velocity field itself)!

2. The advection term is the problem not whether it is linear or non-linear. For example, in the scalar equation given above, the velocity field is given and the problem is linear BUT the issue of Numerical diffusion is present!

3. Yes, Patankar's analysis does appeal to physical insight but some material is outdated and qualitative. Ferziger and Peric provied a good starting place and a more quantitative and formal basis for scheme evaluation.

4. Allignment fixes the cross-stream numerical diffusion BUT does not fix the streamwise diffusion for that a correction fot the other processes, namely diffusion, source, etc IS necessary and several approaces for this have been derrived.

Best wishes.................................Duane

John C. Chien October 21, 1999 13:39

Re: Numerical diffusion error
(1). I think CFD is still a branch of art. It is more on the graphic art side. (2). I use the color printer a lot. And I enjoy looking at the colorful output. (3). The "numerical truncation error with diffusion effect" is proportional to the grid size, dx, so, it can be systematically reduced by reducing the mesh size. For a 1-D problem, using a commercial program, one can have a 1-D mesh with 1,000,000 cells on a machine with a couple of giga bytes. A PC should be able to handle this kind of hardware memory. (4). The problem is people are anxious to solve 3-D problem using 1,000,000 cells. So, he can have 100 points in each dimension, which is 10000 times smaller than the ideal number. (5). So, if one insists on using 40x40x40 mesh in a 3-D computation, then he will always have the accuracy problem, and possibly the stability problem. (6). Since people nowadays are used to run calculations for several weeks or months, the time steps can be reduced in any fashion without violating the stability constraints. (7). So, as long as the solution algorithm is developed to provide the consistent solution (the algebraic equation becomes the original equation, as the mesh size is reduced to zero), the solutions obtained using different schemes of varying order should also converge to the same solution. (8). For those who can not afford using 1,000,000 cells mesh for a 1-D problem, it becomes an art to find the optimum solution (the one which is closer to the true converged result at 1,000,000 cells) and the related optimum scheme, so that they can still claim that they have found the answer. (9). It is like the return journey of the Appolo 13. It is difficult, but it can be done. (10). Since people working in CFD field have many options (relative to the astronauts on Appolo 13 ), the results tend to look like modern graphic art.

Shigunov October 22, 1999 09:06

Re: Numerical diffusion error
I should suppose that Lagrangian methods are free from numerical diffusion because they do not need interpolation procedures.

With best regards

All times are GMT -4. The time now is 15:41.