
[Sponsors] 
July 8, 2000, 10:32 
truncation error

#1 
Guest
Posts: n/a

how to access and control the effect of truncation error generated by computer?


July 8, 2000, 10:54 
Re: truncation error

#2 
Guest
Posts: n/a

(1). In CFD the truncation errors are part of the numerical algorithm used in discretization process. That is, the terms you did not include in the final algebraic equations (derived from the governing partial differential equations). (2). In this area, you can try to use more accurate algorithms to reduce the truncation errors. But then you have to rewrite the equations, and the code. (3). Then there is the socalled numerical accuracy problem associated with the "floating point variable" representation. That is, the number of bits to represent a floating point variable (or integer). (4). The simple solution is to use the "double precision" variable and math. Or you can move up to a computer with a 64 bit CPU instead of using one with a 32 bit CPU. (5). In many CFD applications, single precision floating point variables with sixtoseven digits accuracy are not adequate. One can easily run into trouble in the Geometry, fine mesh generation, and the solver steps. (6). There are ways to avoid some of these problems, but it is easier to just use double precision variable and math. (7). Try to use "binary I/O" file format if you need to store and restart the program from time to time.


July 8, 2000, 20:09 
Re: truncation error

#3 
Guest
Posts: n/a

The classical theory of stability usually assume a small disturbence at first, then see how it is grow or vanish, but in real computations, truncation error created by computer (number of bits) is constantly generated in each operation, it is a small disturbence, but its effect cannot be accessed with classical theory, some people tell me that it is concerned with robust theory of differential equation, I don't know whether there exists such a theory which can be applied in CFD, have you ever read such kind of papers on this issue.


July 8, 2000, 21:10 
Re: truncation error

#4 
Guest
Posts: n/a

(1). I am not aware of the study of the effect of variable precision on the cfd solutions. (2). With the six digits single precision variable, it is not possible to see the difference between the value of 30.00001 and 30.00002, because these two numbers will become 30.0000 in the memory. (3). If those numbers represent the mesh positions, then the code will give errors when you start doing math operations. Instead of the mesh size of 0.00001, you will get 0.0. And the mesh size will be zero, the area will be zero, etc... (4). Instead of trying to study the effect, I think, it is easier to solve the problem by using the double precision variables and math. This can eliminate the occasional zeros, divide by zero, or negative values etc...


July 9, 2000, 00:26 
Re: truncation error

#5 
Guest
Posts: n/a

Is it also possible to eliminate these errors with expotential format? As in chemically reacting flows, many component fractions is very small, but we also need to take them into consider. Then at the starting period, those 'small' components fraction maybe even smaller than the truncation error of 'big' components, with this case, is it also meaningful to continue the computation? My experience is that we can also get some results which seem to be reasonable in physics, but I don't know why can i got such results, doesn't the value of those 'small' fraction merged in errors? what take it out from the river of errors?


July 9, 2000, 09:32 
Re: truncation error

#6 
Guest
Posts: n/a

(1). If the time step is large, the calculation will diverge. (2). If the time step is small, sometimes it will be all right, but sometime it will diverge. (3). If the time step is very ,very small, it is going to take a long time to converge. But in most cases, it will also diverge because of the poor initial flow field guess. (4). All I can say is, we are trying to guess at the result, under the constraints of job, schedule, promise to client, ability to deliver, etc,..etc... (5). The best place to start is the transient compressible flow claculations. When the density becomes negative, the code will give you error message. (6). The other area is the shock capturing. In most cases, the mesh size is much, much larger than the real shock thickness (a shock has structure in it , it is not a discontinuity at all.), and yet, people are trying to say that they are capturing the shock waves. (7). So, under the constraints of reality, people must model it first (cheat, lie , create a new theory, etc...), so, they can have a job, be able to sell ideas to client, and trying to move on to the next idea. (8). So, as I have said before, 99% of the time, we are getting the wrong answer, in cfd. So, those are failure. But I also believe that, in order to succeed, one must first pass these failure. But my definition, success comes after a finite number of failure. The most valuable information is the one which will show you the wrong way. (9). So, if you are solving the transient equation, one error at the start of the solution will give you the wrong transient solution. But, if it does not diverge, and if you are looking for the steady state solution, there is still a chance to obtain the result. (10). But, if you are shooting at the planet MARS from where you live, a small error at the begining or near the target will send you to somewhere else. That is the real test of the accuracy. (11). So, I think, cfd is very similar to "shooting at MARS" . Except that, on paper and on computer in the office, one can easily cover up the failure easily. Or pretending that, as long as someone is running the offtheshelf cfd codes, he is designing the right thing. (12). In recent years, I have seen many cases of failure of company which can be easily linked to the failure to understand the wrong answer cause by the small errors. (13). Most of the time, we are living in an environment , or working in a company which is dying in time. But the lessons learned in the dying process will create a new company, thus the process is repeated.


