CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Meshing Format & General Technical

checkMesh - concave faces definition

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   September 30, 2013, 11:01
Default checkMesh - concave faces definition
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 211
Rep Power: 19
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
The utility checkMesh determines the presence of concave faces by calling the function checkFaceAngles(). The code of this function is attached (OF-2.1.x). Here is the relevant code section of checkGeometry.C

if (allGeometry)
        faceSet faces(mesh, "concaveFaces", mesh.nFaces()/100 + 1);
        if (mesh.checkFaceAngles(true, 10, &faces))

            label nFaces = returnReduce(faces.size(), sumOp<label>());

            if (nFaces > 0)
                Info<< "  <<Writing " << nFaces
                    << " faces with concave angles to set " <<
                    << endl;
                faces.instance() = mesh.pointsInstance();
If you search the code of checkFaceAngles() for the part where the concave faces are counted, you will see that this part is behind some conditions.

// Check normal
                    edgeNormal /= magEdgeNormal;

                    if ((edgeNormal & faceNormal) < SMALL)
                        if (faceI != errorFaceI)
                            // Count only one error per face.
                            errorFaceI = faceI;

                        if (setPtr)

                        maxEdgeSin = max(maxEdgeSin, magEdgeNormal);
What bothers me with this piece of code is the following condition

if ((edgeNormal & faceNormal) < SMALL)
I can't really figure out how this condition works, or how it is intended. Why am I thinking this:

faceNormal is the normalized face normal vector. So its magnitude is one and the vector is perpendicular to the face.

edgeNormal is also a normalized vector. edgeNormal was generated by calculating the cross-product of two consecutive edges of the face. As an edge connects two points, an edge can always be represented by a vector pointing from one point to the other point.

However, as all edges of the face lie within a plane to which the faceNormal is prependicular. The cross-product of two edges yields always a vector parallel to the faceNormal. In fact it can be parallel or anti-parallel.

The condition
((edgeNormal & faceNormal) < SMALL)
computed the inner-product of the edgeNormal and the faceNormal. As these two vectors are either parallel or anti-parallel, the inner-product is either 1 or -1.
So, the condition is false for the parallel case and false for the anti-parallel case.

How can this condition detect a concave cell? What I figured out is that the following is a concave cell, meaning that the edges delimiting the face make a bend inwards.

I can't see that the condition behind which the line nConcave++; is located is able to detect this.

| xxxx/
| xxx/
| xxo
| xxx\

What am I missing, or am I somewhere wrong?
Attached Files
File Type: txt checkFaceAngles.txt (3.9 KB, 4 views)
GerhardHolzinger is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] Mesh Importing Problem cuteapathy ANSYS Meshing & Geometry 2 June 24, 2017 05:29
No layers in a small gap bobburnquist OpenFOAM Native Meshers: snappyHexMesh and Others 6 August 26, 2015 09:38
Add Mesh Layers doesnt work on the whole surface Kryo OpenFOAM Native Meshers: snappyHexMesh and Others 8 September 13, 2012 09:28
snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Native Meshers: snappyHexMesh and Others 2 March 27, 2011 21:11
external flow with snappyHexMesh chelvistero OpenFOAM 11 January 15, 2010 20:43

All times are GMT -4. The time now is 19:48.