CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Commercial meshers] tmerge utility creates unwanted interface/walls comes in the final mesh (https://www.cfd-online.com/Forums/openfoam-meshing/76605-tmerge-utility-creates-unwanted-interface-walls-comes-final-mesh.html)

Shoonya May 31, 2010 03:51

tmerge utility creates unwanted interface/walls comes in the final mesh
 
Hi all,
Could any body help me in large mesh generation problem. I need a dense mesh in a annulus region of a cylinder. When I mesh it the size of the exported mesh reaches more then 2GB which crashes gambit. So I decomposed the geometry into four quarter cylinders. After that meshed each one individually, having size about 700 MB which is easilly exported by gambit. Merging those parts using tmerge utility I get a final_mesh. Now fluent does not load that big 2GB final_mesh, whereas penFOAM reads it. But any solvers of openFOAM does not run.Running the solver shows that there are some unwanted interfaces/walls have come. I meshed the geometry in gambit once using BCs and once without BCs, I found in both cases the tmerged mesh have too many walls/interfaces which are not required to me neither I had set them during mesh development. So my question is that how to remove those interfaces/walls. Since I can not load final_mesh into gambit/fluent to remove the interfaces/walls because it has size of 2GB which causes crashing problem in gambit/fluent. Further, could any body tell how to set boundary condition in a such cases where I need to export meshes in parts.
For some information I am working in dual core processors having RAM 4GB and 32 bit precision. Please let me know if any information is needed to resolve the problem.

thank you

dinesh

bigphil June 1, 2010 06:42

Hi dinesh,


After merging your meshes with the mergeMeshes utility, your meshes must be 'stitched' together using the stitchMesh utility.
stitchMesh will join the separate mesh domains together and remove the boundary between them.

For example,

If you have two meshes from gambit: MESH_1.neu and MESH_2.neu

You need to first create two separate cases in OpenFOAM and put MESH_1.neu into one of the cases, and MESH_2.neu into the other cases (using gambitToFoam utility).

Then whilst in case_1, use the mergeMeshes utility to merge case_2 with case_1.

Now if you check in constant/polyMesh/boundary, you will see that the interface boundaries are still there, so now you must use stitchMesh to stitch the two interface boundaries together:
stitchMesh INTERFACE_BOUNDARY_1 INTERFACE_BOUNDARY_2 -perfect

only use the perfect option if the two meshes line up correctly.

Now if you go back and check in constant/polyMesh/boundary, you will see that the interface boundaries have zero faces, so you can remove them from this file and alter the number of boundaries at the top of the file appropriately (ie if there were 10 boundaries and you remove 2, change the number of boundaries to 8).

Let me know how you get on,
Philip C

Shoonya June 4, 2010 08:28

Hello philip

Thank you for your quick reply.

Your idea of merging meshes in OpenFoam itself is great. And I was able to merge them making case_1, case_2 etc as you explained. But stitchMesh could not work; when I looked in the file constant/ploymesh/boundary, there was only a wall; which wall should it be stitched to? I mean using "stitchMesh" command needs two walls but here is only one wall. It can be seen below:

FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

1
(
wall
{
type wall;
nFaces 126000;
startFace 4170600;
}
)

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

Now if I do stitching with four meshes which are the parts of a cylinder, in that case I have constant/polymesh/boundary file as

20
(
floor:0
{
type wall;
nFaces 160;
startFace 71680;
}
ceiling:0
{
type wall;
nFaces 160;
startFace 71840;
}
outerFixedWall:0
{
type wall;
nFaces 800;
startFace 72000;
}
innerFixedWall:0
{
type wall;
nFaces 800;
startFace 72800;
}
wall:0
{
type wall;
nFaces 640;
startFace 73600;
}
floor:0:1
{
type wall;
nFaces 160;
startFace 74240;
}
ceiling:0:1
{
type wall;
nFaces 160;
startFace 74400;
}
outerFixedWall:0:1
{
type wall;
nFaces 800;
startFace 74560;
}
innerFixedWall:0:1
{
type wall;
nFaces 800;
startFace 75360;
}
wall:0:1
{
type wall;
nFaces 640;
startFace 76160;
}
floor:0:1:2
{
type wall;
nFaces 160;
startFace 76800;
}
ceiling:0:1:2
{
type wall;
nFaces 160;
startFace 76960;
}
outerFixedWall:0:1:2
{
type wall;
nFaces 800;
startFace 77120;
}
innerFixedWall:0:1:2
{
type wall;
nFaces 800;
startFace 77920;
}
wall:0:1:2
{
type wall;
nFaces 640;
startFace 78720;
}
floor
{
type wall;
nFaces 160;
startFace 79360;
}
ceiling
{
type wall;
nFaces 160;
startFace 79520;
}
outerFixedWall
{
type wall;
nFaces 800;
startFace 79680;
}
innerFixedWall
{
type wall;
nFaces 800;
startFace 80480;
}
wall
{
type wall;
nFaces 640;
startFace 81280;
}
)


***********************************************

Here basically only four boundaries which I had defined during mesh generation in gambit. If these 4 parts of cylinder are merged using "tmerge utility", it creates these interfaces like floor, floor:0, floor:0:1, floor:0:1:2, ceiling, ceiling 0:1, ceiling 0:1:2 etc (though there were only 'floor', ceiling etc not like 0:1, 0:1:2 etc). Now if I use this mesh in openFOAM using "fluentMeshToFoam"; it creates above shown interfaces BCs in /constant/polymesh/boundary, whereas only four BCs in files of "0 time dir".
Now if I try to remove those interfaces by using "stitchMesh uility" it says :

********************
$ stitchMesh wall:0 wall:0:1 -perfect
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 1.6-53b7f692aa41
Exec : stitchMesh wall:0 wall:0:1 -perfect
Date : Jun 04 2010
Time : 16:34:09
Host : Darwin
PID : 11747
Case : /home/dinesh/OpenFOAM/dinesh-1.6/run/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/case_1
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

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

Create mesh for time = 0

Coupling perfectly aligned patches wall:0 and wall:0:1
Resulting (internal) faces will be in faceZone wall:0wall:0:1CutFaceZone

Note: both patches need to align perfectly.
Both the vertex positions and the face centres need to align to within
a tolerance given by the minimum edge length on the patch
Adding point and face zones
Reading all current volfields
Reading volScalarField alphat


keyword floor:0 is undefined in dictionary "/home/dinesh/OpenFOAM/dinesh-1.6/run/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/case_1/0/alphat::boundaryField"

file: /home/dinesh/OpenFOAM/dinesh-1.6/run/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/case_1/0/alphat::boundaryField from line 26 to line 42.

From function dictionary::subDict(const word& keyword) const
in file db/dictionary/dictionary.C at line 449.

FOAM exiting
----------------------------------------------------------------------------------------------------------

So now the problem is concerned with stitching and boundary conditions. The interfaces created by "tmerge utility" can not be stitched due to different boundary condition comes in input files of "0 dir" and /constant/polyMesh/boundary file.
Your earlier idea may lead to the correct; but I am unable to get when I merge two meshes there is only one wall. To which wall should I stich it?

Thank you again for your valuable time

dinesh

bigphil June 4, 2010 12:51

dinesh,

first, one quick question:
If you are making the separate meshed volumes in gambit, can you not combine the meshed volumes in gambit and export them as one mesh?

If that is not an option, then using mergeMeshes and stitchMesh should work.
When you are merging and stitching cases try removing the '0' directory, just rename it to _0. You don't need the boundary conditions while you merge and stitch the cases, you can set them after the mesh is merged and stitched.

Maybe try just two of your volumes first,
when you have them in gambit make sure you define all the external boundaries of each mesh. Also define the external face that will be the interface too, and call it something like interface1.

Then on the second mesh call the external face that will be joined interface2.

Then after merging the meshes, you should be able to stitch interface1 with interface2.


Also before you stitch the meshes, try view your meshes in paraview (use foamToVTK then open the created vtk file in paraview) and check that your two mesh are lined up correctly.


Let me know how you get on,
Philip

bigphil June 4, 2010 12:54

EDIT: I posted twice by accident.
How can I delete this post?

Shoonya June 7, 2010 04:51

Thank you Philip

the problem is solved

Answer to your quick question :
if I have little mesh I can merge in gambit itself, perhaps no need to break in to 4 parts. I had to break it because if I was meshing whole geometry it was causing memory/crash problems (exceeding 2GB RAM). So I meshed parts and then exported each. Now I merge those parts by using "./utility tmerge -3d -cl -p mesh1 mesh2 ... mesh_final". This mesh_final has a size of 2GB which can not be read by gambit again. so wherever error might had occurred in meshing can not be removed by reloading in gambit/fluent and exporting again.

following your Ideas....I found

==>stitchMesh on "mesh_final" worked by renaming "0" dir as, say, "_0".
==> When I checked mesh in paraview I found that I was stitching wrong interfaces.
==> I was setting BCs for each parts of cylinder in gambit. When they were merged, they created lots of unwanted walls..which were creating problems.

still some boundary condition issues are remained but...that I shall solve myself.

dinesh

Abhinay Kulkarni January 16, 2012 06:27

Hello Philip,

I am a very new to openfoam and for that matter CFD itself. I had a question with the merging of meshes. I am just trying to merge two meshes which i generated in gmsh. I have followed your steps as you have written in your post above. But when i give the mergeMesh command i get an error stating

FOAM FATAL ERROR
Wrong number of arguments expected 2 found 3

My two cases are named trial1 and trial2 with the .msh mesh files and the constant, system directories present in both cases.

Can you kindly help me with this problem

Regards
Abhinay

bigphil January 16, 2012 07:54

Hi Abhinay,

If you have two cases called firstCase and secondCase. Then change directory into the firstCase:
Code:

cd firstCase
The if you are using mergeMeshes in OpenFOAM-2.1, the command is:
Code:

mergeMeshes . ../secondCase

If you are using mergeMeshes in OpenFOAM-1.6-ext, then the command is:
Code:

mergeMeshes . . . ../secondCase
This assumes that the two cases are in the same parent directory.
mergeMeshes does not care about the .msh files, the .msh files are fluent meshes, the OpenFOAM mesh in stored in .constant/polyMesh. So once you convert the fluent mesh to OpenFOAM with fluent3DMeshToFoam then you don't need the .msh files anymore (well maybe keep them as a backup).

After merging the meshes, you then need to stitch the meshes together using stitchMesh.

Hope it helps,
Philip

Abhinay Kulkarni January 17, 2012 05:36

Hi Philip,

thank you for your quick answer. I was successfull in managing to merge my two meshes with your help. I do have some questions though

1.What exactly is the meaning of the merged mesh being created in a new time step directory?

2. Should i copy the newly created Polymesh directory in my firstCase (which is in the time step directory) in a new case (say thirdCase) and then stitch the meshes?

3. I have already tried the second question above and the resultant mesh is highly skewed. Is this the wrong way to do it??

4. Can i stitch two surfaces with unequal areas?? like two cylinders with different areas. If yes what is the best way to do that?

I hope i have not asked one question too many :)