July 10, 2000, 11:58 
Re: truncation error

#7 
Guest
Posts: n/a

It is a very interesting question.Exponential format is not really useful,but generally speaking, double precision may help. However, if it is possible you could do some linear stablity analysis for your numerical system, either trancation error of numerical scheme or computer digital restrict. Yes, computer produces error constantly, it also could be elimilated simutaneously because of the viscosity. This is mostly a kind of forced system, if we are lucky, the outside(including the chemecal reaction forces) forces will eventually control this system.
Any comments are highly welcome. Z T Xie 

July 10, 2000, 12:16 
Re: truncation error

#8 
Guest
Posts: n/a

Truncation errors due to discretization and machine errors are two separate things though separating them out may often be difficult is real CFD.
As John pointed out, discretization errors can be minimized by using more accurate schemes (eg. spectral, compact etc.). As far as machine roundoff errors are concerned, we have to live with them with the hope that most schemes that can be shown to stable using the linear stability theory are unaffected by the relative low amplitude of the machine error. Machine error is constantly being generated in contrast to the error introduced at one time in the linear stability theory. However, machine error is assumed to be uncorrelated (in time) whitenoise and error introduced at each time location propagates (amplifies or diminishes) independently of the errors introduced at other time instants. This is acceptable under the linear stability theory since the propagators, i.e., the Green's functions corresponding to the differential equations are linear. If one is using a nonlinear stability theory, then there is a problem with persistent error generation. Since it is common for the stability domains of most physical systems to be bounded on either sides by the linear stability limiat and the energy stability limit, nonlinear stability has not recceived much attention. 

July 10, 2000, 13:45 
Re: truncation error

#9 
Guest
Posts: n/a

(1). The machine error (the precision of variable) is a problem. (2). If the physics of the problem is such that numbers smaller than the precision of variable can be safely ignored, then , it will not create the accumulative effect on the problem to be solved. (assuming that all the program logics are checked to avoid logical error or divide check,etc...) (3). But if the physics of the problem is such that it is calculating the long term interest of an account (say 30 or 50 years), then, it is important to make the interest rate as accurate as possible.(whether it is 3.00%, or 3.45% or 3.50%) If we drop the numbers behind the decimal point, we will be getting 3.0%. And I think, it will make a big difference in calculating the total interest at the end of 50 years. (4). So, I think, the physics of the problem is the key to the importance of the precision of variables used in the problem. (5). Another example is the summation of a series, or drawing of a sequence of circular arc on computer screen. In the latter case, you first divide a circular arc into N number of segments. If the number N is large, you need this to draw a smoother arc. So, the increment angle will be very small. If you drop some numbers from the already small increment, the result is there is no way you will be able to get back to the final position. After Nth increment, the total angle is always smaller than the original total angle. (6). In CFD, it is possible to have similar process going on in the solution algorithm. So, it is important to check each statement for such occasions. It is a matter of good programming habit for accuracy. (7). This is the reason why code validation is always necessary, not just to find the bugs, accuracy of the algorithm, but also to spot the bad programming habit.


July 11, 2000, 23:48 
Is there a software to check the roundoff errors?

#10 
Guest
Posts: n/a

Many softwares like Visual FORTRAN have a debug function and can show the value of parameters during operation, it seems that it's also possible to build up a software to check the machine errors and give suggestions to programmers. It's just like in Microsoft Word, after typing in sentences, press F7 key will help us to check the grammer and spelling, I think it will be easier to make an extension function of check errors on the basis of Visual FORTRAN or PowerStation.


July 12, 2000, 00:52 
Re: Is there a software to check the roundoff erro

#11 
Guest
Posts: n/a

(1). Well, that is one way to find the problem area. (2). Normally what people do is just to turn the program into a double precision version, and then run both versions of the code. (3). If the solutions are different and visible, then it is important to look into it, before using the singleprecision version of the code. (4). Do not use formatted I/O for cfd solution file. The random errors created after a formatted read can generate strange unpredictable behavior,when attempting to restart the solution. formatted I/O files are commonly used for postprocessing.


July 12, 2000, 22:08 
Re: Is there a software to check the roundoff erro

#12 
Guest
Posts: n/a

thank u, very much!


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
CGNS Compiling  Diego  Main CFD Forum  17  December 21, 2014 02:40 
Accessing phi from a fvPatchField at same patch  johndeas  OpenFOAM  1  September 13, 2010 20:23 
compile errors of boundary condition "expDirectionMixed"  liying02ts  OpenFOAM Bugs  2  February 1, 2010 21:11 
error while running paraFoam!  padmanathan  OpenFOAM  9  October 13, 2009 05:17 
OpenFOAM on MinGW crosscompiler hosted on Linux  allenzhao  OpenFOAM Installation  127  January 30, 2009 20:08 