CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Native Meshers: blockMesh (http://www.cfd-online.com/Forums/openfoam-meshing-blockmesh/)
-   -   Problems using mergePatchPairs (http://www.cfd-online.com/Forums/openfoam-meshing-blockmesh/97280-problems-using-mergepatchpairs.html)

Peter83 February 13, 2012 19:57

Problems using mergePatchPairs
 
2 Attachment(s)
Hi there,

I am new user of OpenFOAM and managed to simulate simple 2D cases, like a flow in a single channel, so far. Now I am trying to build a little bit more complex geometries using blockMesh.

I want to start easy and so I just tried to build a geometry consisting of two rectangular blocks of different size and mesh. On the left of the big block there should be the inlet, on the right of the small block should be the outlet. The other sides are either walls or empty (see below). Like I read in the user manual, I can use mergePatchPairs to do so. Unfortunately the mesh I get looks not exactly like I want it. Why do these diagonal cells appear (see attached pictures)? They disappear if the meshsize of the two blocks are the same.

I also get this warning when running blockMesh:

Default patch type set to empty
--> FOAM Warning :
From function polyMesh::polyMesh(... construct from shapes...)
in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 888
Found 10 undefined faces in mesh; adding to default patch.

and this fatal error when running icoFoam after:

--> FOAM FATAL IO ERROR:
keyword interface2 is undefined in dictionary "/home/phauer/OpenFOAM/phauer-2.1.0/run/tutorials/incompressible/icoFoam/2Dpore_paper/0/p::boundaryField"

Why should I define the pressure on interface2? I defined it already as zeroGradient on fixedwalls.

I know, it's not a very challenging geometry and the actual case I try to simulate is more complex, but if I can't even bring this to run ...

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

convertToMeters 1e-03;

vertices
( //block1
(-10 -5 0)
(0 -5 0)
(0 5 0)
(-10 5 0)
(-10 -5 1)
(0 -5 1)
(0 5 1)
(-10 5 1)
//block2
(-10 -50 0)
(-10 50 0)
(-50 50 0)
(-50 -50 0)
(-10 -50 1)
(-10 50 1)
(-50 50 1)
(-50 -50 1)
);

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

edges
(
);

boundary
(
inlet
{
type patch;
faces
(
(10 11 15 14)
);
}

outlet
{
type patch;
faces
(
(1 5 6 2)
);
}

fixedWalls
{
type wall;
faces
(
(2 3 7 6)
(0 1 5 4)
(9 10 14 13)
(8 12 15 11)
(8 9 13 12)
);
}

frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(4 5 6 7)
(8 11 10 9)
);
}
);

patches
(
patch master
(
(0 4 7 3)
)

patch slave
(
(8 9 13 12)
)
);

mergePatchPairs
(
(master slave)
);

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

anon_a February 14, 2012 04:45

Good morning

About the diagonal lines:
They are non-hexagonal cells, created to avoid "hanging nodes".

Are you sure you are using this blockMeshDict?
The warning message about the undefined faces is that you have not declared them in boundary section of blockMeshDict, but you seem to have declared everything.
Also, you have no surface called "interface2" here. You should define in the 0 directory files all the entries of the "boundaries" section.

Peter83 February 14, 2012 23:56

Thanks very much for your answer!

That's good that I don't have to worry about the diagonal cells. And you are right, I renamed the patches and posted the wrong error message.
This is the right one:

--> FOAM FATAL IO ERROR:
keyword slave is undefined in dictionary "/home/phauer/OpenFOAM/phauer-2.1.0/run/tutorials/incompressible/icoFoam/2Dpore_paper_xx/0/p::boundaryField"

I don't really understand, why I should define the patches I want to merge in the 0 file. It's just an interface between two blocks where I can't really define a boundary condition. Where should I define the master and slave patch? They are also not declared in the boundary section of blockMeshDict because they are not a boundary in my understanding, or am I completely wrong?
Thats my 0/P file so far.

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
inlet
{
type fixedValue;
value uniform 0.01;
}

outlet
{
type fixedValue;
value uniform;
}

fixedWalls
{
type zeroGradient;
}

