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

[blockMesh] Merging of multiple patch pairs

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Zena27

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 30, 2022, 05:35
Default Merging of multiple patch pairs
  #1
New Member
 
Lennart
Join Date: May 2022
Posts: 15
Rep Power: 4
levoCFD is on a distinguished road
Hi,

I am trying to build a mesh consisting of 4 blocks. For simplicity we can assume that they are cubic and of uniform size (see attached sketch).

Block 0 and 1 share an interface with the same number of cells on each side. However, block 2 and 3 have different cell numbers, so they need to be merged with the other blocks. Therefore, I have included double vertices for block 2 and 3.

Now I am using mergePatchPairs to connect the patches with the double vertices. I am able to connect block 0 & 2 and block 1 & 3, but when I also want to connect block 2 & 3, I get the following error message from blockMesh:

Code:
--> FOAM FATAL ERROR: 
Face 14502 reduced to less than 3 points.  Topological/cutting error A.
Old face: 2(6350 6366) new face: 2(6350 6366)
Does anyone know where this error is coming from and how to work around it?

This is my blockMeshDict:

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

convertToMeters 1;


vertices
(
    // front
    (0 1 0)            // 0
    (1 1 0)            // 1    
    (1 0 0)            // 2
    (0 0 0)             // 3

    (1 -1 0)            // 4
    (0 -1 0)            // 5

    (1 1 0)            // 6
    (2 1 0)            // 7    
    (2 0 0)            // 8
    (1 0 0)             // 9

    (1 0 0)            // 10
    (2 0 0)            // 11    
    (2 -1 0)            // 12
    (1 -1 0)             // 13
    
    // back
    (0 1 -1)            // 14
    (1 1 -1)            // 15    
    (1 0 -1)            // 16
    (0 0 -1)             // 17

    (1 -1 -1)            // 18
    (0 -1 -1)            // 19

    (1 1 -1)            // 20
    (2 1 -1)            // 21    
    (2 0 -1)            // 22
    (1 0 -1)             // 23

    (1 0 -1)            // 24
    (2 0 -1)            // 25    
    (2 -1 -1)            // 26
    (1 -1 -1)             // 27
);



blocks
(
    // block 0
    hex (0 1 2 3 14 15 16 17)
    (10 10 10)
    edgeGrading
    (
         1 1 1 1 
         1 1 1 1
         1 1 1 1
    )
    
    // block 1
    hex (3 2 4 5 17 16 18 19)
    (10 10 10)
    edgeGrading
    (
         1 1 1 1 
         1 1 1 1
         1 1 1 1
    )
    
    // block 2
    hex (6 7 8 9 20 21 22 23)
    (15 15 15)
    edgeGrading
    (
         1 1 1 1 
         1 1 1 1
         1 1 1 1
    )
    
    // block 3
    hex (10 11 12 13 24 25 26 27)
    (20 20 20)
    edgeGrading
    (
         1 1 1 1 
         1 1 1 1
         1 1 1 1
    )
);



defaultPatch
{
    name walls;
    type wall;
}



boundary
(
    back
    {
        type symmetryPlane;
        faces
        (
            (0 1 2 3)
            (3 2 4 5)
            (6 7 8 9)
            (10 11 12 13)
        );
    }

    front
    {
        type symmetryPlane;
        faces
        (
            (14 15 16 17)
            (17 16 18 19)
            (20 21 22 23)
            (24 25 26 27) 
        );
    }

    inlet
    {
        type patch;
        faces
        (
            (0 14 17 3)
            (3 17 19 5) 
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (7 8 22 21)
            (11 12 26 25)
        );
    }
    
    b0left
    {
        type patch;
        faces
        (
            (1 2 16 15)
        );
    }
    
    b2right
    {
        type patch;
        faces
        (
            (9 6 20 23)
        );
    }
    
    b1left
    {
        type patch;
        faces
        (
            (2 4 18 16)
        );
    }
    
    b3right
    {
        type patch;
        faces
        (
            (13 10 24 27)
        );
    }
    
    b2bottom
    {
        type patch;
        faces
        (
            (8 9 23 22)
        );
    }
    
    b3top
    {
        type patch;
        faces
        (
            (10 11 25 24)
        );
    }    
    
);



mergePatchPairs                                                                    
(
    ( b0left b2right )
    ( b1left b3right )
    ( b2bottom b3top )
);





);
// ************************************************************************* //
Attached Files
File Type: pdf blockSketch.pdf (7.6 KB, 32 views)
levoCFD is offline   Reply With Quote

Old   May 24, 2023, 19:38
Default
  #2
New Member
 
Edoardo
Join Date: Apr 2023
Location: Italy
Posts: 27
Rep Power: 3
Edoardo1993 is on a distinguished road
I am having the same issue. Did you solve it?
Edoardo1993 is offline   Reply With Quote

