Negative cell volume

I have created an unstructured grid consisting of one tetrahedral cell.

<?xml version="1.0"?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf Version="3.0" xmlns:xi="http://www.w3.org/2001/XInclude">
  <Domain>
    <Grid Name="mesh" GridType="Uniform">
      <Topology NumberOfElements="1" TopologyType="Tetrahedron" NodesPerElement="4">
        <DataItem Dimensions="6 4" NumberType="UInt" Format="XML">
0 1 2 3
</DataItem>
      </Topology>
      <Geometry GeometryType="XYZ">
        <DataItem Dimensions="8 3" Format="XML">
0 0 0
1 0 0
1 0 1
1 1 1
</DataItem>
      </Geometry>
    </Grid>
  </Domain>
</Xdmf>

I am using Paraview 5.10.0-RC1 and want to apply the Cell Size filter. This returns a negative value of -1/6 for the tetrahedral volume. Is there is a specific reason for this volume being negative?

With this minimal VTK 9.1.0 example I was able to reproduce the behaviour.

import vtk

volume = vtk.vtkTetra.ComputeVolume([0, 0, 0], [1, 0, 0], [1, 0, 1], [1, 1, 1])
print(volume)

Output:

-0.16666666666666666

This is rectified if you change the order of the two last vertices:

import vtk

volume = vtk.vtkTetra.ComputeVolume([0, 0, 0], [1, 0, 0], [1, 1, 1], [1, 0, 1])
print(volume)

Output:

0.16666666666666666

It seems like the volume computation is missing an absolute value of the determinant.

1 Like

Hi @hkjeldsberg and welcome to discourse !

Is there is a specific reason for this volume being negative?

Yes ! the order of the vertices of the tetrahedra (and any other element) follow conventions to ensure consistency across calculations .
See figure 2 in the documentation .

volume = vtk.vtkTetra.ComputeVolume([0, 0, 0], [1, 0, 0], [1, 0, 1], [1, 1, 1])

in this case the normal vector of the face defined by the first three points using the right hand rule, points “outwards”, away from the fourth vertex and thus the volume is considered negative.

This is rectified if you change the order of the two last vertices:

The first three vertices define now a normal that points on the same side of the face that [1,0,1] lies.

3 Likes