I was trying to export a UnitCubeMesh for use in a different solver but it appears that some of the tetrahedral elements are inverted. When I checked the mesh in ParaView using the MeshQuality and CellSize filters it seems that half the elements have negative volume (see below) and the total volume is zero. Does anyone know why this might be happening and is there a way to fix it?
When I try to open the exported mesh in Abaqus it looks like this:
Here is the code that I used to generate the mesh:
from dolfin import *
import numpy as np
parameters["reorder_dofs_serial"]=False
mesh=UnitCubeMesh(2,2,2)
# mesh=BoxMesh(Point(0,0,0),Point(1,1,1),2,2,2)
nodes=mesh.coordinates()
element=mesh.cells()
np.savetxt("nodes_N2.dat",nodes,delimiter=",")
np.savetxt("element_N2.dat",element,delimiter=",")
file=File("mesh_N2.pvd");
file<<mesh;