CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Bugs (
-   -   Possible bug in icoFoam (

msrinath80 November 18, 2007 13:05

Description: The case in ques
The case in question is isothermal transient laminar flow of an incompressible newtonian fluid in a 2D channel which features a square obstacle somewhere inside it. While the velocity fields from both the coarse and fine grids make sense, the pressure field from both is unphysical (i.e. low pressure extending from the channel inlet up to a significant entry length and high pressure near the outlet). The contour plots for both velocity and pressure obtained for the fine mesh are shown below:


Source file:
icoFoam.C ?

Coarse mesh (11846 cells) coarse.tar.gz
Fine mesh (47384 cells) fine.tar.gz

Linux64 (RHEL 5.0, Ubuntu 7.10)

OpenFOAM 1.4.1 patched with:
[1] Cumulative patch (
[2] Cyclic patch bug fix (


[1] Switching solvers seems to have no effect on the results (i.e. same results on AMG or PCG).
[2] Same results whether you run the case in parallel or serial.
[3] Whether the fine mesh is created using blockMesh directly or using refineMesh once on the coarse mesh, the result is the same.
[4] checkMesh reports no errors on either mesh. There is no non-orthogonality or skewness.
[5] Although I cannot confirm this totally, I am yet to observe any discrepencies when running either case on a 3D mesh. So I suspect this is some problem only in 2D?


Pressure field from the fine mesh:

Pressure field from the fine mesh (zoom near cylinder):

Velocity field from the fine mesh (zoom near cylinder):

philippose November 19, 2007 14:56

Hello Srinath, A Good day t
Hello Srinath,

A Good day to you!

I must say... this possible bug you have spoken about seems to be uncannily close to the problem I was talking about a week ago, with the pressure field being unacceptably different when running the same simulation on two computers with slightly different versions of OpenFOAM-1.4.1.

In my case, I had used the stock simpleFoam in both cases, and I too had a perfectly fine looking velocity field, but a different pressure field.

I shall see if I can post a couple of pictures here. I hope I still have those simulations.

I solved it by compiling the latest version of OpenFOAM-1.4.1 from SVN. It really may be some bug that crept into the system because of some change made between the different versions.

Have a nice day!


henry November 19, 2007 16:14

I tested your coarse mesh case
I tested your coarse mesh case with 1.4.1 (with the bug fixes posted on this list) and also our development version 1.4.2 and it runs fine in both and the pressure field is fine. One thing I did notice is that the pressure residual oscillates due to the pure Crank-Nicholson scheme being a little unstable; if you use a small amount of "off-centering" by setting the coefficient to 0.9 or 0.95 it is MUCH better behaved. Alternatively you can use the "backward" scheme which is also second-order but more stable than Crank-Nicholson.

msrinath80 November 19, 2007 17:19

Hi Henry, Thanks for your m
Hi Henry,

Thanks for your message. I assume that you checked the pressure solution at Endtime (i.e. 10 seconds). I will look into this once again more carefully. Perhaps as Philippose suggests, I need to recompile OpenFOAM just to be sure.

henry November 19, 2007 17:41

I hadn't but I have now. It a
I hadn't but I have now. It appears that the Crank-Nicholson scheme induces increasingly large pressure oscillations as the run progresses and by 10s is looks very odd and changes greatly between consecutive time-steps. Using a coefficient of 0.9 or 0.95 solved the problem completely.

msrinath80 November 19, 2007 17:56

I'm trying it with 0.9 now. Wi
I'm trying it with 0.9 now. Will keep you updated. Thanks!

msrinath80 November 19, 2007 18:35

You're absolutely right. This
You're absolutely right. This was no bug. My sincere apologies to anyone who got scared after reading the title of this thread. Thanks for your help Henry.

All times are GMT -4. The time now is 08:07.