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

[blockMesh] Creating a block in a windtunnel

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By aow

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 12, 2019, 07:57
Exclamation Creating a block in a windtunnel
  #1
New Member
 
Hasse Hansen
Join Date: Apr 2019
Posts: 1
Rep Power: 0
hasse94 is on a distinguished road
Hi everyone.

I am trying to build a straight wind tunnel with a block body in located in the bottom of the wind tunnel.


However when I run blockMesh, I get the error:

Code:
Create time

Creating block mesh from
    "/home/hasse/OpenFOAM/hasse-6/run/BackWardsFacingStepChangeGeometry/system/blockMeshDict"
Creating block edges
No non-planar block faces defined
Creating topology blocks
Creating topology patches

Creating block mesh topology


--> FOAM FATAL ERROR: 
face 1 in patch 3 does not have neighbour cell face: 4(13 3 2 12)

    From function Foam::labelList Foam::polyMesh::facePatchFaceCells(const faceList&, const labelListList&, const faceListList&, Foam::label) const
    in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 118.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::polyMesh::facePatchFaceCells(Foam::List<Foam::face> const&, Foam::List<Foam::List<int> > const&, Foam::List<Foam::List<Foam::face> > const&, int) const at ??:?
#3  Foam::polyMesh::setTopology(Foam::List<Foam::cellShape> const&, Foam::List<Foam::List<Foam::face> > const&, Foam::List<Foam::word> const&, Foam::List<int>&, Foam::List<int>&, int&, int&, Foam::List<Foam::cell>&) at ??:?
#4  Foam::polyMesh::polyMesh(Foam::IOobject const&, Foam::Xfer<Foam::Field<Foam::Vector<double> > > const&, Foam::List<Foam::cellShape> const&, Foam::List<Foam::List<Foam::face> > const&, Foam::List<Foam::word> const&, Foam::PtrList<Foam::dictionary> const&, Foam::word const&, Foam::word const&, bool) at ??:?
#5  Foam::blockMesh::createTopology(Foam::IOdictionary const&, Foam::word const&) at ??:?
#6  Foam::blockMesh::blockMesh(Foam::IOdictionary const&, Foam::word const&) at ??:?
#7  ? in "/opt/openfoam6/platforms/linux64GccDPInt32Opt/bin/blockMesh"
#8  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#9  ? in "/opt/openfoam6/platforms/linux64GccDPInt32Opt/bin/blockMesh"
Aborted (core dumped)
My blockmeshDict file looks like this:


Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.001;

vertices
(
    (0 0 -0.5)  
    (0 250 -0.5)  
    (250 0 -0.5) 
    (250 50 -0.5)  
    (250 250 -0.5)
    (300 0 -0.5)
    (300 50 -0.5)
    (300 250 -0.5)
    (1000 0 -0.5)
    (1000 250 -0.5)

    (0 0 0.5)  
    (0 250 0.5)
    (250 0 0.5)  
    (250 50 0.5) 
    (250 250 0.5)  
    (300 0 0.5)
    (300 50 0.5)
    (300 250 0.5)
    (1000 0 0.5)
    (1000 250 0.5) 
);


blocks
(
    hex (0 2 4 1 10 12 14 11) (50 100 1) simpleGrading (1 3 1)
    hex (3 6 7 4 13 16 17 14) (30 100 1) simpleGrading (1 3 1)
    hex (5 8 9 7 15 18 19 17) (50 100 1) simpleGrading (1 3 1)
);

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 10 11 1)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (8 9 19 18)
        );
    }
    upperWall
    {
        type wall;
        faces
        (
            (1 4 14 11)
            (4 7 17 14)
            (7 9 19 17)
        );
    }
    lowerWall
    {
        type wall;
        faces
        (
            (0 10 12 2)
            (13 3 2 12)
            (13 3 6 16)
            (16 6 5 15)
            (15 5 8 18)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (0 1 4 2)
            (3 4 7 6)
            (5 7 9 8)
            (14 11 10 12)
            (17 14 13 16)
            (19 17 15 18)
        );
    }
);

// ************************************************************************* //

Can you give a hint or help to find the source of the error? I have tried to change the face mentioned in the error, but the error does not change.
hasse94 is offline   Reply With Quote

