CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   MergeMesh and stitchMesh (https://www.cfd-online.com/Forums/openfoam-solving/57917-mergemesh-stitchmesh.html)

lr103476 February 18, 2008 09:16

Hi everybody, I would like
 
Hi everybody,

I would like merge 2 meshes into 1 meshes. Both interface patches are circular and for both meshes geometrically equal (the have both 160 faces).

Merging:

mergeMeshes . rootCase . addCase

works ok, but using stitchMesh I am not able to put the interface patch of both meshes in the interior.....I just did:

stitchMesh . newCase interface2 interface1

The result is a number of faces for interface1 becomes 0 and for interface2 the number of faces becomes 320 (the sum of both...)

What am I doing wrong? Any ideas? It should be simple to put two meshes together....

Regards, Frank

lr103476 February 18, 2008 16:37

Heya guys, Not altogether
 
Heya guys,

Not altogether please :-)

How do I get rid of the internal patches, after using mergeMeshes....It is possible with stitchMesh, right?

Frank

jason February 18, 2008 17:00

Hi, Have you tried the -per
 
Hi,

Have you tried the -perfect flag?

I don't think mergeMeshes actually joins two meshes together, ie - it doesn't merge the vertices/points into one single point.

I have used stitchMesh and that does actually 'merge' them together, take a look/view the the patches in paraFoam.

Admittedly, when it does work, it works really well, especially in blockMesh (see the mergePatchPairs bit at the end), Ive tried this with tet meshes but there is either some problems here and there or I was doing it wrong, probably the latter (from what I have read on here, there is a limit on the number of master/slave pairs, eg if you have 10 slave cells you cannot 'stich' them to 1 master cell. The limit seems to be 2 or 3 slave cells...but dont quote me on that) and also, tet quality seems to be an issue.

Im not at my desk for a couple of days but when I get back Ill find a case that does work and one that doesn't and try and post them on here. If you can post your case, it might help.

Jason

hsieh February 18, 2008 19:08

Hi, Frank, I have used merg
 
Hi, Frank,

I have used mergeMeshes and stitMesh quite a few times.

OF-1.4.1 seemed to have changed how stitchMesh works. I posted on this topic before. Please search the forum for stitchMesh. If you still have problem, you can contact me.

Pei
phsieh2005@yahoo.com

lr103476 February 19, 2008 03:23

Hi again :-) The perfect f
 
Hi again :-)

The perfect flag does not work, since the points on the 'interface' are not matching. Here is a picture of both meshes merged with mergeMeshes:

http://www.cfd-online.com/OpenFOAM_D...your_image.gif

So, the merging is successfull, but I can't get rid of both 'interfaces' from the two meshes......I tried different settings with stitchMesh, with one of the following resuls:
1) Nothing happens,
2) interface1 (160 faces) is summed to interface2 (160 faces), leaving interface1 with 0 patches and interface2 with 320.
3) Same as (2), but other way around.

Here are the rootCase and the addCase:





Thanks, Frank

lr103476 February 19, 2008 03:27

Hi again :-) The perfect f
 
Hi again :-)

The perfect flag does not work, since the points on the 'interface' are not matching. Here is a picture of both meshes merged with mergeMeshes:

http://www.cfd-online.com/OpenFOAM_D...ges/1/6725.jpg

So, the merging is successfull, but I can't get rid of both 'interfaces' from the two meshes......I tried different settings with stitchMesh, with one of the following resuls:
1) Nothing happens,
2) interface1 (160 faces) is summed to interface2 (160 faces), leaving interface1 with 0 patches and interface2 with 320.
3) Same as (2), but other way around.

Here are the rootCase and the addCase:
http://www.aero.lr.tudelft.nl/~frank/files/rootCase.tgz
http://www.aero.lr.tudelft.nl/~frank/files/addCase.tgz

Thanks, Frank

hsieh February 19, 2008 10:03

Hi, Frank, If the nodes on
 
Hi, Frank,

If the nodes on the two interfaces do not match, then, I am not sure stitchMesh can work.

Pei

lr103476 February 19, 2008 10:28

I thought that it should alway
 
I thought that it should always work, and when the points on both interfaces do match, they call it -perfect. And when the surfaces do not match, they call it -partial....

Could it be the case that I need to increase the number of points on both interfaces such that they will match better, geometrically ???

Anyone else?

Regards, Frank

dmoroian February 19, 2008 10:28

It should work. When I tried i
 
It should work. When I tried it, I used two faces with the same area but with different discretizations, and stitchMesh created polihedral cells at the interface.
Maybe tomorrow I'll try your case, Frank.

