GEOS-DEV / GEOS

GEOS Simulation Framework
GNU Lesser General Public License v2.1
210 stars 84 forks source link

Importing an External Mesh: Negative volume for element XXXXX type C3D4 #3079

Open Ssachd-1 opened 5 months ago

Ssachd-1 commented 5 months ago

I'm attempting to import a 3D Tetrahedral Mesh (.vtu) and use it for a single-phase flow simulation. I've successfully simulated using an internal mesh and a provided sample (egg.vtu) without encountering any errors. However, when I import my own mesh, I encounter the following error:

ERROR LOCATION: /home/sachdeva/GEOS/codes/GEOS/src/coreComponents/mesh/CellElementSubRegion.cpp:397 Controlling expression (should be false): m_elementVolume[k] <= 0.0 Rank 0: Negative volume for element 6020549 type C3D4 in subregion domain/MeshBodies/carteisanMesh/meshLevels/Level0/ElementRegions/elementRegionsGroup/reservoir(Mesh1_co2Injection.xml,l.56)/elementSubRegions/tetrahedra

I've also tried using mesh_doctor.py to investigate the root cause, and it seems that the volume of each element in my mesh is negative, unlike the sample mesh.

I suspect that the source code doesn't account for irregular tetrahedra, where the centroid lies outside the element, causing the negative volume.

Nevertheless, I'm unable to import my desired reservoir geometry. Could you please provide insights if you've encountered a similar problem, or suggest ideas on how I could tackle this error?

jeannepellerin commented 5 months ago

We have encountered the same problem and fixed it by pre-processing the tetrahedral mesh and changing the orientation of all its cells. This may be scripted in Paraview - for each cell switch 2 vertex ids.

TotoGaz commented 5 months ago

Thanks for the answer @jeannepellerin .

BTW, if you want to perform the same reordering for all the cells, you can use the fix_elements_ordering feature of mesh_doctor to do so. See doc here.