# Negative volume polyhedral cell

Hi all,

I am seeking your help to figure out why I got a negative volume for the polyhedral cell of the attached python script. I checked every normals to point outside the cell centroid (right click / orientation of face). I got a polyhedral mesh where several cells (17 of 76894) have negative volume like those in the script, and make my simulation with a third party code crash. Maybe it is SMESH tolerance related ?

I am running Salome 9.4 on Ubuntu 19.10.

Thanks for your help and have a nice weekend all !

Moise

Hello Moise

Thank you for reporting this issue. The bug is connected with a small size of the polyhedron. If you scale it by a factor of ten, its volume is OK.

I'll fix it.

Best regards

Edward

Hi Edward,

I made additional test to verify computed polyhedron volume.

I scaled the polyhedron of my last post by a factor of 10 and get a positive value with V_10 = 0.00162266.

Yet, I scaled it again by a factor of 10 and get new value value of V_100 = 1.97596

And again by a factor of 10 and get V_1000 = 2011.29

And so on. Yet, I think there is a problem in volume calculation for polyhedron, as an isotropic space scale transform should modify the volume by the scale power 3. To prove that, we can decompose the polyhedron into tetrahedron, and sum the the volume of each tetrahedron which is:

V = 1/6 det( AB, AC, AD) = 1/6 det ( B-A, C-A, D-A )

For a "x" factor scale we get:

V' = 1/6 det ( x (B-A), x (C-A), x (D-A) ) = x^3/6 det( AB, AC, AD) = x^3*V

After the sum on each tetrahedron, we always have the x^3 factor.

Am i right ?

Thanks for the support,

Moise

Hello Moise

I confirm that there is certainly a bug in volume calculation. If your intention is to get a reliable value of mesh volume, I would suggest the following workaround. Duplicate your mesh (Mesh > Copy mesh) and split the copy into tetrahedra (Modification > Split Volumes).

Best regards

Edward