Dragos

hjasak February 19, 2008 10:40

No, it should just work - it i
 
No, it should just work - it is basically a static sliding interface that gets merged and thrown away.

Mesh resolution, type of cells etc does not make any difference, you just have to make sure the sliding interface is defined properly.

Hrv

lr103476 February 19, 2008 10:49

mergeMeshes worked beautifully
 
mergeMeshes worked beautifully, a layer of polyhedrals in inserted at the interface.

So now I have a completely valid new mesh, but with 2 interface patches which I want to get rid off :-(

So, merging: no problem! but wiping interface patches doesn't work....

Hrv, for this test, I don't want to define a sliding interface (that's one of my other interest), the merging is just a way to easily create a mesh with a very nice spherical innerMesh, which will be moved with the wing using setValues() :-)

Regards,
Frank

hjasak February 19, 2008 10:58

How's this: Go to the bound
 
How's this:

Go to the boundary file and delete the little bastards - there should be no faces in the anyway (right?).

Hrv

lr103476 February 19, 2008 11:20

Off course, if it contains no
 
Off course, if it contains no faces, I can simply remove it from the list. The problem is the after running stitchMesh, interface1 contains 0 faces, but interface2 contains twice as many (interface1 has 'consumed' interface1).....

I want to get rid of both interface patches, otherwise I have to specify the BCs on that internal patch, which I don't like.....

Frank

lr103476 February 19, 2008 16:03

Hi again, Wiping both inte
 
Hi again,

Wiping both interfaces with stitchMesh works for merging of 2 squares:

http://www.cfd-online.com/OpenFOAM_D...ges/1/6744.jpg

Here, the 2 interfaces (in the middle) contain 0 faces after stitching, the way it should be!

Could it be the case that for my previous case with 2 circular interfaces, those interfaces are not geometrically equal enough ??

Frank

hjasak February 19, 2008 17:50

Just check them visibly - what
 
Just check them visibly - what kind of intersection are you using. How come it couples my mixer vessel and it does not do your mesh? Is it a 1-cell slice + are you matching the edges. Have a look at it sideways...

It will be some simple, because as you can see the code is OK.

Hrv

lr103476 February 19, 2008 18:13

The interface is just two circ
 
The interface is just two circular patches with different point distributions. I haven't defined anything as sliding, slice or whatever. Just did "mergeMeshes . rootCase . addCase" with 1 mesh and 2 interface patches as a result.

When I zoom in, the different point distribution leads to both interface patches not to be geometrically lying on top of eachother.

You're right, it will be simple, possibly something with my setup, but I don't see it :-) Maybe, getting some sleep might help ;-)

Frank

hjasak February 20, 2008 03:07

I know precisely what you did.
 
I know precisely what you did. The side of interface2 is wider than that of interface1 by more than a tolerance of x percent of minimum edge size. As a result, you will get internal faces from the overlapping part AND the remaining facets will remain in the boundary patch of interface2.

Do a picture showing faces in patches interface1 and interface2 in different colours before the coupling and after the coupling and post them here.

Hrv

lr103476 February 20, 2008 05:42

I was also thinking about that
 
I was also thinking about that. Here's a picture of the 2 interface patches before using stitchMesh:

http://www.cfd-online.com/OpenFOAM_D...ges/1/6758.jpg

The following picture shows the mesh at the interface after stitching, including on patch with the size of the sum of both old patches...... This is probably due to the reason mentioned by Hrv...

http://www.cfd-online.com/OpenFOAM_D...ges/1/6759.jpg

Now I will try a much denser point distribution on both initial patches, that should solve the problem, right? To me, the tolerance of stitchMesh is not that small, why?

Frank

lr103476 February 20, 2008 06:02

I put a lot of point refinemen
 
I put a lot of point refinement on the initial patches --> without success :-( the same problem arises: one interface with 0 size and one interface with doubled size.....

I use the grid converter fluentMeshToFoam, maybe it writes the faces of both interface in the wrong order or so, I don't know, I will test blockMesh.....

Frank

hjasak February 20, 2008 06:15

Are you using integral match,
 
Are you using integral match, which adjusts for the boundary or partial match which does not. If you want correction, you should be using integral match.

Hrv

lr103476 February 20, 2008 06:27

I use the default, which is in
 
I use the default, which is integral if I'm not mistaken. I just noticed that everything works with stitching insideSlider and outsideSlider patches in the mixer2D, which is similar to my problem.

So it has to do with my mesh setup. I just converted 2 gambit meshes to openfoam, ran mergeMeshes and stitching goes wrong. Possibly something wrong with the conversion?

Frank

lr103476 February 20, 2008 07:14

Solved! at least for now :-)
 
