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/)
-   -   [blockMesh] Inconsistent number of faces between block (https://www.cfd-online.com/Forums/openfoam-meshing/151995-inconsistent-number-faces-between-block.html)

CrisMoreira April 21, 2015 15:36

Inconsistent number of faces between block
 
Hi,
i'm new to all of these kind of things so forgive if my doubt seems trivial
I got these error message while running blockMesh. After some research i found that maybe the problem is in the matching numbers in hex, so i have changed it but the problem wasn't solved.
I don't know if there's something missing in the matchPatchPairs() or mergePatchPairs() because i don't understand which cases is it necessary.
I'm trying to do a mesh to structure that can be divided in 7 blocks and on top of 3 of them is placed a prism.
Can anyone, please help me understand what i'm doing wrong?

Code:

convertToMeters 1;

vertices       
(
  (0.00    0.00    0.00) // 0
  (0.00    1.00    0.00) // 1
  (2.00    1.00    0.00) // 2
  (2.00    0.00    0.00) // 3
  (0.00    0.00    16.5) // 4
  (0.00    1.00    16.5) // 5
  (2.00    1.00    16.5) // 6
  (2.00    0.00    16.5) // 7
  (4.50    1.00    0.00) // 8
  (4.50    0.00    0.00) // 9
  (4.50    1.00    16.5) // 10
  (4.50    0.00    16.5) // 11
  (6.50    1.00    0.00) // 12
  (6.50    0.00    0.00) // 13
  (4.50    0.00    16.5) // 14
  (4.50    1.00    16.5) // 15
  (6.50    1.00    16.5) // 16
  (6.50    0.00    18.5) // 17
  (9.00    1.00    0.00) // 18
  (9.00    0.00    0.00) // 19
  (9.00    1.00    18.5) // 20
  (9.00    0.00    18.5) // 21
  (11.0    1.00    0.00) // 22
  (11.0    0.00    0.00) // 23
  (9.00    0.00    20.5) // 24
  (9.00    1.00    20.5) // 25
  (11.0    1.00    20.5) // 26
  (11.0    0.00    20.5) // 27
  (11.0    1.00    0.00) // 28
  (11.0    0.00    0.00) // 29
  (11.0    1.00    20.5) // 30
  (11.0    0.00    20.5) // 31
  (17.5    1.00    0.00) // 32
  (17.5    0.00    0.00) // 33
  (13.5    0.00    26.0) // 34
  (13.5    1.00    26.0) // 35
  (17.5    1.00    26.0) // 36
  (17.0    0.00    26.0) // 37
  (2.00    0.00    18.5) // 38
  (2.00    1.00    18.5) // 39
  (6.50    0.00    20.5) // 40
  (6.50    1.00    20.5) // 41
  (11.0    0.00    22.5) // 42
  (11.0    1.00    22.5) // 43
);

blocks         
(
    hex (0 1 2 3 4 5 6 7) (300 1 60) simpleGrading (1 1 1) // block 0
    hex (3 2 8 9 7 6 10 11) (300 1 60) simpleGrading (1 1 1)// block 1
    hex (9 8 12 13 14 15 16 17) (300 1 60) simpleGrading (1 1 1) // block 2
    hex (13 12 18 19 17 16 20 21) (300 1 60) simpleGrading (1 1 1) // block 3
    hex (19 18 22 23 24 25 26 27) (300 1 60) simpleGrading (1 1 1) // block 4
    hex (23 22 28 29 27 26 30 31) (300 1 60) simpleGrading (1 1 1) // block 5
    hex (29 28 32 33 34 35 36 37) (300 1 60) simpleGrading (1 1 1) // block 6
    hex (7 38 39 6 4 5 4 5) (300 1 60) simpleGrading (1 1 1) // block 7
    hex (17 40 41 16 14 15 14 15) (300 1 60) simpleGrading (1 1 1) // block 8
    hex (27 42 43 26 24 25 24 25) (300 1 60) simpleGrading (1 1 1) // block 9
);
edges         
(
);
boundary       
(
    inlet
    {
        type patch;
        faces
        (
            (0 1 5 4)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (33 32 36 37)
        );
    }
    bottomWall
    {
    type wall;
    faces
    (
        (0 1 2 3)
        (3 2 8 9)
        (9 8 12 13)
        (13 12 18 19)
        (19 18 22 23)
        (23 22 28 29)
        (29 28 32 33)
    );
    }
    frontAndBack
    {
    type empty;
    faces
    (
        (0 4 7 3)
        (3 7 11 9)
        (9 14 17 13)
        (13 17 21 19)
        (19 24 27 23)
        (23 27 31 29)
        (29 34 37 33)
        (1 5 6 2)
        (2 6 10 8)
        (8 15 16 12)
        (12 16 20 18)
        (18 25 26 22)
        (22 26 30 28)
        (28 35 36 32)
    );
    }
);

mergePatchPairs
(
);


alexB April 22, 2015 10:23

Hi Chris

A sketch of your geometry would be very helpful.

But I think I know the problem and can show a good workaround.

I think your mesh contains at least two neighbouring blocks with inconsistent grids... see picture .
http://fs2.directupload.net/images/150422/irbf4uky.jpg
If you want to avoid mergepatchpairs you have to insert additional blocks... see picture
http://fs2.directupload.net/images/150422/uaaope2z.jpg

Its the same workaround like in the tutorial cavitatingFoam/throttle .

I hope this rather short answer solved your prob.

regards
Alex

CrisMoreira April 24, 2015 09:53

2 Attachment(s)
Hello Alex, i'm sorry for the delay.
Thank you for your reply, iwas trying to understand what you explained but still i couldn't resolve the problem.
Here is the images of what i'm trying to do: to do the blocks hex (0 1 2 3 4 5 6 7) and to the the prism on top of that block hex (7 38 39 6 4 5 4 5)

alexeym April 24, 2015 10:23

1 Attachment(s)
Hi,

I would suggest to divide your mesh like on the attached figure (i.e. using only hexagons). Prismatic blocks are in general PITA (or they just do not like me).

alexB April 24, 2015 17:27

Ohhh yeah, I see your problem.

Not only that I can confirm alexey's opinion with prismatic blocks... but also you have messed up the grading for your blocks.

See User Guide http://cfd.direct/openfoam/user-guid...#x25-1420005.3
Quote:

Each block has a local coordinate system http://cfd.direct/wp-content/html/Us...g/user451x.png that must be right-handed. A right-handed set of axes is defined such that to an observer looking down the http://cfd.direct/wp-content/html/Us...g/user452x.png axis, with http://cfd.direct/wp-content/html/Us...g/user453x.png nearest them, the arc from a point on the http://cfd.direct/wp-content/html/Us...g/user454x.png axis to a point on the http://cfd.direct/wp-content/html/Us...g/user455x.png axis is in a clockwise sense.
Quote:

5.3.1.3 The blocks
The block definitions are contained in a list named blocks. Each block definition is a compound entry consisting of a list of vertex labels whose order is described in section 5.3, a vector giving the number of cells required in each direction, the type and list of cell expansion ratio in each direction.
In short:
You have to look at every block which direction is your x1,x2,x3 . And then decide the grading in this direction.

Perhaps you can blockMesh your grid for a first raw version if you change the grading for all not prismatic blocks from (300 1 60) to (1 60 300)

If it works you will see where to change the grading for a better solution and I hope you see the problem with prismatic blocks like predicted by alexey. ;) (in one corner the mesh becomes ultrafine... gives problem with the Courant number in most cases)

