CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (http://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   Removing interfaces from data files (http://www.cfd-online.com/Forums/openfoam-meshing/61622-removing-interfaces-data-files.html)

peter_watson March 19, 2008 11:29

I have a STAR-CCM+ model which
 
I have a STAR-CCM+ model which works without problems, converges etc. This is an MRF model. In STAR-CCM+ the static and rotating parts of the mesh are separated by an internal interface. This interface remains in the model after conversion with ccm26ToFoam, and appears as two boundary regions, which make a perfect match.

OpenFOAM does not support internal interfaces or baffles and therefore it appears that the these boundaries need to be stitched together to make new internal faces.

Note that we do not have STAR-CD, no prostar, which can write out the mesh and boundaries separately. CCM+ will not allow me to do this.

Advice would be appreciated.

mbeaudoin March 20, 2008 09:28

Hi Peter, Have you tried us
 
Hi Peter,

Have you tried using stitchMesh?

Usage: stitchMesh <root> <case> <masterpatch> <slavepatch> [-perfect] [-partial]


Martin

peter_watson March 20, 2008 10:32

Martin, I have tried this a
 
Martin,

I have tried this and it does not work. stitchMesh requires 4 parameters, <root>, <case>, <masterpatch> and <slavepatch>.

I have the following files after conversion by ccm26ToFoam:

~/0/cellId
~/0/cellType
~/constant/polyMesh/boundary
~/constant/polyMesh/cellZones
~/constant/polyMesh/faces
~/constant/polyMesh/neighbour
~/constant/polyMesh/owner
~/constant/polyMesh/points
~/constant/polyMesh/sets/cellZone_1
~/constant/polyMesh/sets/cellZone_2

The masterPatch and slavePatch are internal to the above files and not separate entities.

The model was set up in CCM+ such that I can guarantee a perfect match across the internal interface.

Regards

mbeaudoin March 20, 2008 14:01

Hi Peter, The
 
Hi Peter,

The <masterpatch> and <slavepatch> are patch "names", and not patch "filenames".

Look into your file ~/constant/polyMesh/boundary.

If you can find your patch names there, then use them for stitchMesh like this:

stitchMesh . my_ccm26ToFoamCase nameOfPatch_1 nameOfPatch_2

Martin

peter_watson March 31, 2008 03:12

Martin, Now I am back from
 
Martin,

Now I am back from holiday I have followed your advice and unfortunately it did not work. The result is copied below:

pwa@cfd:~/ccmMakeMeshHere> stitchMesh .. ccmMakeMeshHere Copy_of_Interface Interface -perfect
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.4.1 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : stitchMesh .. ccmMakeMeshHere Copy_of_Interface Interface -perfect
Date : Mar 31 2008
Time : 08:58:13
Host : cfd
PID : 16572
Root : ..
Case : ccmMakeMeshHere
Nprocs : 1
Create time

Create mesh for time = 0

Coupling perfectly aligned patches Copy_of_Interface and Interface
Resulting (internal) faces will be in faceZone Copy_of_InterfaceInterfaceCutFaceZone

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


--> FOAM FATAL ERROR : point, face or cell zone already exists#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 Foam::polyMesh::addZones(Foam::List<foam::pointzon e*> const&, Foam::List<foam::facezone*> const&, Foam::List<foam::cellzone*> const&) in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/libOpenFOAM.so"
#3 main in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linux64GccDPOpt/stitchMesh"
#4 __libc_start_main in "/lib64/libc.so.6"
#5 Foam::regIOobject::readIfModified() in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linux64GccDPOpt/stitchMesh"


From function void addZones
(
const List<pointzone*>& pz,
const List<facezone*>& fz,
const List<cellzone*>& cz
)
in file meshes/polyMesh/polyMesh.C at line 865.

FOAM aborting

Aborted
pwa@cfd:~/ccmMakeMeshHere>

Regards Peter

dmoroian March 31, 2008 03:43

Hi Peter, Check this answer:
 
Hi Peter,
Check this answer: Remove Internals

peter_watson April 1, 2008 08:39

Dear Dragos, I followed the
 
Dear Dragos,

I followed the thread and went back to STAR-CCM+ and created two separate files, one for the rotating part and another for the static part.

Here is the result:

mergeMeshes /home/pwa/ccmMakeMeshHere rotatingPart /home/pwa/ccmMakeMeshHere staticPart
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.4.1 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : mergeMeshes /home/pwa/ccmMakeMeshHere rotatingPart /home/pwa/ccmMakeMeshHere staticPart
Date : Apr 01 2008
Time : 14:27:15
Host : cfd
PID : 8919
Root :
Case :
Nprocs : 1
Master: "/home/pwa/ccmMakeMeshHere" "rotatingPart"
mesh to add: "/home/pwa/ccmMakeMeshHere" "staticPart"

Create Times
Reading master mesh for time = 0
Create mesh

Reading mesh to add for time = 0
Create mesh

Writing combined mesh to 2e-05
patch names:
10
(
Leading_Edges_1
Shaft
Blades
Hub
Copy_of_Interface
Leading_Edges_2
Outlet
Interface
Inlet
Tank_Walls
)

patch types:
10
(
wall
wall
wall
wall
wall
wall
wall
wall
wall
wall
)

point zone names:
0
(
)

face zone names:
0
(
)

cell zone names:
0
(
)

Copying old patches
Adding new patches.


--> FOAM FATAL ERROR : polyTopoChange was constructed with a mesh with 6 patches.
The mesh now provided has a different number of patches 10 which is illegal
#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 Foam::polyTopoChange::compactAndReorder(Foam::poly Mesh const&, bool, Foam::Field<foam::vector<double> >&, Foam::List<int>&, Foam::List<int>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::map<int> >&, Foam::List<int>&, Foam::List<int>&, Foam::List<foam::map<int> >&) in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/libdynamicMesh.so"
#3 Foam::polyTopoChange::changeMesh(Foam::polyMesh&, bool, bool) in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/lib/linux64GccDPOpt/libdynamicMesh.so"
#4 Foam::polyMesh::readUpdate() in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linux64GccDPOpt/mergeMeshes"
#5 main in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linux64GccDPOpt/mergeMeshes"
#6 __libc_start_main in "/lib64/libc.so.6"
#7 __gxx_personality_v0 in "/home/pwa/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linux64GccDPOpt/mergeMeshes"


From function polyTopoChange::compactAndReorder(polyMesh&, const bool, const bool)
in file polyTopoChange/polyTopoChange/polyTopoChange.C at line 1631.

FOAM aborting

Aborted
pwa@cfd:~/ccmMakeMeshHere>

The rotating part has 6 boundary zones defined, and the static part has a further 4 boundary zones. Attempting to merge the meshes results in a domain with 10 boundary zones, when in reality two zones should be merged creating a model with 8 boundary zones.

Previously when the ccm+ file has been exported as a single domain 2 boundary zones were internal to the mesh and formed a cylindrical interface in the model. This interface is 3D, so it has the two flat circular ends and the circumferential surface all together.

dmoroian April 1, 2008 10:23

Hello Peter, Here is a discus
 
Hello Peter,
Here is a discussion on how to solve this kind of problem:mergeMesh
Basically it says:
Quote:

Before performing mergeMeshes, in boundary of the master case, I need to add the patchnames (from the second case) with nFaces 0 - some kind of place holder. Then, mergeMeshes was successful.
I hope it is useful,
Dragos

peter_watson April 2, 2008 04:43

Dear Dragos, I have followe
 
Dear Dragos,

I have followed your advice in what became an interesting diversion.

mergeMeshes did stitch together the two separate parts of the mesh into one model. However, it has given me the same boundary, faces, neighbour, owner and points files that I receive if I export both parts of the mesh together from CCM+ and then convert with ccm26ToFoam.

Unfortunately, the merged mesh only has one cellZone and not two and is therefore of no use in an MRF simulation.

Also the merged mesh contains the unwanted interface from the STAR-CCM+ model.

CCM+ uses the interface to separate the two parts of the MRF model. To remove the interface in CCM+ you first have to delete both the volume and surface meshes, leaving only the CAD behind. When you remesh without the interface there is only one cellZone in the model not two, also the boundary between the two cellZones no longer exists. So the interface has to remain. After conversion with ccm26ToFoam the interface appears in the neighbour and owner files as boundary data. This data needs to change to become internal faces.

This is what I am trying to achieve. I have one methodology, which produces models that run in icoFoam and turbFoam without trouble. However, these models have never run in SimpleFoam with MRF. These models always crash out.

Therefore I am interested in an alternative methodology for removing the interface and trying again to run MRF.

dmoroian April 2, 2008 05:07

Hi Peter, There is no problem
 
Hi Peter,
There is no problem if you still have the overlaping interfaces. It should be possible to remove them by using stitchMesh.
Again, there is no problem if you have only one zone in your mesh. You can define a cell set for the rotating part using cellSet and then transform that set into a zone using setsToZones utility.

Dragos

peter_watson April 2, 2008 10:20

Dear Dragos, Interesting, s
 
Dear Dragos,

Interesting, stitchMesh actually did just that, but not in the way I expected. I now have some new friends in my polyMesh directory, and some old friends normally resident in /sets are now absent from the party.

I now have the following files in polyMesh and the size of the file:

boundary 1633
cellZones 931
faces 202812803
faceZones 39558
meshModifiers 1118
neighbour 33016250
owner 33129866
points 120093444
pointZones 932

There is no /sets directory.

The boundary, faces, neighbour, owner and points files I am familiar with. The cellZones and pointZones files contain the usual 25 or so lines of header data, where you normally get vertex, face or cell data, both of these files only contain:

0
()

The faceZones file has a list of 4837, which is one side of my old (unwanted) interface. The meshModifiers now contains information on a perfectInterface, which is "active on."

I find this strange because I thought that OpenFOAM did not support internal interfaces.

I am unsure how to proceed because I now find myself with model files that are substantially different to the MRF mixer example. I was hoping to find my old friends in the sets directory would reappear, but no.

My understanding is that I need to define cellZones for both the rotating and static parts of the mesh. I have tried to run cellSet but it terminates after failing to find a set, which does not exist. The header data does exist, but beneath that all I have is the familiar:

0
()

Life with OpenFOAM would be easier if I worked for a company that was prepared to put its hand in its pocket to do things properly. Sadly not. Instead an old Fortran programme gets to try and sort this out on the fly. Ultimately more expensive.

dmoroian April 2, 2008 10:33

Be careful that stitchMesh pro
 
Be careful that stitchMesh produces the new mesh in a new time directory. That means, what you have in the constant/polyMesh directory remains there, and you should look for the result somewhere else!
I totally agree that some support for the guys that develop this would be very welcome, but unfortunately I'm in no possition to decide things like this http://www.cfd-online.com/OpenFOAM_D...lipart/sad.gif .

Dragos

peter_watson April 3, 2008 04:41

Dear Dragos, I have looked
 
Dear Dragos,

I have looked through all the directories and apart from the empty header files there are no cellZone_1 and cellZone_2 files (or anything with another name) in these directories.

Your advice of using cellSet to create the rotating part. How do I achieve this?

The key data in the cellSetDict file is:

// Name of set to operate on
name cellZone_1;

This implies that the set must exist to start with! In my case it does not.

// One of clear/new/add/delete/invert|subset/list
action on;

I have tried both new and add, but cellSet complains about the cellZone_1 not existing. naturally it does not exist, I am trying to make OpenFOAM do this, because I believe it is necessary to get the model running.

The rest of the cellsetDict file refers to:

topoSetSources
(
// cells in cell zone
zoneToCell;
{
name cellZone_1;
}
);

In my case zoneToCell is almost certainly wrong because i want to create a zone from cells and not cells in a zone.

Advice would be appreciated, and since this will remain online then it can be used to avoid other users in the future having to go through all this.

dmoroian April 3, 2008 06:21

Hi Peter, The cellSet utility
 
Hi Peter,
The cellSet utility has many different possibilities to select a bunch of cells. Take a look at ~/OpenFOAM/OpenFOAM-1.4.1/applications/utilities/mesh/manipulation/cellSet/cellS etDict file. One interesting option would be:
topoSetSources
(

<blockquote>// Cells with cell centre within box
<blockquote>boxToCell
{
<blockquote>box (0 0 0) (1 1 1);
}</blockquote></blockquote>

);
</blockquote>

I hope this is useful,
Dragos

peter_watson April 3, 2008 07:14

Dear Dragos, Thanks for you
 
Dear Dragos,

Thanks for your assistance. It is greatly appreciated. I will try your suggestion first, because you kindly responded.

A second possible approach is based on advice in another thread under mesh / mesh conversion / block mesh. There is a thread high up the list on removing internal faces from the mesh.

The advice here is to remove baffles, which start off as boundary regions and become new internal faces. This is what I am looking for. The problem in this case is that the interface in CCM+ is represented twice in the model, once in both cellZones. This means that I have two boundary definitions that are not necessarily consecutive in the model. The facility for removing baffles ask for a root, case and patchname. Only one patch name. I have two patch names each representating faces either side of the baffle. I can guarantee a perfect match, because the mesh in CCM+ was created with interface surface mesh parameters identical on both sides. When I stitched the models yesterday OpenFOAM reported a perfect match.

We now have CCM+ v3.02 and the ability to include cell sets. These are not translated by ccm26ToFoam. I was clearly hoping that these cell sets would be recognized by ccm26ToFoam and therefore appear as cellZone_1, etc. Alas no.

I have put this additional information in so that others with the same problem can see another possible solution to the problem (removing baffles).

Regards

andersking April 4, 2008 04:55

Hi Peter, stitchMesh is th
 
Hi Peter,

stitchMesh is the correct way to do this (as far as I know). Though I haven't been able to get it to work that sucessfully if any Zones or meshmodifiers are present (Due to the cells,faces and points being renumbered I think).

You will probably need to recreate the cellZones separately afterwards.

The procedure I use is as follows (for two meshes).

for a dir structure as follows.

root
\-merged
**\-system
**\-constant
**\-0
\-mesh1
**\-system (link to ../merged/system)
**\-constant (should be empty to start with)
\-mesh2
**\-system (link to ../merged/system)
**\-constant (should be empty to start with)

generate both the meshes - mesh1 and mesh2 - using any combination of blockMesh, netgenToFoam, gmshtoFoam, fluentMeshToFoam, etc that you want (don't have to use the same method for both).

remove any zones and mesh modifiers from both meshes.

rm mesh1/constant/polyMesh/*Zones*
rm mesh1/constant/polyMesh/meshModifiers*
rm mesh2/constant/polyMesh/*Zones*
rm mesh2/constant/polyMesh/meshModifiers*


If necessary change the boundary labels (in mesh?/constant/polyMesh/boundary )to stop mergeMeshes joining boundary conditions together (if necessary), and then copy one of the meshes to the merged directory.

rm -r merged/constant/polymesh
cp -rv mesh1/constant/polymesh


then merge it with the second mesh

mergeMeshes . merged . mesh2

This will create a new mesh in /merged/(timestep)/, which should be moved to the constant directory.

rm -r merged/constant/polyMesh
mv merged/(timestep)/polyMesh merged/constant
rm -r merged/(timestep)


then the mesh can be stitched together.

stitchMesh . merged interface1 interface2

and then moved back into the constant directory

rm -r merged/constant/polyMesh
mv merged/(timestep)/polyMesh merged/constant
rm -r merged/(timestep)


If you now need to recreate the sets/zones, setSet is a good choice as its interactive.

setSet . merged

though I haven't used it much. If you give an incorrect method it will list available options.

setSet> faceSet f0 new randomtextstringthatsnotvalid

gives a list of available methods.
my version gives:

pointToCell
boxToCell
zoneToPoint
surfaceToCell
nearestToCell
zoneToCell
cellToFace
pointToFace
normalToFace
boxToFace
rotatedBoxToCell
fieldToCell
cellToPoint
zoneToFace
nbrToCell
patchToFace
labelToCell
pointToPoint
faceToCell
boxToPoint
labelToPoint
boundaryToFace
faceToPoint
labelToFace
shapeToCell
faceToFace
cellToCell
surfaceToPoint


Hope this helps.

Cheers
Andrew

CYMa February 18, 2010 10:56

2 Attachment(s)
Hallo, Andrew,
I followed your method to merge and stitch two same meshes step by step. The mesh is depicted as follows,

I have merged two meshes very well, but when i tried to stitch side1 and side 2, it failed. The error is listed,
Duplicate point found in cut face. Error in the face cutting algorithm for global face 4(42413 42414 42447 42446) local face 4(402 603 604 403)
Slave size: 4200 Master size: 4200 index: 400.
Face: 7(42413 42414 88830 85223 11499 85023 88829)........................

I really can't find what's going wrong. May you give me some advice?
If possible, i will send you my cases (Merge, Mesh1 Mesh2).

Looking forward your guidelines very much!
Thank you.



suh August 1, 2011 08:05

hi peter_watson and dragos

i am having similar problem in solving MRFSimpleFoam in OF 1.7.1 for star ccm+ case of pump problem.

so, if you got any answer to your problem (1 st Thread) please guide me through this. I know it is long time but ...i am stuck with this now.

plz help me out.

Thank you in advance

Rebecca513 October 4, 2011 22:23

Hi Xinggang,

I encountered the same error message. Have you figured out the solution?
If you could share it, I really appreciate your help.

Thank you!

Best,

Hang


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