CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Bugs (
-   -   SVN 1226 - Possible bug with cell centres and volumes (

philippose June 4, 2009 18:08

SVN 1226 - Possible bug with cell centres and volumes

A Good Evening to everyone :-)! I hope all is well, and things are going good for everyone!

Just wanted to report that the change made to the file "primitiveMeshCellCentresAndVols.C" in SVN Revision 1226 seems to cause an issue when dealing with fine meshes.....

In SVN Rev. 1226 the line: "cellCtrs /= cellVols" was changed to "cellCtrs /= cellVols + SMALL" in order to prevent division by zero errors in the case when cellVols = 0.0.

However, when working with fine meshes (in my case, > 1.2 million cells) whose cells inherently have volumes close to 1e-15 (m^3), the addition of the value "SMALL" (which is 1e-15 for double precision) causes a variety of OpenFOAM systems to fail with unusual errors.

The first sign of this was a sudden flurry of errors in checkMesh on meshes which had run fine on earlier SVN revisions of OpenFOAM-1.5-dev.... I also experienced meshes which caused OpenFOAM to abort with a floating point exception after the first pressure solver iteration (again.... these were cases which had run through fine before), etc...etc...

Removing the addition of "SMALL" rectified all the issues....

Wouldn't "VSMALL" be a better option? Or are there other issues which forced the usage of "SMALL" ??

Have a great evening ahead!


hjasak June 5, 2009 06:27

Could you please try it and let me know if it works.


philippose June 5, 2009 13:19

2 Attachment(s)
Hello Hrv,

A Good Evening to you!

I recompiled OpenFOAM-1.5-dev after changing the line:

"cellCtrs /= cellVols + SMALL" ==> "cellCtrs /= cellVols + VSMALL"

And ran checkMesh on the case with which I discovered the issue, and everything worked out fine.... a simpleFoam simulation of the same case also went through without any further issues.

For reference, I am attaching two checkMesh log files, one with the original code (using SMALL), and one with the modified one (using VSMALL).... I hope it gives you more clarity...

Have a nice evening, and a great weekend :-)!


All times are GMT -4. The time now is 11:56.