dolfin-convert from gmsh mesh alters normal directions

Asked by Henrik Garde on 2013-03-18

I am trying to do some tomography reconstruction in 3D, for which I have made a simple 3D cylinder mesh in gmsh. In gmsh I tried to turn on normal directions and they are all pointing outwards as they should.

When I used dolfin-convert in order to import my mesh, the imported mesh had many faces for which the normal directions on the boundary were no longer pointing outwards, so I am not sure my solutions will be correct as the forms depend on the normal directions.

I tried to update my dolfin version to 1.1.0 and retried dolfin-convert but with same result.

Here is an image of what the expression "x+y+z" looks like on the mesh, where it is evident that about half the boundary faces are backfaces:

Does anyone know what can be wrong?

Question information

English Edit question
FEniCS Project Edit question
No assignee Edit question
Solved by:
Henrik Garde
Last query:
Last reply:
M Waste (michael-waste) said : #1


Have you tried to create the zylinder in the geo file without extrude and also without normals?
Then looks the output as expected


Henrik Garde (1etr3k) said : #2

Hmm I will have to try that out Michael, thank you.

However, it does seem to me that it is a bug in dolfin-convert, since the normals are correct in gmsh.

M Waste (michael-waste) said : #3

I see.

I tried it with extrude also. I had no problems with the dolfin convert xml file.
I'm sorry that I'm not able to give you any helpful answer.

Henrik Garde (1etr3k) said : #4

Now I am even having problems with the buildin mesh generators.

When using the code:

mesh = UnitCircleMesh(10)
V = FunctionSpace(mesh,'CG',1)
u = project(Constant(1.0),V)

I get the following picture, the same goes for the other types of buildin mesh:

I tried reinstalling FEniCS but I keep getting that about half the faces are inverted :(

In contrast to most visualization software, dolfin does not orient the triangles in a consistent direction, rather it sorts the vertices of each cell based on their global numbering. (This allows basis functions associated to facets to have a unique meaning across cells without storing global orientation information). So I think at least your last example is actually a plotting bug. I've seen strange things like that myself when running with broken graphics drivers or within a virtual machine with bad drivers.

Henrik Garde (1etr3k) said : #6

Now I have used a different computer with different specifications, and run the script

mesh = UnitCircleMesh(10)
V = FunctionSpace(mesh,'CG',1)
u = project(Constant(1.0),V)

and I still get the same results with the black triangles. If it has something to do with graphic drivers the only similarity is that both computers have nvidia graphic cards, though different models. Furthermore, I am running ubuntu 12.10.

Henrik Garde (1etr3k) said : #7

It appears that Martin was actually correct, it was a driver problem. It appears that installing nvidia drivers on ubuntu 12.10 through the jockey-kde gui can screw up the drivers, I fixed it by installing through the following guide:

Thank you all for the answers!