CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Technical] Upper triangular face order

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By assert
  • 1 Post By Bob Tipton

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 9, 2005, 13:04
Default Upper triangular face order
  #1
New Member
 
Matt Amos
Join Date: Mar 2009
Posts: 7
Rep Power: 17
mattamos is on a distinguished road
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
mattamos is offline   Reply With Quote

Old   May 9, 2005, 13:33
Default Simply said upper-triangular o
  #2
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
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.
mattijs is offline   Reply With Quote

Old   April 15, 2014, 09:04
Default Upper-triangular order in detail
  #3
New Member
 
Richel Bilderbeek
Join Date: Nov 2013
Posts: 14
Rep Power: 13
assert is on a distinguished road
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
)
__________________
I will never accept a 'Friend' request, I will always accept beer

Last edited by assert; April 15, 2014 at 09:07. Reason: layout
assert is offline   Reply With Quote

Old   April 15, 2014, 10:37
Default [FIXED] Upper-triangular order in detail
  #4
New Member
 
Richel Bilderbeek
Join Date: Nov 2013
Posts: 14
Rep Power: 13
assert is on a distinguished road
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.
tkeskita likes this.
__________________
I will never accept a 'Friend' request, I will always accept beer
assert is offline   Reply With Quote

Old   May 7, 2024, 22:37
Default Simpler explanation
  #5
Member
 
Bob Tipton
Join Date: Apr 2020
Posts: 34
Rep Power: 6
Bob Tipton is on a distinguished road
While the final consequence of misordered face, owner and neighbour files RESULTS in a matrix which is not upper triangular, this message is misleading.

If the reorderMesh app were run automatically, this would not be an issue and the matrix would be correct.


The issue is, what order do the faces need to be in the "faces" file to produce such the desired matrix.


The answer can be seen by viewing the faces, owner and neighbour data in parallel, as follows.


The first column is the vertex indices as ordered in the faces file.
The second column are the owner [cell] indices - which must be in ascending order
The third column are the neighbour [cell] indices - which must also be in ascending order - within that cell.


If the files meet these conditions, they will create an upper triangular matrix when read. Mesh files written in this way, with good cells and faces, pass checkMesh.


How this is assured is up to the author.


(6, 7, 5, 4) 0 1
(2, 3, 7, 6) 0 2
(5, 7, 3, 1) 0 4
(6, 7, 11, 9) 1 3
(10, 11, 7, 5) 1 5
(11, 10, 8, 9) 1 8
(54, 55, 7, 6) 2 3
(3, 7, 55, 53) 2 6
(55, 54, 52, 53) 2 48
(61, 55, 7, 11) 3 7
(11, 9, 60, 61) 3 10
(55, 61, 60, 54) 3 49
(5, 7, 280, 279) 4 5
(278, 280, 7, 3) 4 6
(280, 278, 277, 279) 4 204
(11, 7, 280, 286) 5 7
(11, 286, 285, 10) 5 12
(280, 279, 285, 286) 5 205
(280, 7, 55, 330) 6 7
(55, 53, 329, 330) 6 52
(280, 330, 329, 278) 6 206"
sharonyue likes this.

Last edited by Bob Tipton; May 7, 2024 at 22:40. Reason: Columnating
Bob Tipton is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ICEM] Error in mesh writing helios ANSYS Meshing & Geometry 21 August 19, 2021 15:18
[blockMesh] Errors during blockMesh meshing Madeleine P. Vincent OpenFOAM Meshing & Mesh Conversion 51 May 30, 2016 11:51
[snappyHexMesh] How to define to right point for locationInMesh Mirage12 OpenFOAM Meshing & Mesh Conversion 7 March 13, 2016 15:07
2nd order boundary conditions for 2nd order discretization? quarkz Main CFD Forum 30 December 26, 2011 08:12
Upper triangular ordering deepsterblue OpenFOAM Running, Solving & CFD 0 December 3, 2007 12:41


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