Solved! at least for now :-)

I did import both (gridpro) meshes in gambit and exported as 1 mesh instead of two (rootCase and addCase). So I didn't have to use mergeMeshes and stitchMesh did its job perfectly.

Now the result of the stitching is 2 interface patches with 0 faces, so I can simply remove them, which was my initial goal :-)

Thanks for the ideas,
Frank

jdk March 5, 2008 06:29

Hi Frank, I have studied this
 
Hi Frank,
I have studied this thread quite close, because I'm having problems with stichMesh even though I believe I follow the same procedure as you use in the end. My procedure is as follows:
- Mesh a simple pipe in Gambit 2.4.6 with a non-conformal interface with perfect alignment. See picture http://www.cfd-online.com/OpenFOAM_D...ges/1/6900.gif
- Declare an inlet and outlet boundary in Gambit and 2 interface boundaries: int1 and int2.
- Export the mesh from Gambit as a single mesh for Fluent 5/6 solver
- import the single mesh using fluent3DMeshToFoam: "fluent3DMeshToFoam . Test mesh.msh"
- tries to merge and remove the 2 internal patches using: "stichMesh . test int1 int2 -perfect" This gives me a fatal error stating something with "... FOAM FATAL ERROR : point, face or cell zone already exists#0..."

Any ideas on what i'm doing wrong here??

Jens

lr103476 March 5, 2008 06:57

Hi Jens, Just remove the p
 
Hi Jens,

Just remove the pointZones / faceZones and cellZones files from the /constant/polyMesh dir.....

Btw, I only use fluentMeshToFoam (for me it works for 3D too)....

Frank

jdk March 5, 2008 08:31

Frank, Thank you very much, n
 
Frank,
Thank you very much, now it works fine. http://www.cfd-online.com/OpenFOAM_D...part/happy.gif Do you know why the xxZones files are put there in the first place by fluent3DMeshToFoam? I guess they can not be part of the fundamental mesh definition but rather a convient grouping of mesh elements for different utilities? Do you know of any utility that might not work because they have been deleted?

Jens

lr103476 March 5, 2008 08:53

no :-)
 
no :-)

kati March 5, 2008 11:19

At least cell zones are used w
 
At least cell zones are used with porous zones, or MRF model.

fluentMeshToFoam can't handle baffles etc., whereas fluent3DMeshToFoam can. The latter came to 1.4.1, there is something about it in the Release Notes.

jdk March 6, 2008 01:18

Thank you for your inputs.
 
Thank you for your inputs.

Jens

lr103476 April 2, 2008 13:05

Hi guys, I have a problem w
 
Hi guys,

I have a problem with stitchMesh. My mesh has 2 coinciding patches which need to be stitched.

When I use stitchMesh . case interface1 interface2, this leads to a lot of non-orthogonal faces and some concave angles.......

Is this a common problem???

Regards, Frank

andersking April 4, 2008 05:00

Hi Frank, I have had this
 
Hi Frank,

I have had this problem before. Usually when points on the two patches are very close, but not close enough to be merged and/or when two boundaries don't quite line up, resulting in small poorly defined faces.

I solved it by remeshing, though there may be better ways...

Cheers,
Andrew

nikhilmadduri June 25, 2008 23:43

hi everyone, i need to gene
 
hi everyone,

i need to generate a mesh around a cylnder. i have started with
quarter of it. now how to complete it? i tried with filter>Reflection
in paraview. it was working but i have a doubt that paraview being
just a viewing tool, if i take the reflection, is it really going to
change my computational domain physically??

this is a kind of urgent. reply will be greatly appreciated.

regards,
nike

velan February 19, 2009 02:42

Hi All, As geometry is symm
 
Hi All,

As geometry is symmetric, mesh generated only half of the domain. I solved the symmetric flow using this mesh. Now i need to solve the non symmetric flow. For that i need full mesh. I mirrored the mesh for 180degree. Now i have two mesh in different directories (name by pos and neg ). When i tried stitchMesh, it giving me error

Create Times
Reading master mesh for time = 0
Create mesh

Reading mesh to add for time = 0
Create mesh

Writing combined mesh to 9e-07