Old   May 26, 2023, 06:25
Default
  #3
Member
 
Zeinab
Join Date: Feb 2023
Posts: 32
Rep Power: 3
Zena27 is on a distinguished road
Hello,
you can not use stitchMesh/mergePatchPairs twice on the same edge, because stitchMesh converts the interface cells to polyhedral cells, and stitchMesh can not work on polyhedra cells itself. So, that's what create the problem.

Personally I'll try to use snappy, or I will put a cyclic BC on the patches that cannot be merged.

Also, I will try different order of merging but I think it won't work in this case if all the blocks have the same dimensions.
Edoardo1993 likes this.
Zena27 is offline   Reply With Quote

Old   June 1, 2023, 11:32
Default
  #4
New Member
 
Edoardo
Join Date: Apr 2023
Location: Italy
Posts: 27
Rep Power: 3
Edoardo1993 is on a distinguished road
Quote:
Originally Posted by Zena27 View Post
Hello,
you can not use stitchMesh/mergePatchPairs twice on the same edge, because stitchMesh converts the interface cells to polyhedral cells, and stitchMesh can not work on polyhedra cells itself. So, that's what create the problem.

I am trying to merge those 3 blocks (See image) but I have an error, though mergePatchPairs does not have to merge the same edge twice:

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _7bdb509494-20201222 OPENFOAM=2012
Arch   : "LSB;label=32;scalar=64"
Exec   : blockMesh
Date   : Jun 01 2023
Time   : 16:29:49
Host   : DESKTOP-R70FIVH
PID    : 3664
I/O    : uncollated
Case   : /mnt/c/Users/demar/desktop/provamesh
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

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

Creating block mesh from "system/blockMeshDict"
Creating block edges
No non-planar block faces defined
Creating topology blocks
Creating topology patches

Creating block mesh topology

Check topology

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

Creating block offsets
Creating merge list (topological search)...

Creating polyMesh from blockMesh
Creating patches
Creating cells
Creating points with scale 1
    Block 0 cell size :
        i : 0.15 .. 0.15
        j : 0.1 .. 0.1
        k : 0.25 .. 0.25

    Block 1 cell size :
        i : 0.35 .. 0.35
        j : 0.1 .. 0.1
        k : 0.25 .. 0.25

    Block 2 cell size :
        i : 0.15 .. 0.15
        j : 0.3 .. 0.3
        k : 0.25 .. 0.25

Creating merge patch pairs

Adding point and face zones
Creating attachPolyTopoChanger


--> FOAM FATAL ERROR: (openfoam-2012)
Face 73739 reduced to less than 3 points.  Topological/cutting error A.
Old face: 0() new face: 0()

    From void Foam::slidingInterface::coupleInterface(Foam::polyTopoChange&) const
    in file slidingInterface/coupleSlidingInterface.C at line 1450.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::exitOrAbort(int, bool) at ??:?
#2  Foam::slidingInterface::coupleInterface(Foam::polyTopoChange&) const at ??:?
#3  Foam::slidingInterface::setRefinement(Foam::polyTopoChange&) const at ??:?
#4  Foam::polyTopoChanger::topoChangeRequest() const at ??:?
#5  Foam::polyTopoChanger::changeMesh(bool, bool, bool, bool) at ??:?
#6  Foam::attachPolyTopoChanger::attach(bool) at ??:?
#7  ? at ??:?
#8  ? in /lib/x86_64-linux-gnu/libc.so.6
#9  __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#10  ? at ??:?
Aborted (core dumped)
Attached Images
File Type: jpg Immagine.jpg (51.0 KB, 30 views)

Last edited by Edoardo1993; June 1, 2023 at 20:56.
Edoardo1993 is offline   Reply With Quote

Old   June 6, 2023, 06:16
Default
  #5
Member
 
Zeinab
Join Date: Feb 2023
Posts: 32
Rep Power: 3
Zena27 is on a distinguished road
Hello,
Okay I'll let you know how does stitchMesh/mergePatchPairs work as far as I know. They work on hexagonal mesh cells, merge them, and convert them to polyhedral cells. So, any non-hexagonal cells can not be merged by the previous utilities.

So think about your case and see what happens when you merge the first two blocks, you will see that you have created a polyhedra cell that needs to be merged with the face in the third block. You can check it actually using check mesh. Merge two cells, and use checkMesh to see the type of the cells.

You can always merge the blocks automatically by using equal number of cells at the common face between the two blocks, and also by using the same vertices of the face at the interface.

Else, you can use cyclic BC.
Zena27 is offline   Reply With Quote

Old   June 7, 2023, 00:58
Default
  #6
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi,

3 blocks you showed does not need mergePatchPairs.
An attached image and case is the most simple mesh with 3 blocks.

