Encounter with a RuntimeError: Negative Mesh Jacobians detected

Hello, I am a newer to PyFR and trying to run a few cases with this powerful solver. In the example case of solving incompressible Navier–Stokes equations using a cylinder mesh, I tried to dig more applicability through changing the mesh file with my own (see the attachment). However, when I run with pyfr run ..., a RuntimError : Negative Mesh Jacobians detected just cropped up. Then I detected my mesh file with the plugin-tool AnalyseMeshQuality and it showed that my minJ is .000359, which is apparently non-negative. So I was confused about the error that didn’t come up when I was runing with the original mesh file.
Any help would be much appreciated!!

Hi @Winxingtf,

Could you please tell us a bit more which mesher you used and did you import the mesh?

Hi GonzaloS,

Thanks for you reply!

Actually, I generated my mesh with Gmsh, and set High-order p = 2. I also tried with p = 3, but still got the wrong error info. I imported my mesh file, transferred it to pyfrm format, everything went well untill I ran my case.

Here is my pyfrm file. Thanks much!


I had a similar problem before, and the reason was simply that the normal direction of one or more surface of the 2d mesh is in the opposite direction. The solution was simply to flip the orientation of normals and have all normals pointing out of the screen.

This is just one possible reason and it is fairly easy to check.

I hope this helps.


Dear Kamra,

Your suggestion did work! The orientation was just the cause of the error, and I also found out that only when all normals point out of the screen should the case run as expected. When I reversed the orientation to point into the screen, the Runtime Error came out as before. Thanks for your kind reply!

Best regards,