CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Technical] Upper triangular face order (https://www.cfd-online.com/Forums/openfoam-meshing/61938-upper-triangular-face-order.html)

mattamos May 9, 2005 12:04

Upper triangular face order
 
Hi all,

I'm trying to convert a mesh from our in-house format to Foam format, but I keep having problems failing the "upper triangular order" mesh check. I've had a look for what "upper triangular order" entails other than the obvious, but I can't find a definition anywhere.

Any help appreciated,

Matt

mattijs May 9, 2005 12:33

Simply said upper-triangular o
 
Simply said upper-triangular order is that the order of faces corresponds to the order of the cells they connect.
- take all (higher numbered) cells connected to a cell.
- sort them according to their cell label
- the faces connecting to those cells should now also be ordered.

renumberMesh will do this for you.

assert April 15, 2014 08:04

Upper-triangular order in detail
 
Quote:

Simply said upper-triangular order is that the order of faces corresponds to the order of the cells they connect.
- take all (higher numbered) cells connected to a cell.
- sort them according to their cell label
- the faces connecting to those cells should now also be ordered.
Although this answer appeared clear to me, when I implement it, checkMesh keeps giving me the error 'Faces not in upper triangular order'.

Trying to following the advice, I:
  • partitioned the faces within their boundary type
  • ordered these faces (within their boundary type) by the index of the Cell that owns them
upperTriangularFace indicates that face 0 is incorrect, where it is the only face in its boundary. How can this be incorrectly ordered?

All files and output (and future solution) can be found at
https://github.com/richelbilderbeek/...eek/issues/181 , yet I also put the files here.

Trace of the faces used, the name of their boundary type and the index of the cell that owns the face:

Code:


#Face index - Boundary type - Index of Cell owning the Face
TRACE 's.str()' line 174 in file '..\..\Classes\CppTriangleMesh\trianglemeshbuilder.cpp': '0: inside: 1'
TRACE 's.str()' line 174 in file '..\..\Classes\CppTriangleMesh\trianglemeshbuilder.cpp': '1: top: 0'
TRACE 's.str()' line 174 in file '..\..\Classes\CppTriangleMesh\trianglemeshbuilder.cpp': '2: top: 1'
TRACE 's.str()' line 174 in file '..\..\Classes\CppTriangleMesh\trianglemeshbuilder.cpp': '3: right: 0'
TRACE 's.str()' line 174 in file '..\..\Classes\CppTriangleMesh\trianglemeshbuilder.cpp': '4: left: 0'
TRACE 's.str()' line 174 in file '..\..\Classes\CppTriangleMesh\trianglemeshbuilder.cpp': '5: front: 1'
TRACE 's.str()' line 174 in file '..\..\Classes\CppTriangleMesh\trianglemeshbuilder.cpp': '6: bottom: 0'
TRACE 's.str()' line 174 in file '..\..\Classes\CppTriangleMesh\trianglemeshbuilder.cpp': '7: bottom: 1'
TRACE 's.str()' line 174 in file '..\..\Classes\CppTriangleMesh\trianglemeshbuilder.cpp': '8: back: 1'

checkMesh output:

Code:


/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1                                  |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
/*  Windows 32 and 64 bit porting by blueCAPE: http://www.bluecape.com.pt  *\
|  Based on Windows porting (2.0.x v4) by Symscape: http://www.symscape.com  |
\*---------------------------------------------------------------------------*/
Build  : 2.1-88b2f2ae3a0b
Exec  : checkMesh
Date  : Apr 15 2014
Time  : 13:41:22
Host  : "AIRBEAR-W7-I5"
PID    : 5668
Case  : D:/Projects/Tools/build-ToolTestTriangleMeshConsole-Desktop_Qt_5_1_1_MinGW_32bit-Debug
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:          8
    internal points:  0
    faces:            9
    internal faces:  1
    cells:            2
    boundary patches: 6
    point zones:      0
    face zones:      0
    cell zones:      0

Overall number of cells of each type:
    hexahedra:    0
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:    2

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
 ***Faces not in upper triangular order.
  <<Writing 1 unordered faces to set upperTriangularFace
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces ...
    Patch              Faces    Points  Surface topology
    top                2        4        ok (non-closed singly connected)
    right              1        4        ok (non-closed singly connected)
    left                1        4        ok (non-closed singly connected)
    front              1        4        ok (non-closed singly connected)
    bottom              2        4        ok (non-closed singly connected)
    back                1        4        ok (non-closed singly connected)

Checking geometry...
    Overall domain bounding box (-0.92388 -0.92388 1) (0.92388 0.92388 2)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (0 1.14967e-017 0) OK.
 ***Open cells found, max cell openness: 1, number of open cells 2
  <<Writing 2 non closed cells to set nonClosedCells
    Minimum face area = 1. Maximum face area = 2.  Face area magnitudes OK.
    Min volume = 0.777778. Max volume = 0.777778.  Total volume = 1.55556.  Cell volumes OK.
    Mesh non-orthogonality Max: 180 average: 180
 ***Number of non-orthogonality errors: 1.
  <<Writing 1 non-orthogonal faces to set nonOrthoFaces
 ***Error in face pyramids: 2 faces are incorrectly oriented.
  <<Writing 1 faces with incorrect orientation to set wrongOrientedFaces
    Max skewness = 0.404762 OK.
    Coupled point location match (average 0) OK.

Failed 4 mesh checks.

End

upperTriangularFace:

Code:


FoamFile
{
    version    2.0;
    format      ascii;
    class      faceSet;
    location    "constant/polyMesh/sets";
    object      upperTriangularFace;
}

1
(
0
)

points:

Code:


FoamFile
{  version 2.0;
    format  ascii;
    class  vectorField;
    location    "constant/polyMesh";
    object  points;
}

8
(
(-0.92388000000000003 -0.382683 1)
(-0.92388000000000003 -0.382683 2)
(-0.382683 0.92388000000000003 1)
(-0.382683 0.92388000000000003 2)
(0.382683 -0.92388000000000003 1)
(0.382683 -0.92388000000000003 2)
(0.92388000000000003 0.382683 1)
(0.92388000000000003 0.382683 2)
)

faces:

Code:


FoamFile
{  version 2.0;
    format  ascii;
    class  faceList;
    location    "constant/polyMesh";
    object  faces;
}

9
(
4(2 4 5 3)
3(5 7 3)
3(3 1 5)
4(2 3 7 6)
4(4 6 7 5)
4(0 4 5 1)
3(2 6 4)
3(4 0 2)
4(0 1 3 2)
)

boundary:

Code:


FoamFile
{
  version  2.0;
  format  ascii;
  class    polyBoundaryMesh;
  location "constant\polyMesh";
  object  boundary;
}


6
(
  top
  {
    type zeroGradient;
    nFaces 2;
    startFace 1;
  }

  right
  {
    type zeroGradient;
    nFaces 1;
    startFace 3;
  }

  left
  {
    type zeroGradient;
    nFaces 1;
    startFace 4;
  }

  front
  {
    type zeroGradient;
    nFaces 1;
    startFace 5;
  }

  bottom
  {
    type zeroGradient;
    nFaces 2;
    startFace 6;
  }

  back
  {
    type zeroGradient;
    nFaces 1;
    startFace 8;
  }

)

owner:

Code:


FoamFile
{  version 2.0;
    format  ascii;
    class  labelList;
    note    "nPoints: 8 nCells: 2 nFaces: 9";
    location    "constant/polyMesh";
    object  owner;
}

9
(
1
0
1
0
0
1
0
1
1
)

neighbour:

Code:


FoamFile
{  version 2.0;
    format  ascii;
    class  labelList;
    note    "nPoints: 8 nCells: 2 nFaces: 9";
    location    "constant/polyMesh";
    object  neighbour;
}

9
(
0
-1
-1
-1
-1
-1
-1
-1
-1
)


assert April 15, 2014 09:37

[FIXED] Upper-triangular order in detail
 
The algorithm to assign indices to a cell is as follows:

* Partition faces (yes, faces) in boundaries
* Maintain a cell index counter, start it at zero.
* Go through all these faces: find the face its owner (i.e. the cell that owns that face). If that cell has not been assigned a cell index yet, assign it a cell index. Increase that cell index counter.


All times are GMT -4. The time now is 18:13.