If you share a simplified working case, we could easily solve problems.
Attached Images
File Type: png meshTest01.png (33.6 KB, 23 views)
Attached Files
File Type: zip blockMesh3blocks.zip (8.3 KB, 13 views)
snak is offline   Reply With Quote

Old   June 7, 2023, 07:15
Default
  #7
New Member
 
Edoardo
Join Date: Apr 2023
Location: Italy
Posts: 27
Rep Power: 3
Edoardo1993 is on a distinguished road
Quote:
Originally Posted by snak View Post
Hi,

3 blocks you showed does not need mergePatchPairs.
An attached image and case is the most simple mesh with 3 blocks.

If you share a simplified working case, we could easily solve problems.

Hi, snak. The case you shared is like mine, but blocks have to have different grading and number of cells. Block1 has to have a fine mesh while block2 and block3 a really coarse mesh.




Quote:
Originally Posted by Zena27 View Post
Hello,
Okay I'll let you know how does stitchMesh/mergePatchPairs work as far as I know. They work on hexagonal mesh cells, merge them, and convert them to polyhedral cells. So, any non-hexagonal cells can not be merged by the previous utilities.

So think about your case and see what happens when you merge the first two blocks, you will see that you have created a polyhedra cell that needs to be merged with the face in the third block. You can check it actually using check mesh. Merge two cells, and use checkMesh to see the type of the cells.

You can always merge the blocks automatically by using equal number of cells at the common face between the two blocks, and also by using the same vertices of the face at the interface.

Else, you can use cyclic BC.

Hi Zena, thank you for the answer. Unfortunately I can not merge the faces automatically by matching number of cells because I need different number of cells and different grading on each block. I'll take your tip and I am going to understand what BC is, hoping I can create the right mesh with it.
Edoardo1993 is offline   Reply With Quote

Old   June 7, 2023, 08:18
Default
  #8
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi Edoardo1993,

What you want is something like this?
Attached Images
File Type: png meshWithMergePatchPairs.png (46.6 KB, 22 views)
Attached Files
File Type: zip blockMesh3blocks02.zip (50.7 KB, 1 views)
snak is offline   Reply With Quote

Old   June 7, 2023, 08:43
Default
  #9
New Member
 
Edoardo
Join Date: Apr 2023
Location: Italy
Posts: 27
Rep Power: 3
Edoardo1993 is on a distinguished road
Quote:
Originally Posted by snak View Post
Hi Edoardo1993,

What you want is something like this?

Exactly! But when I lunch your blockMesh I get the same error (probably for the reason that Zena27 explained):



Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : _7bdb509494-20201222 OPENFOAM=2012
Arch   : "LSB;label=32;scalar=64"
Exec   : blockMesh
Date   : Jun 07 2023
Time   : 13:40:20
Host   : DESKTOP-R70FIVH
PID    : 460
I/O    : uncollated
Case   : /mnt/c/Users/demar/desktop/canecllami
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

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

Creating block mesh from "system/blockMeshDict"
Creating block edges
No non-planar block faces defined
Creating topology blocks
Creating topology patches

Creating block mesh topology
--> FOAM Warning :
    From Foam::polyMesh::polyMesh(const Foam::IOobject&, Foam::pointField&&, const cellShapeList&, const faceListList&, const wordList&, const Foam::PtrList<Foam::dictionary>&, const Foam::word&, const Foam::word&, bool)
    in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 919
    Found 6 undefined faces in mesh; adding to default patch frontAndBack

Check topology

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

Creating block offsets
Creating merge list (topological search)...

Creating polyMesh from blockMesh
Creating patches
Creating cells
Creating points with scale 1
    Block 0 cell size :
        i : 1 .. 1
        j : 1 .. 1
        k : 1 .. 1

    Block 1 cell size :
        i : 0.5 .. 0.5
        j : 0.5 .. 0.5
        k : 1 .. 1

    Block 2 cell size :
        i : 0.3333333333 .. 0.3333333333
        j : 0.3333333333 .. 0.3333333333
        k : 1 .. 1

Creating merge patch pairs

Adding point and face zones
Creating attachPolyTopoChanger


--> FOAM FATAL ERROR: (openfoam-2012)
Face 43 reduced to less than 3 points.  Topological/cutting error A.
Old face: 2(15 12) new face: 2(15 12)

    From void Foam::slidingInterface::coupleInterface(Foam::polyTopoChange&) const
    in file slidingInterface/coupleSlidingInterface.C at line 1450.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::exitOrAbort(int, bool) at ??:?
