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

[mesh manipulation] stitchMesh Not Working Properly

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 22, 2020, 12:09
Default stitchMesh Not Working Properly
  #1
New Member
 
Semih Batuhan Candir
Join Date: Feb 2020
Posts: 3
Rep Power: 6
leuthar is on a distinguished road
Hello everyone,

I'm trying to create a model to study damBreak case, but I want to refine my mesh manually where it is needed. I tried using refineMesh, but was not able to refine my mesh the way I wanted. So, I decided using stitchMesh, but I'm facing a problem this time. I've created 4 simple blocks to understand how it works, general structure of the model is one block is placed on top of another one and then, two identical blocks are placed just next to them. I've managed to merge top and bottom faces of the blocks using mergePatchPairs in blockMesh file and created a boundary layer between two block pairs namely right1 and left1. I'm trying to make these two layers internal so that water can freely pass through these faces, but even though there is no errors in the process, I'm getting an error in ParaView that my mesh and field points doesn't match. I've looked up for stitchMesh a bit and figured out I should see nFaces as 0 in boundary file, but this is not the case for me. If you could help me figure out what is the problem or any kind of advice that you think might be useful is very much appreciated.

I'm attaching a screenshot to visualize my intention.

Here is my blockMesh file;
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1912                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

scale   1.000;

x1 0.00;
x2 5;
x3 10;
y1 0.00;
y2 5;
y3 10;
z1 0.00;
z2 5;
z3 10;

vertices
(
    ($x1 $y1 $z1) // 0
    ($x2 $y1 $z1) // 1
    ($x2 $y2 $z1) // 2
    ($x1 $y2 $z1) // 3
    ($x1 $y1 $z2) // 4
    ($x2 $y1 $z2) // 5
    ($x2 $y2 $z2) // 6
    ($x1 $y2 $z2) // 7
	// block0
    ($x1 $y1 $z2) // 8
    ($x2 $y1 $z2) // 9
    ($x2 $y2 $z2) // 10
    ($x1 $y2 $z2) // 11
    ($x1 $y1 $z3) // 12
    ($x2 $y1 $z3) // 13
    ($x2 $y2 $z3) // 14
    ($x1 $y2 $z3) // 15
	// block1
    ($x2 $y1 $z1) // 16
    ($x3 $y1 $z1) // 17
    ($x3 $y2 $z1) // 18
    ($x2 $y2 $z1) // 19
    ($x2 $y1 $z2) // 20
    ($x3 $y1 $z2) // 21
    ($x3 $y2 $z2) // 22
    ($x2 $y2 $z2) // 23
	// block2
    ($x2 $y1 $z2) // 24
    ($x3 $y1 $z2) // 25
    ($x3 $y2 $z2) // 26
    ($x2 $y2 $z2) // 27
    ($x2 $y1 $z3) // 28
    ($x3 $y1 $z3) // 29
    ($x3 $y2 $z3) // 30
    ($x2 $y2 $z3) // 31
	// block3
);

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

edges
(
);

boundary
(
    leftWall
    {
        type wall;
        faces
        (
            (0 3 7 4)
            (8 11 15 12)
        );
    }
    rightWall
    {
        type wall;
        faces
        (
            (21 22 18 17)
            (29 30 26 25)
        );
    }
    lowerWall
    {
        type wall;
        faces
        (
            (0 1 2 3)
            (16 17 18 19)
        );
    }
    sideWall
    {
        type wall;
        faces
        (
            (3 2 6 7)
	    (11 10 14 15)
            (19 18 22 23)
	    (27 26 30 31)
        );
    }
    symmetry
    {
        type symmetryPlane;
        faces
        (
            (4 5 1 0)
            (12 13 9 8)
            (20 21 17 16)
            (28 29 25 24)
        );
    }
    atmosphere
    {
        type patch;
        faces
        (
            (12 15 14 13)
            (28 31 30 29)
        );
    }
// ************************************************************************* //
// Internal Boundaries
    internal1
    {
        type patch;
        faces
        (
            (4 7 6 5)
        );
    }
    internal2
    {
        type patch;
        faces
        (
            (8 9 10 11)
        );
    }
    internal3
    {
        type patch;
        faces
        (
            (20 23 22 21)
        );
    }
    internal4
    {
        type patch;
        faces
        (
            (24 25 26 27)
        );
    }
// ************************************************************************* //
// Internal Faces that cannot be merged
    right1
    {
        type wall;
        faces
        (
            (5 6 2 1)
            (13 14 10 9)
        );
    }
    left1
    {
        type wall;
        faces
        (
            (16 19 23 20)
            (24 27 31 28)
        );
    }
);