Old   April 25, 2019, 21:15
Default
  #2
aow
Member
 
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 11
aow is on a distinguished road
Hi there Hasse,

It seems you're trying to combine hexes with different cell sizes and non-matching edges. In your blockMeshDict file, hexes 1 and 3 are 250 units long in the y-direction and are split into 100 cells in this direction, whereas hex 2 is only 200 units tall, but is still divided into 100 cells. This means hexes 1 and 3 have 2.5 unit sized cells in the y-direction, but hex 2 has 2 unit sized cells, which means they cannot match exactly and the cell corners will not line up. Since they won't line up and you're not using faceMerging to connect hexes (i.e. use the mergePatchPairs command at the end of your blockMeshDict), the default method (i.e. faceMatching) of connecting hexes will fail since it expects all cell corners to line up exactly from hex to hex.

Second, your lowerWall definition is flawed. You're defining a boundary using only portions of faces from hexes 1 and 3, which I believe you're not allowed to do in blockMesh.

To avoid these issues, you need to do one of two things, but probably just the first one since I know it will for sure work and will produce a much nicer quality mesh than using the mergePatchPairs command within blockMeshDict anyway.

Option 1: split up hex 1 and hex 3 into two hexes along the plane y = 50. This way you can use faceMatching to connect the hexes without using any special commands so long as you keep the number of cells in the y-direction and z-direction the same where the hexes overlap along faces. Please see the figure below to illustrate what I mean.

Your updated blockMeshDict should be as follows...
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.001;

vertices
(
    // Left Wind Tunnel Wall
    (0    0    -0.5)  // 0
    (0    50   -0.5) // 1 NEW
    (0    250 -0.5) // 2
    (250  0     -0.5) // 3
    (250  50   -0.5) // 4
    (250  250 -0.5) // 5
    (300  0     -0.5) // 6
    (300  50   -0.5) // 7
    (300  250 -0.5) // 8
    (1000 0     -0.5) // 9
    (1000 50   -0.5) // 10 NEW
    (1000 250 -0.5) // 11

    // Right Wind Tunnel Wall
    (0    0    -0.5)  // 12
    (0    50   -0.5) // 13 NEW
    (0    250 -0.5) // 14
    (250  0     -0.5) // 15
    (250  50   -0.5) // 16
    (250  250 -0.5) // 17
    (300  0     -0.5) // 18
    (300  50   -0.5) // 19
    (300  250 -0.5) // 20
    (1000 0     -0.5) // 21
    (1000 50   -0.5) // 22 NEW
    (1000 250 -0.5) // 23
);


blocks
(
    hex (0  3  4  1  12 15 16 13) (50 20 1) simpleGrading (1 1 1) // hex 1
    hex (1  4  5  2  13 16 17 14) (50 80 1) simpleGrading (1 1 1) // hex 2
    hex (4  7  8  5  16 19 20 17) (30 80  1) simpleGrading (1 1 1) // hex 3
    hex (6  9  10 7  18 21 22 19) (50 20 1) simpleGrading (1 1 1) // hex 4
    hex (7  10 11 8  19 22 23 20) (50 80 1) simpleGrading (1 1 1) // hex 5
);

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 12 13 1)
            (1 13 14 2)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (9  10 22 21)
            (10 11 23 22)
        );
    }
    upperWall
    {
        type wall;
        faces
        (
            (2 14 17 5)
            (5 17 20 8)
            (8 20 23 11)
        );
    }
    lowerWall
    {
        type wall;
        faces
        (
            (0 3  15 12)
            (3 4  16 15)
            (4 7  19 16)
            (6 18 19 7)
            (6 9  21 18)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            // Left Wall
            (0 1 4  3)
            (1 2 5  4)
            (4 5 8  7)
            (6 7 10 9)
            (7 8 11 10)
            // Right Wall
            (12 15 16 13)
            (13 16 17 14)
            (16 19 20 17)
            (18 21 22 19)
            (19 22 23 20)
        );
    }
);