Face owner and neighbour are identical. This is not allowed.
Face: 4(98934 98956 98957 98935) masterPointID:-1 masterEdgeID:-1 masterFaceID:-1 patchID:0 owner:90180 neighbour:90180#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/vc/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/vc/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Foam::polyAddFace::polyAddFace(Foam::face const&, int, int, int, int, int, bool, int, int, bool) in "/home/vc/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/mergeMeshes"
#3 Foam::mergePolyMesh::addMesh(Foam::polyMesh const&) in "/home/vc/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/mergeMeshes"
#4 main in "/home/vc/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/mergeMeshes"
#5 __libc_start_main in "/lib/libc.so.6"
#6 Foam::regIOobject::write() const in "/home/vc/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/mergeMeshes"


From function polyAddFace
(
const face& f,
const label owner, const label neighbour,
const label masterPointID,
const label masterEdgeID,
const label masterFaceID,
const bool flipFaceFlux,
const label patchID,
const label zoneID,
const bool zoneFlip
)
in file /home/vc/OpenFOAM/OpenFOAM-1.5/src/dynamicMesh/lnInclude/polyAddFace.H at line 217.

FOAM aborting

Aborted

Suggestions are appreciated

Velan

velan February 19, 2009 02:46

Hi, Apologize for given wro
 
Hi,

Apologize for given wrong information, I used mergeMeshes for previous mail.


When i used stitchMesh, i got the following error,



stitchMesh -perfect ../neg ../pos/
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.5 |
| \ / A nd | Web: http://www.OpenFOAM.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/
Exec : stitchMesh -perfect ../neg ../pos/
Date : Feb 19 2009
Time : 13:15:12
Host : scram
PID : 8116
Case : /home/vc/P_10/stitch
nProcs : 1

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

Create mesh for time = 0

word::stripInvalid() called for word ..neg
For debug level (= 2) > 1 this is considered fatal
Aborted

olivier February 19, 2009 09:20

Hi Velan, If you have used
 
Hi Velan,

If you have used mergeMeshes previously on your case, you should have obtained a 1/ folder within you get a new polymesh. If you take this 1/polymesh and replace it instead of your old constant/polymesh, then you have the right setup to do stitchMesh.

StitchMesh command is using patches, not folders, so the command should be something like

stitchMesh patchMaster patchSlave.

I think the command you are using may not be correct.

Olivier

velan February 23, 2009 04:46

Hi Olivier, Thanks for your
 
Hi Olivier,

Thanks for your reply. I got the error message while doing mergeMeshes (Face owner and neighbour are identical. This is not allowed....), which i posted the error in previous mail.

May be the command which i am using was wrong. Can you please clarify few problems ?

* I have two meshes which having one symmetric half body mesh and another which is exactly rotated about 180 degree (mirror mesh)
* I have two directories by name orig and mirr
* I have the boundary name as Out, In, Top

Can you please tell me the exact command for merging mesh for my case?. Is there any separate Dict file for it ?

Similarly i not understand the option of mergeMesh

master root
master case
root to add
case to add


Where i can find the details about this option ?

simon19 August 10, 2009 18:33

stitch mesh error
 
2 Attachment(s)
Hi

I am using an axi-symmetric mesh something likes in the below image,I want to mesh this domain with two size: coarse and fine(like in the second image) then I tried to make a change in polyMesh dictionary and made 2 blocks and two patches by name of patch right and patch left like this:

convertToMeters 0.001;

vertices
(
(0 0 0)//0
(0.43661 0 10)//1
(0.43661 44 10)//2
(0 44 0)//3
(-0.43661 0 10)//4
(-0.43661 44 10)//5
(0 44 0)//6
(0.43661 44 10)//7
(0.43661 75 10)//8
(0 75 0)//9
(-0.43661 44 10)//10
(-0.43661 75 10)//11
);

blocks
(
hex (0 1 2 3 0 4 5 3) (30 44 1) simpleGrading (1 1 1)
hex (6 7 8 9 6 10 11 9) (15 31 1) simpleGrading (1 1 1)
// hex (6 7 10 9 6 8 11 9) (15 31 1) simpleGrading (1 1 1)
);

edges
(
);

patches
(
wall walls
(
(9 8 11 9)
(0 4 1 0)
(1 4 5 2)
(7 10 11 8)
)
symmetryPlane axis
(
(0 3 3 0)
(6 9 9 6)
)
patch left
(
(6 7 10 6)
)
patch right
(
(3 5 2 3)
)
wedge back
(
(3 5 4 0)

(9 11 10 6)
)
wedge front
(
(0 1 2 3)

(6 7 8 9)

)
);