frontAndBack
{
type empty;
}
}

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

Thanks again for your quick answer!:)

Peter

anon_a February 15, 2012 18:27

I think that the last time I used this "mergePatchPairs" functionality, I declared both "master" and "slave" in the "boundary" section (I don't know about "patches", is this in 2.1?). Then, you don't have to specify slave in the 0 directory but off course the master boundary patch remains and you have to give a BC.

I hope that helps.

anon_a February 20, 2012 09:16

Did you finally make any progress on that?

Peter83 February 20, 2012 20:48

Hi,

Didn't made any progress with the merging. Seems that works different in 2.1. than in older versions.

However, I could manage to simulate my geometry by dividing the big block in three blocks and match the blocks instead of merging them. It works, but its not ideal as I can only match blocks with the same mesh size at the interface now.
If you have any idea how to match blocks with different mesh sizes (I guess that doesn't make much sense in most cases), please let me know.

Thanks very much!

Peter

andy May 30, 2012 11:05

mergePatchPairs
 
Hi FOAMers,

i tried to patch two cylinders (axis: 1 0 0 & 0 1 0) on a main cylindric system (axis: 0 0 1). I knew it would be difficult to patch these curvy patches with mergePatchPairs. But i never expected struggling for weeks. When I was sure that there was no mistake in my meshCalcultionScript I was looking for other reasons. One of many, many ideas was to check all available OF-versions.
Finally it turned out that only OpenFOAM-1.7.0 does the job. All other versions (i tested 1.5 - 2.x, included OpenFOAM-1.7.1) aborted blockMesh with error messages.
I would be delighted if someone tells me the different of mergeMatchPairs in OF170.
I guess there exist other tolerances. Finally I want to underline that merging rectangular patches together is no problem for all OF versions.

bye then!

sdpeterson August 9, 2012 18:12

Any solutions to merging yet?
 
1 Attachment(s)
Hello,

I'm trying to do roughly the same thing as in the original post and have not had any success (using 2.x). I've found several posts of people dealing with this issue, but haven't come across a good solution yet. I'm using OpenFOAM on a cluster where I'm not the admin, so getting other versions of OF is difficult (as suggested above). Has anyone had success merging meshes in 2.x, and if so, could you post a description of the steps? In my case, the interface I need to merge needs to be considered internal, thus having to supply a boundary condition to a face that should be internal is not acceptable, for obvious reasons. For reference, a simplified version of my blockMeshDict is below. Any help is much appreciated.

Best regards,
Sean

zatralias December 31, 2013 10:20

This worked for me in OF 2.1.0

I defined master and slave in the 'boundary' section setting them to type 'patch', and then merge them in the 'mergePatchPairs' section. I don't have a 'patches' section.
e.g. in the above blockMeshDict
...
boundary
(
...
master
{
type patch;
faces
(
(2 6 5 1)
);
}

slave
{
type patch;
faces
(
(15 11 8 12)
);
}
);

mergePatchPairs
(
(master slave)
);

Joe Wang June 27, 2014 00:22

Hi,
I also did it in your ways. But how to set up the boundary conditions of master and slave patches in "0" folder? Thanks.

Joe

Quote:

Originally Posted by zatralias (Post 468206)
This worked for me in OF 2.1.0

I defined master and slave in the 'boundary' section setting them to type 'patch', and then merge them in the 'mergePatchPairs' section. I don't have a 'patches' section.
e.g. in the above blockMeshDict
...
boundary
(
...
master
{
type patch;
faces
(
(2 6 5 1)
);
}

slave
{
type patch;
faces
(
(15 11 8 12)
);
}
);

mergePatchPairs
(
(master slave)
);


fs.chemech November 18, 2014 11:50

Hi Joe,

have you managed how to set up the boundary conditions of master and slave patches in "0" folder?

Thank you,

FS

Joe Wang November 19, 2014 03:34

Hi,
I just set the master and slave patches parameters with the same value of internalField.
Joe

Quote:

Originally Posted by fs.chemech (Post 519795)
Hi Joe,

have you managed how to set up the boundary conditions of master and slave patches in "0" folder?

Thank you,

FS



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