// ************************************************************************* //
Option 2: try to use faceMerging to combine just 3 hexes with the non-matching cell corners in the y-direction. To get this to work, which I'm not entirely sure of since I've not bothered to actually implement it for your specific case, I think you would want to split up your definition of the lowerWall boundary and make several new boundaries that you can merge together. Something like what I've put below would hopefully allow you to combine your 3 hexes without modifying their definitions at all.
Code:
boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 10 11 1)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (8 9 19 18)
        );
    }
    upperWall
    {
        type wall;
        faces
        (
            (1 4 14 11)
            (4 7 17 14)
            (7 9 19 17)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (0 1 4 2)
            (3 4 7 6)
            (5 7 9 8)
            (14 11 10 12)
            (17 14 13 16)
            (19 17 15 18)
        );
    }
    lowerWall
    {
        type wall;
        faces
        (
            (0 2 12 10)
            (3 6 16 13)
            (5 8 18 15)
        );
    }
    slaveA
    {
        type wall;
        faces
        (
            (2 4 14 12) // hex 1 face
        );
    }
    masterA
    {
        type wall;
        faces
        (
            (3 13 14 4) // hex 2 face
        );
    }
    masterB
    {
        type wall;
        faces
        (
            (6 7 17 16) // hex 2 face
        );
    }
    slaveB
    {
        type wall;
        faces
        (
            (5 15 17 7) // hex 3 face
        );
    }
);

mergePatchPairs
{
    (masterA slaveA)
    (masterB slaveB)
}
aow is offline   Reply With Quote

Old   August 16, 2021, 07:32
Default
  #3
New Member
 
raj kumar saini's Avatar
 
Dr. Raj Kumar Saini
Join Date: Apr 2011
Location: Mumbai, India
Posts: 23
Rep Power: 15
raj kumar saini is on a distinguished road
Send a message via Skype™ to raj kumar saini
Quote:
Originally Posted by aow View Post
Hi there Hasse,

It seems you're trying to combine hexes with different cell sizes and non-matching edges. In your blockMeshDict file, hexes 1 and 3 are 250 units long in the y-direction and are split into 100 cells in this direction, whereas hex 2 is only 200 units tall, but is still divided into 100 cells. This means hexes 1 and 3 have 2.5 unit sized cells in the y-direction, but hex 2 has 2 unit sized cells, which means they cannot match exactly and the cell corners will not line up. Since they won't line up and you're not using faceMerging to connect hexes (i.e. use the mergePatchPairs command at the end of your blockMeshDict), the default method (i.e. faceMatching) of connecting hexes will fail since it expects all cell corners to line up exactly from hex to hex.

Second, your lowerWall definition is flawed. You're defining a boundary using only portions of faces from hexes 1 and 3, which I believe you're not allowed to do in blockMesh.

To avoid these issues, you need to do one of two things, but probably just the first one since I know it will for sure work and will produce a much nicer quality mesh than using the mergePatchPairs command within blockMeshDict anyway.

Option 1: split up hex 1 and hex 3 into two hexes along the plane y = 50. This way you can use faceMatching to connect the hexes without using any special commands so long as you keep the number of cells in the y-direction and z-direction the same where the hexes overlap along faces. Please see the figure below to illustrate what I mean.

Your updated blockMeshDict should be as follows...
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  6
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.001;

vertices
(
    // Left Wind Tunnel Wall
    (0    0    -0.5)  // 0
    (0    50   -0.5) // 1 NEW
    (0    250 -0.5) // 2
    (250  0     -0.5) // 3
    (250  50   -0.5) // 4
    (250  250 -0.5) // 5
    (300  0     -0.5) // 6
    (300  50   -0.5) // 7
    (300  250 -0.5) // 8
    (1000 0     -0.5) // 9
    (1000 50   -0.5) // 10 NEW
    (1000 250 -0.5) // 11

    // Right Wind Tunnel Wall
    (0    0    -0.5)  // 12
    (0    50   -0.5) // 13 NEW
    (0    250 -0.5) // 14
    (250  0     -0.5) // 15
    (250  50   -0.5) // 16
    (250  250 -0.5) // 17
    (300  0     -0.5) // 18
    (300  50   -0.5) // 19
    (300  250 -0.5) // 20
    (1000 0     -0.5) // 21
    (1000 50   -0.5) // 22 NEW
    (1000 250 -0.5) // 23
);