regards
Alex

hk318i April 25, 2015 07:05

The problem isn't only the grading for each block. Also the local coordinates isn't following the right-hand rule. You will get a warning for negative or zero volumes when you fix the grading problem. The mesh will look fine in paraview but the solver will not run.
Bw,
Hassan

CrisMoreira April 28, 2015 15:12

Thank you so much for all your help.
Using your suggestions and rewriting blockMeshDict using only hexagons and the right-hand rule, the problem was solved.
But then i used checkMesh and got 2 failed mesh checks.
So i applied this suggestion:
Quote:

Perhaps you can blockMesh your grid for a first raw version if you change the grading for all not prismatic blocks from (300 1 60) to (1 60 300)
And only 1 mesh failed mesh check. I don't know if the nš of cells has a part in this or if it was only coincidence but i played with it but couldn't solve the problem.
Could you please give any tip in how to solve this?

alexB April 28, 2015 16:28

Hi Chris,

could you attach a sketch of your full grid, and the logs of blockMesh and checkMesh?

Perhaps the prob gets clearer for me then. ;)

regards
Alex

CrisMoreira April 28, 2015 18:00

Attachment 39118Hi Alex,
Here is the logs:
Code:

cristina@cristina-HP-Pavilion-g6-Notebook-PC:~/OpenFOAM/cristina-2.2.2/run/test/1$ blockMesh
/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.2                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.2.2-9240f8b967db
Exec  : blockMesh
Date  : Apr 28 2015
Time  : 22:41:02
Host  : "cristina-HP-Pavilion-g6-Notebook-PC"
PID    : 18354
Case  : /home/cristina/OpenFOAM/cristina-2.2.2/run/test/1
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

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

