nutofem / nuto

NuTo - yet another finite element library
https://nuto.readthedocs.io
Boost Software License 1.0
17 stars 5 forks source link

Det(Jacobian) #174

Open TTitscher opened 6 years ago

TTitscher commented 6 years ago

When we import elements from gmsh, we will sometimes end up with negative Det(Jac). E.g.

3--2        1--2
|  |   vs.  |  |
0--1        0--3

With #173 we check if Det(Jac) is consistent - either all positive or all negative, measured at all node locations. How do we want to deal with that? a) add std::abs() in Jacibian::Det() b) add std::abs() in the numeric integration c) enforce Det(Jac) > 0 without std::abs() c.1) modify MeshGmsh accordingly c.2) add checks for Det(Jac) > 0, e.g. at element creation

Psirus commented 6 years ago

I would only ensure that the determinants are consistent across the NuTo - Gmsh boundary. All the reference elements in Gmsh (as far as I can tell are numbered in mathematically positive direction) http://gmsh.info/doc/texinfo/gmsh.html#Node-ordering, so that if we import a reference element and the determinant is negative, than our node orderings don't match. But that doesn't mean that Det(J) > 0 should always hold…just for the reference elements.

Therefore d) Create test meshes with reference elements according to Gmsh numbering and test Det(J) > 0 once for those meshes.

joergfunger commented 6 years ago

I think we should enforce a consistent numbering of the elements, thus enforcing detJac>0 for the gmsh import as well as for the element creation. If we don't enforce this, we might get problems, because we would then have to do an fabs(detJ) in the integration routines. In some cases, the numbering might be important e.g. for the calculation of normals.

TTitscher commented 6 years ago

I was just spending an hour trying to find a bug. It was normal orientation issue (in gmsh), where one of my four surfaces had the wrong normals. For this case, at least a warning like "Det(J) in element ... is negative" would be nice. What do you think?