View Issue Details

IDProjectCategoryView StatusLast Update
0001347OpenFOAM[All Projects] Bugpublic2015-03-05 17:53
Reporteruser965Assigned Tohenry 
Status resolvedResolutionfixed 
PlatformLinuxOSScientific LinuxOS Version6.5 (Carbon)
Product Version 
Fixed in Version 
Summary0001347: Computation of tetrahedra overlap volume fails on small grid cells
DescriptionThe method "tetOverlapVolume::tetTetOverlapVol(const tetPoints& tetA,
const tetPoints& tetB) const" always returns zero when the tetrahedra have a small volume. This makes the utility mapField fails on meshes with grid spacing < 1e-5. This method is called for instance by the interpolation method cellVolumeWeightMethod.
Steps To ReproduceUnpack the attached cases. The first case contains a 2x2 mesh with a field that has value 1. The second case contains a 3x3 mesh with exactly one overlapping grid cell. The latter contains a field with value "uniform 0". Run

$ ./Allrun
$ cat case2/0/testField

The utility mapFields with the method cellVolumeWeight gives the wrong result "uniform 0" (it actually does nothing), while the correct result is

internalField nonuniform List<scalar> 9(1 0 0 0 0 0 0 0 0);
Additional InformationThis bug is caused by the line 67 in tetOverlapVolume.C:

if ((tetA.tet().mag() < SMALL) || (tetB.tet().mag() < SMALL))
        return 0.0;

With double precision, SMALL = 1e-15. Therefore, when the cell size is 1e-5 or smaller, the resulting tetrahedrons always have a volume less than SMALL. This if-condition causes the overlap volume to be 0, which is very undesirable. Therefore, I suggest replacing SMALL by pow(SMALL, 3) (one could replace it by VSMALL, but that solution makes less sense to me).
TagsNo tags attached.



2014-07-11 13:58


cases.tar (2,957 bytes)


2015-03-05 09:33


Test-tetTetOverlap.C (4,273 bytes)


2015-03-05 09:38


The test is quite strict. For two touching, regular, tets I see overlap volume:

    DP: 1.019927013371182e-47
    SP: 7.484330182379794e-21

However with making one of the tets have an aspect ratio of 1e-9 I get

    SP: 1.666666665789407e-10

Could you try


instead of SMALL? This seems like a better compromise.


2015-03-05 17:53

manager   ~0003969

commit fe29caafb0f0546c553391dba9377f08950284a6

Issue History

Date Modified Username Field Change
2014-07-11 13:58 user965 New Issue
2014-07-11 13:58 user965 File Added: cases.tar
2015-03-05 09:33 user4 File Added: Test-tetTetOverlap.C
2015-03-05 09:38 user4 Note Added: 0003959
2015-03-05 17:53 henry Note Added: 0003969
2015-03-05 17:53 henry Status new => resolved
2015-03-05 17:53 henry Resolution open => fixed
2015-03-05 17:53 henry Assigned To => henry