mergePatchPairs
(
	    (internal1 internal2)
	    (internal3 internal4)

);

// ************************************************************************* //
And this is the stitchMesh file I'm trying to use,
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1912                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      stitchMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

right1
{
    match   perfect;    // partial | integral | perfect
    master  right1;
    slave   left1;
}


// ************************************************************************* //
I have also tried "partial" and "integral" options for matching, but none of them seem to solve my problem. Please let me know if you need any further information.
Attached Images
File Type: jpg Mesh.jpg (48.4 KB, 43 views)
leuthar is offline   Reply With Quote

Old   August 11, 2020, 19:58
Default
  #2
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 6
Ship Designer is on a distinguished road
Hello leuthar,

I propose the following:
  • Use stitchMesh with the option -noFields. This prevents it from even looking at any fields possibly present in the 0 folder and complain about not matching mesh, points etc.
  • Check whether after using stitchMesh there's a file meshPhi in the 0 folder. If so, try deleting it and see if ParaView still reports an error. I recommend deleting it also before running stitchMesh.
From your description I haven't understood if the patches in the end are matched properly or not. An easy way to inspect this is by looking at internalField in ParaView and set it to a reduced opacity. If you can see internal patches shining through, they are not matched. Also, if all the matched patches bother you in ParaView's Mesh Regions list, you can tidy it up by executing createPatch with an empty createPatchDict dictionary after meshing. This won't create new patches but remove from the polyMesh/boundary file all patch entries with 0 faces and correct the patches count. So the list will be neat with only the patches you need for your simulation. Hope this helps. Please let me know how it goes.
Ship Designer is offline   Reply With Quote

Old   November 30, 2020, 07:30
Default
  #3
New Member
 
Join Date: Jun 2020
Location: UK
Posts: 22
Rep Power: 5
Rango is on a distinguished road
Hi,

Stitching/merging patches can be tricky for this case. Either it is a bug or a limitation with the application (see the threads below for more details):
Post#5: Face reduced to less than 3 points (simple cubic blocks)
Post#9 and Post#25: when can stitchMesh be used?

I renamed (and re-arranged) the patches in your blockMeshDict (just minor changes), and managed to remove the internal boundaries between different regions by performing:
Code:
blockMesh
stitchMesh -partial part1and2_to_part3and4 part3and4_to_part1and2 -overwrite
Then you can delete empty patches from your 'boundary' file. The case and snapshots of the mesh have been attached (I have used OpenFOAM 5.x for this case).

Cheers
Attached Images
File Type: jpg regions.jpg (82.5 KB, 42 views)
File Type: jpg stitchedMesh.jpg (81.4 KB, 36 views)
Attached Files
File Type: zip case.zip (3.6 KB, 11 views)
Rango 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
potentialFoam not working properly GAlava OpenFOAM Running, Solving & CFD 7 March 9, 2021 11:34
Is there any institutions still working on solving N-S equations? sharonyue Main CFD Forum 2 November 11, 2015 08:23
what "If" condition means in rebound brbbhatti OpenFOAM Programming & Development 0 August 12, 2014 09:18
Slip BC not working properly lfbarcelo OpenFOAM 3 July 15, 2010 09:53
Sample utility not working properly titio OpenFOAM 2 June 9, 2010 10:45


All times are GMT -4. The time now is 19:25.