blockMesh worked fine to create this mesh(like in the second image) but I need to delete to patches(right & left) That I created in the previous stage,so I try to use stitchMesh utility but I faced error like this:

Create time

Create mesh for time = 0

Coupling patches right and left
Resulting (internal) faces will be in faceZone rightleftCutFaceZone

Note: the overall area covered by both patches should be identical ("integral" interface).
If this is not the case use the -partial option

Adding point and face zones
Reading all current volfields


Patch face has got a neighbour This is not allowed.
Face: 5(905 926 2838 927 906) faceID:4201 owner:862 neighbour:137 patchID:5#0 Foam::error::printStack(Foam::Ostream&) in "/home/openfoam1.5/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/openfoam1.5/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Foam::polyModifyFace::polyModifyFace(Foam::face const&, int, int, int, bool, int, bool, int, bool) in "/home/openfoam1.5/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libdynamicMesh.so"
#3 Foam::slidingInterface::coupleInterface(Foam::poly TopoChange&) const in "/home/openfoam1.5/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libdynamicMesh.so"
#4 Foam::slidingInterface::setRefinement(Foam::polyTo poChange&) const in "/home/openfoam1.5/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libdynamicMesh.so"
#5 Foam::polyTopoChanger::topoChangeRequest() const in "/home/openfoam1.5/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libdynamicMesh.so"
#6 Foam::polyTopoChanger::changeMesh(bool, bool, bool, bool) in "/home/openfoam1.5/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libdynamicMesh.so"
#7 main in "/home/openfoam1.5/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/stitchMesh"
#8 __libc_start_main in "/lib/libc.so.6"
#9 Foam::regIOobject::readIfModified() in "/home/openfoam1.5/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/stitchMesh"


From function polyModifyFace::polyModifyFace
(
const face& f,
const label faceID,
const label owner,
const label neighbour,
const bool flipFaceFlux,
const label patchID,
const bool removeFromZone,
const label zoneID,
const bool zoneFlip
)
in file lnInclude/polyModifyFace.H at line 221.

FOAM aborting

Aborted

What is my mistake?

pramodopen4foam September 17, 2009 06:51

Hi I am using an axi-symmetric mesh something likes in the below image,I want to mes
 
Hi,
I am also facing same kind of problem, I am testing rotating propeller, I have merged Rotar which includes propeller with Tank, stiching tank and rotor mesh results in the same error as mentioned above,
My questions were
1) Is it possible to run command stitchMesh in OF-1.5,
2) if yes , could you please specify the cause for this error,

Thanks in advance,
Pramod

sharonyue December 25, 2012 03:51

Quote:

Originally Posted by lr103476 (Post 202576)
I use the default, which is integral if I'm not mistaken. I just noticed that everything works with stitching insideSlider and outsideSlider patches in the mixer2D, which is similar to my problem.

So it has to do with my mesh setup. I just converted 2 gambit meshes to openfoam, ran mergeMeshes and stitching goes wrong. Possibly something wrong with the conversion?

Frank

Hi Frank,
Does stitck mesh mean merge nodes? but afaik MRF do not need merge nodes, it can deal with the interface problem. http://www.cfd-online.com/Forums/ope...enfoam.htmlcan u give me any hints? Thanks in advance.

reini March 28, 2013 04:20

mergeMeshes doesn't work for arbitrary patch names
 
Hello all,

I'm trying to merge to cubic meshes. It works fine if the 6 patch names for each mesh are the same. However this makes it difficult to distinguish different patches in the merged grid. If I give different patch names for each grid mergeMeshes gives the following error message:

.
.
.
Copying old patches
Adding new patches.

--> FOAM FATAL ERROR:
Illegal neighbourPatch name
Valid patch names are
12
(
master0_half0
master0_half1
master1_half0
master1_half1
master2_half0
master2_half1
help0_half0
help0_half1
help1_half0
help1_half1
help2_half0
help2_half1
)


From function cyclicPolyPatch::neighbPatchID() const
in file meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C at line 825.

FOAM exiting

I'm pretty confused since I have not specified any neighborPatch with "name" like stated in the error message. Did anybody have the same problem or does anybody have a hint for solving it?

Thank you in advance

Reini

dogan April 17, 2013 08:14

Hi everyone,
I am working on a centrifugal pump simulation, and i am trying to stitch two interfaces byusing stitchMesh command. i post a thread explaining the situation in the link as followed:

http://www.cfd-online.com/Forums/ope...tml#post421020

if you have any idea to solve this problem, could you please help me.
Thanks in advance, and regards
Dogan


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