Regards
Abhinay

Just some additional info : I am using openFoam 2.0.1 with ubuntu 11.04 32bit

bigphil January 17, 2012 05:52

Abhinay,

Quote:

Originally Posted by Abhinay Kulkarni (Post 339676)
1.What exactly is the meaning of the merged meshes being created in a new time step directory?

If you run mergeMeshes in the first case directory, then mergeMeshes will create a new time-step in the first case that has a polyMesh (OpenFOAM mesh) directory in it.

Quote:

Originally Posted by Abhinay Kulkarni (Post 339676)
2. Should i copy the newly created Polymesh directory in my firstCase (which is in the time step directory) in a new case (say thirdCase) and then stich the meshes?

Yes you can make a third case and move the mergeMeshes polyMesh directory to the thirdCase/constant directory. Then if you use stitchMesh boundary1 boundary2 -perfect, it will stitch your merged meshes. The boundary1 and boundary2 need to have exactly the same mesh to use the -perfect option.

Quote:

Originally Posted by Abhinay Kulkarni (Post 339676)
3. I have already tried the second question above and the resultant mesh is highly skewed. Is this the wrong way to do it??

Did you use the -perfect option? are your two boundary interfaces have exactly the same mesh?

Quote:

Originally Posted by Abhinay Kulkarni (Post 339676)
4. My last question (may be the dumbest one) is do i have to stich the meshes? because i want to stich two, lets say pipes with the same diameter at the ends which i want to stich.