blocks
(
    hex (0  3  4  1  12 15 16 13) (50 20 1) simpleGrading (1 1 1) // hex 1
    hex (1  4  5  2  13 16 17 14) (50 80 1) simpleGrading (1 1 1) // hex 2
    hex (4  7  8  5  16 19 20 17) (30 80  1) simpleGrading (1 1 1) // hex 3
    hex (6  9  10 7  18 21 22 19) (50 20 1) simpleGrading (1 1 1) // hex 4
    hex (7  10 11 8  19 22 23 20) (50 80 1) simpleGrading (1 1 1) // hex 5
);

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 12 13 1)
            (1 13 14 2)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (9  10 22 21)
            (10 11 23 22)
        );
    }
    upperWall
    {
        type wall;
        faces
        (
            (2 14 17 5)
            (5 17 20 8)
            (8 20 23 11)
        );
    }
    lowerWall
    {
        type wall;
        faces
        (
            (0 3  15 12)
            (3 4  16 15)
            (4 7  19 16)
            (6 18 19 7)
            (6 9  21 18)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            // Left Wall
            (0 1 4  3)
            (1 2 5  4)
            (4 5 8  7)
            (6 7 10 9)
            (7 8 11 10)
            // Right Wall
            (12 15 16 13)
            (13 16 17 14)
            (16 19 20 17)
            (18 21 22 19)
            (19 22 23 20)
        );
    }
);

// ************************************************************************* //
Option 2: try to use faceMerging to combine just 3 hexes with the non-matching cell corners in the y-direction. To get this to work, which I'm not entirely sure of since I've not bothered to actually implement it for your specific case, I think you would want to split up your definition of the lowerWall boundary and make several new boundaries that you can merge together. Something like what I've put below would hopefully allow you to combine your 3 hexes without modifying their definitions at all.
Code:
boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 10 11 1)
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (8 9 19 18)
        );
    }
    upperWall
    {
        type wall;
        faces
        (
            (1 4 14 11)
            (4 7 17 14)
            (7 9 19 17)
        );
    }
    frontAndBack
    {
        type empty;
        faces
        (
            (0 1 4 2)
            (3 4 7 6)
            (5 7 9 8)
            (14 11 10 12)
            (17 14 13 16)
            (19 17 15 18)
        );
    }
    lowerWall
    {
        type wall;
        faces
        (
            (0 2 12 10)
            (3 6 16 13)
            (5 8 18 15)
        );
    }
    slaveA
    {
        type wall;
        faces
        (
            (2 4 14 12) // hex 1 face
        );
    }
    masterA
    {
        type wall;
        faces
        (
            (3 13 14 4) // hex 2 face
        );
    }
    masterB
    {
        type wall;
        faces
        (
            (6 7 17 16) // hex 2 face
        );
    }
    slaveB
    {
        type wall;
        faces
        (
            (5 15 17 7) // hex 3 face
        );
    }
);

mergePatchPairs
{
    (masterA slaveA)
    (masterB slaveB)
}
Good explanation.
raj kumar saini is offline   Reply With Quote

Old   August 16, 2021, 18:01
Default
  #4
aow
Member
 
Andrew O. Winter
Join Date: Aug 2015
Location: Seattle, WA, USA
Posts: 78
Rep Power: 11
aow is on a distinguished road
Thanks Raj! I'm glad you found it insightful.
aow is offline   Reply With Quote

Reply

Tags
block mesh, mesh generation problem, openfoam


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
[blockMesh] edges not aligned with or perpendicular to non-empty directions ynos OpenFOAM Meshing & Mesh Conversion 6 March 26, 2020 16:02
[ICEM] Replay not working properly - Creating the mesh for Free Block. Wingman ANSYS Meshing & Geometry 4 January 17, 2017 04:57
[blockMesh] Mixer mesh - negative volume problem jadtwo OpenFOAM Meshing & Mesh Conversion 2 November 6, 2014 17:37
[Commercial meshers] Icem Mesh to Foam jphandrigan OpenFOAM Meshing & Mesh Conversion 4 March 9, 2010 03:58
blockMesh: block with 6 vertexes dani OpenFOAM 3 June 25, 2009 14:13


All times are GMT -4. The time now is 14:02.