Creating block mesh from
    "/home/cristina/OpenFOAM/cristina-2.2.2/run/test/1/constant/polyMesh/blockMeshDict"
Creating curved edges
Creating topology blocks
Creating topology patches

Creating block mesh topology
--> FOAM Warning :
    From function polyMesh::polyMesh(... construct from shapes...)
    in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 901
    Found 13 undefined faces in mesh; adding to default patch.

Check topology

    Basic statistics
        Number of internal faces : 10
        Number of boundary faces : 46
        Number of defined boundary faces : 46
        Number of undefined boundary faces : 0
    Checking patch -> block consistency

Creating block offsets
Creating merge list .

Creating polyMesh from blockMesh
Creating patches
Creating cells
Creating points with scale 1

Writing polyMesh
----------------
Mesh Information
----------------
  boundingBox: (0 0 0) (17.5 1 26)
  nPoints: 293288
  nCells: 198000
  nFaces: 687720
  nInternalFaces: 500280
----------------
Patches
----------------
  patch 0 (start: 500280 size: 36000) name: inlet
  patch 1 (start: 536280 size: 36000) name: outlet
  patch 2 (start: 572280 size: 420) name: bottomWall
  patch 3 (start: 572700 size: 6600) name: frontAndBack
  patch 4 (start: 579300 size: 108420) name: defaultFaces

End

cristina@cristina-HP-Pavilion-g6-Notebook-PC:~/OpenFOAM/cristina-2.2.2/run/test/1$ checkMesh
/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.2                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 2.2.2-9240f8b967db
Exec  : checkMesh
Date  : Apr 28 2015
Time  : 22:45:18
Host  : "cristina-HP-Pavilion-g6-Notebook-PC"
PID    : 18371
Case  : /home/cristina/OpenFOAM/cristina-2.2.2/run/test/1
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

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

Create polyMesh for time = 0

Time = 0

Mesh stats
    points:          293288
    faces:            687720
    internal faces:  500280
    cells:            198000
    faces per cell:  6
    boundary patches: 5
    point zones:      0
    face zones:      0
    cell zones:      0

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

Checking topology...
    Boundary definition OK.
 ***Total number of faces on empty patches is not divisible by the number of cells in the mesh. Hence this mesh is not 1D or 2D.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
    Patch              Faces    Points  Surface topology                 
    inlet              36000    36661    ok (non-closed singly connected) 
    outlet              36000    36661    ok (non-closed singly connected) 
    bottomWall          420      488      ok (non-closed singly connected) 
    frontAndBack        6600    9616    ok (non-closed singly connected) 
    defaultFaces        108420  110288  ok (non-closed singly connected) 

Checking geometry...
    Overall domain bounding box (0 0 0) (17.5 1 26)
    Mesh (non-empty, non-wedge) directions (0 0 0)
    Mesh (non-empty) directions (0 0 0)
 ***Number of edges not aligned with or perpendicular to non-empty directions: 109800
  <<Writing 219600 points on non-aligned edges to set nonAlignedEdges
    Boundary openness (6.27077e-15 -2.59811e-15 7.98285e-17) OK.
    Max cell openness = 2.12958e-16 OK.
    Max aspect ratio = -1 OK.
    Minimum face area = 0.000111111. Maximum face area = 0.273333.  Face area magnitudes OK.
    Min volume = 0.000222222. Max volume = 0.00455556.  Total volume = 359.75.  Cell volumes OK.
    Mesh non-orthogonality Max: 45 average: 18.1399
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 2.5 OK.
    Coupled point location match (average 0) OK.

Failed 1 mesh checks.

End

Greetings :)

hk318i April 28, 2015 18:13

This error about the definition of the empty patches. You have many empty patches, the correct one which is frontAndBack only. blockMesh defines the defaultFaces as empty. You have to specify different boundary type for the defaultFaces.

Bw,
Hassan

CrisMoreira April 28, 2015 19:06

Thank you. Problem solved.

Using the 13 remaining faces as patch on defaultFaces solved the problem. :)

Best Regards

Cris

Edit: Actually it has to be a wall while running setFields a log message appear saying that it has to be a wall.


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