If you want your two regions of the mesh to be joined together then yes you have to stitch them, unless you are using some sort of coupled boundary condition like a GGI.

Philip

Abhinay Kulkarni January 20, 2012 05:56

Hi Philip,

I did manage to stitch my mesh to gether but the resultant mesh is highly skewed . I think this is because the meshes at the interface are not exactly the same (as you have mentioned above)

I am using gmsh for meshing. do you have any idea on how to generate similar meshes on different surfaces in gmsh?? or can you suggest me some other better mesh generator eith which i can do this (i would prefer if it is free like gmsh)

Just to give you an idea of my geometry i am trying to stitch together something like an old time telephone receiver as in, the ends from where you speak and listen to the main handle (Hope you are getting an image of what the geometry looks like)

Thanks for your help

Regards
Abhinay

bigphil January 20, 2012 07:23

Abhinay,

Yes I think the skewed cells at the interface are because your two meshes aren't exactly the same at the interface.

The easiest thing to do would be if you could mesh your entire geometry in Gmsh and then you wouldn't need to stitch it.
If you really need to stitch it then it should be possible to have the same interface mesh in Gmsh by maybe meshing one part first then delete everything except the interface mesh and then mesh the second part of your geometry using that same interface mesh. I haven't used Gmsh though. I use Gambit and ICEM which are both commercial. You could try snappyHexMesh or Discretizer or Salome but I am not sure if they are anymore suitable than Gmsh.

Philip


All times are GMT -4. The time now is 10:01.