#2  Foam::slidingInterface::coupleInterface(Foam::polyTopoChange&) const at ??:?
#3  Foam::slidingInterface::setRefinement(Foam::polyTopoChange&) const at ??:?
#4  Foam::polyTopoChanger::topoChangeRequest() const at ??:?
#5  Foam::polyTopoChanger::changeMesh(bool, bool, bool, bool) at ??:?
#6  Foam::attachPolyTopoChanger::attach(bool) at ??:?
#7  ? at ??:?
#8  ? in /lib/x86_64-linux-gnu/libc.so.6
#9  __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#10  ? at ??:?
Aborted (core dumped)
Edoardo1993 is offline   Reply With Quote

Old   June 7, 2023, 08:53
Default
  #10
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi

Oops, you got the error with OpenFOAM v2012...

I am using OpenFOAM v2212. The same Warning appears but no errors there.

Log looks like this
Code:
Merging 3 patch pairs
    Adding point and face zones
    Merging with attachPolyTopoChanger
Removed 6 empty merged patches:
    (b0xMax b0yMax b1xMin b1yMax b2xMax b2yMin)
Removed 6 empty merged face zones:
    (b0xMaxb1xMin0Side0Zone b0xMaxb1xMin0Side1Zone b0yMaxb2yMin1Side0Zone b0yMaxb2yMin1Side1Zone b1yMaxb2xMax2Side0Zone b1yMaxb2xMax2Side1Zone)
I confirmed the same error with OpenFOAM v2106.




--addition
possible related commit

https://develop.openfoam.com/Develop...e3d5f68046b95a
snak is offline   Reply With Quote

Old   June 7, 2023, 09:02
Default
  #11
New Member
 
Edoardo
Join Date: Apr 2023
Location: Italy
Posts: 27
Rep Power: 3
Edoardo1993 is on a distinguished road
Quote:
Originally Posted by snak View Post
Hi

Oops, you got the error with OpenFOAM v2012...

I am using OpenFOAM v2212. The same Warning appears but no errors there.

Log looks like this
Code:
Merging 3 patch pairs
    Adding point and face zones
    Merging with attachPolyTopoChanger
Removed 6 empty merged patches:
    (b0xMax b0yMax b1xMin b1yMax b2xMax b2yMin)
Removed 6 empty merged face zones:
    (b0xMaxb1xMin0Side0Zone b0xMaxb1xMin0Side1Zone b0yMaxb2yMin1Side0Zone b0yMaxb2yMin1Side1Zone b1yMaxb2xMax2Side0Zone b1yMaxb2xMax2Side1Zone)
I confirmed the same error with OpenFOAM v2106.



Though the warning, is the mesh generated totally usable? Could you please attach the polyMesh directory? I want to try if it works properly and therefore I will maybe switch to v2212.


Thank you
Edoardo1993 is offline   Reply With Quote

Old   June 7, 2023, 09:07
Default
  #12
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
This is the case with polyMesh directory. There is no 0 directory. Could you please create initial and boundary conditions.
Attached Files
File Type: zip blockMesh3blocks02_wtihMesh.zip (56.1 KB, 1 views)
snak is offline   Reply With Quote

Old   June 7, 2023, 09:33
Default
  #13
New Member
 
Edoardo
Join Date: Apr 2023
Location: Italy
Posts: 27
Rep Power: 3
Edoardo1993 is on a distinguished road
Quote:
Originally Posted by snak View Post
This is the case with polyMesh directory. There is no 0 directory. Could you please create initial and boundary conditions.



Thank you.


What if I want different grading in the z direction too? Need to merge further interfaces?
Edoardo1993 is offline   Reply With Quote

Old   June 8, 2023, 07:32
Default
  #14
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi Edoardo1993,

When you just grading the mesh, there is no need to merge interfaces. If you add blocks, you have to merge additional interfaces.

Attached is a test case including results. It is derived from the standard cavity case.

The case is just a demonstration of blockMesh.It is preferable to avoid a sudden change in mesh.
Attached Images
File Type: png VirtualBox_Q4OS4Basic-ofv-dev-01_08_06_2023_19_14_36.png (155.8 KB, 26 views)
Attached Files
File Type: zip blockMesh3blocks03.zip (108.2 KB, 9 views)
snak is offline   Reply With Quote

Reply

Tags
blockmesh, mergepatchpairs


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
steadyUniversalMRFFoam Tutorial fails in MixingPlane HenrikJohansson OpenFOAM Bugs 0 February 14, 2019 05:48
mapField error rvl565 OpenFOAM Pre-Processing 1 September 6, 2018 17:13
[Other] dynamicTopoFVMesh and pointDisplacement RandomUser OpenFOAM Meshing & Mesh Conversion 6 April 26, 2018 08:30
createPatch Segmentation Fault (CORE DUMPED) sam.ho OpenFOAM Pre-Processing 2 April 21, 2014 03:01
chtMultiRegionFoam Tutorial m.nichols19 OpenFOAM 12 September 9, 2010 12:56


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