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/)
-   -   [blockMesh] StitchMesh on two patches (https://www.cfd-online.com/Forums/openfoam-meshing/61755-stitchmesh-two-patches.html)

anita April 21, 2008 09:27

StitchMesh on two patches
 
Hi
I want to use stitchMesh to combine two regions.
The first one is L-shaped. The other one's position is inside the corner.
Like this:
------------------------------------
|6......................................5|
|.........................................|
|.........................................|
|1......................2................|
|==============................|
|10...................9||...............|
|........................||...............|
|........................||...............|
|7....................8||3.............4|
------------------------------------

I build patches: 1-2, 2-3, 10-9 and 9-8.

I can either stitch 1-2 to 10-9 or 9-8 to 2-3.
If I try a second stitch I get the error:



--> 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/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Foam::polyMesh::addZones(Foam::List<foam::pointzon e*> const&, Foam::List<foam::facezone*> const&, Foam::List<foam::cellzone*> const&) in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#3 main in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/stitchMes h"
#4 __libc_start_main in "/lib/libc.so.6"
#5 Foam::regIOobject::readIfModified() in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/stitchMes h"


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


I also tried with L-shaped patches: 1-2-3 and 10-9-8. In this case the error is:

....
local: 4(615 1002 1008 674) one side: 147 other side: 145
Finished face 147
local: 4(1002 616 675 1008) one side: 148 other side: 145
local: 4(616 1003 1009 675) one side: 148 other side: 146
Finished face 148
local: 4(1003 617 676 1009) one side: 149 other side: 146


--> FOAM FATAL ERROR : Zero length edge detected. Probable projection error: slave patch probably does not project onto master. Please switch on enriched patch debug for more info#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Foam::enrichedPatch::calcCutFaces() const in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#3 Foam::enrichedPatch::cutFaces() const in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#4 Foam::slidingInterface::coupleInterface(Foam::poly TopoChange&) const in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#5 Foam::slidingInterface::setRefinement(Foam::polyTo poChange&) const in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#6 Foam::polyTopoChanger::topoChangeRequest() const in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#7 Foam::polyTopoChanger::changeMesh(bool, bool) in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#8 main in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/stitchMes h"
#9 __libc_start_main in "/lib/libc.so.6"
#10 Foam::regIOobject::readIfModified() in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/stitchMes h"


From function void enrichedPatch::calcCutFaces() const
in file slidingInterface/enrichedPatch/enrichedPatchCutFaces.C at line 237.

FOAM aborting


Can somebody help me?

andersking April 21, 2008 10:48

Hi, stitchmesh creates zone (
 
Hi,
stitchmesh creates zone (and maybe meshModifiers) that cause multiple stitchMeshes to fail. If you delete the *Zones (pointZones,faceZones,cellZones) files in the polyMesh directory then using stitchMesh multiple times should work.

You might have to move the mesh into the constant directory first (not sure if stitchMesh puts the combined mesh in the constant directory or a new time directory)

Cheers
Andrew

anita April 22, 2008 01:57

Hi Andrew, if I do want you
 
Hi Andrew,

if I do want you said ( copy mesh to constant and delete *Zones) there is a new error.

------------------
Create mesh for time = 0

Coupling patches innerpatch and outerpatch
Resulting (internal) faces will be in faceZone innerpatchouterpatchCutFaceZone

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



--> FOAM FATAL ERROR : Not all zones and patches needed in the definition have been found. Please check your mesh definition.#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Foam::slidingInterface::checkDefinition() in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#3 Foam::slidingInterface::slidingInterface(Foam::wor d const&, Foam::dictionary const&, int, Foam::polyTopoChanger const&) in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#4 Foam::polyMeshModifier::adddictionaryConstructorTo Table<foam::slidinginterface>: :New(Foam::word const&, Foam::dictionary const&, int, Foam::polyTopoChanger const&) in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#5 Foam::polyMeshModifier::New(Foam::word const&, Foam::dictionary const&, int, Foam::polyTopoChanger const&) in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#6 Foam::polyTopoChanger::readModifiers() in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#7 Foam::polyTopoChanger::polyTopoChanger(Foam::polyM esh&) in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#8 main in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/stitchMes h"
#9 __libc_start_main in "/lib/libc.so.6"
#10 Foam::regIOobject::readIfModified() in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/stitchMes h"


From function void slidingInterface::checkDefinition()
in file slidingInterface/slidingInterface.C at line 85.

FOAM aborting

_______________________________________

CheckMesh says the mesh is ok.

What now?

andersking April 22, 2008 02:04

Hi Anita, If there is a me
 
Hi Anita,

If there is a meshModifiers in the polyMesh directory you will need to delete that too. If that's not the case then I'm not sure what the problem is.

Cheers,
Andrew

anita April 22, 2008 02:07

Hi again, I also deleted me
 
Hi again,

I also deleted meshModifiers. Now stitchMesh starts working and stops with error.
___________________________________________
--> FOAM FATAL ERROR : Face 31033 reduced to less than 3 points. Topological/cutting error B.
Old face: 2(20971 20471) new face: 2(20971 20471)#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Foam::slidingInterface::coupleInterface(Foam::poly TopoChange&) const in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#3 Foam::slidingInterface::setRefinement(Foam::polyTo poChange&) const in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#4 Foam::polyTopoChanger::topoChangeRequest() const in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#5 Foam::polyTopoChanger::changeMesh(bool, bool) in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt/libdynamicMesh.so"
#6 main in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/stitchMes h"
#7 __libc_start_main in "/lib/libc.so.6"
#8 Foam::regIOobject::readIfModified() in "/home/kienzani/OpenFOAM/OpenFOAM-1.4.1/applications/bin/linuxGccDPOpt/stitchMes h"


From function void slidingInterface::coupleInterface(polyTopoChange& ref) const
in file slidingInterface/coupleSlidingInterface.C at line 1666.

FOAM aborting
_________________________________________________

andersking April 22, 2008 02:53

Hmm, I'm not sure about this e
 
Hmm, I'm not sure about this error.

You might have better luck using createPatch to join patches 1-2 and 2-3 together and patches 10-9 and 9-8 together first, then use stitchMesh to join 1-2-3 and 10-9-8 together. (Or join these together in the original mesh creation step).

see OF-1.4.1/applications/utilities/mesh/manipulation/createPatch/createPatchDict for details on createPatch if you haven't used it before. Again, you'll probably have to move the mesh back to constant after each step, and remove any Zones and meshmodifiers files as well.

Regards,
Andrew

hjasak April 22, 2008 03:43

You need to use the latest upd
 
You need to use the latest updates in 1.4.1-dev: I have spent some weeks sorting out the sliding mesh algorithm you are using here.

Hrv

anita April 23, 2008 03:57

Hi, I now used the latest v
 
Hi,

I now used the latest version of 1.4.1-dev and received the same error (Face xxx reduced to less than 3 points.)

I also tried using createPatch like Andrew wrote above. This way the error is:

--> FOAM FATAL ERROR : Zero length edge detected. Probable projection error: slave patch probably does not project onto master. Please switch on enriched patch debug for more info

From function void enrichedPatch::calcCutFaces() const
in file slidingInterface/enrichedPatch/enrichedPatchCutFaces.C at line 248.


After each step I removed Zones and copied the mesh to constant.

hjasak April 23, 2008 04:19

Five to one you have messed up
 
Five to one you have messed up the definition of the patches that are supposed to be merged. These patches should be facing each other: yours are oriented 90 degrees relative to each other.

Please make a picture of the patches you are trying to merge and tell me what happened.

Hrv

anita April 23, 2008 05:34

Hallo Hrv, Here are two pic
 
Hallo Hrv,

Here are two pictures from the mesh. I cannot find a wrong definition.

Image of the mesh:

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

Image of the mesh with colored patches:
I want to merge red with green and blue with yellow.

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

Another problem I have is that with the 1.4.1-dev version checkMesh gives an error:
"This mesh has no valid solving directions. dirs = (-1 -1 -1). Please check mesh definition for empty patches. This is a 0-D mesh."
After using flattenMesh checkMesh says the Mesh is ok.

It is the same problem like the one I descripted in http://www.cfd-online.com/OpenFOAM_D...tml?1207732177

Maybe the stitch problem is a consequence?

hjasak April 23, 2008 10:43

You could try 2 things: - con
 
You could try 2 things:
- connect two surfaces one at a time, to see that the definition is OK.
- if you want to connect both together, you will need to use n-squared search in point projection since your surface has got a serious kink in it. There is a switch in:

.OpenFOAM-1.4.1-dev/controlDict


OptimisationSwitches
{
fileModificationSkew 10;
scheduledTransfer 0;
floatTransfer 1;
nProcsSimpleSum 0;

GGImaxIter 5;

nSquaredProjection 0;

}

Do nSquaredProjection 1; and try again.

Hrv

andras May 3, 2008 08:15

Hi all! I have been strugglin
 
Hi all!
I have been struggling with the same stitchMesh issues like Anita for some time and I haven't solved it yet.

I broke down the problem to the simplest possible test case in which I want to connect two pairs of "nonconformal interfaces". They are called if_a0, if_a1 and if_b0, if_b1. Can anybody explain to me how to connect if_a0 to if_a1 and if_b0 to if_b1 using the stitchMesh utility in OpenFOAM-1.4.1 ?

Here is the testcase:



regards,
Andras

andras May 3, 2008 08:19

Hi all! I have been strugglin
 
Hi all!
I have been struggling with the same stitchMesh issues like Anita for some time and I haven't solved it yet.

I broke down the problem to the simplest possible test case in which I want to connect two pairs of "nonconformal interfaces". They are called if_a0, if_a1 and if_b0, if_b1. Can anybody explain to me how to connect if_a0 to if_a1 and if_b0 to if_b1 using the stitchMesh utility in OpenFOAM-1.4.1 ?

Here is the testcase:
http://nic-nac-project.de/~andras/stitchTest.zip


regards,
Andras

anita May 6, 2008 01:57

Hallo Hrv, I can connect re
 
Hallo Hrv,

I can connect red with green or blue with yellow.
Using the switch nSquaredProjection to connect both don't change anything. It still does not work.

Anita

andras May 8, 2008 11:46

Hi all, I managed to solve th
 
Hi all,
I managed to solve the test case (posted above) at last...
Here is my stitchMesh recipe:

--
1. Import or generate a mesh
2. Use stitchMesh on one pair of congruent patches
3. Edit "startTime" in system/controlDict to point to the time directory containing your stitched mesh
4. Apply foamMeshToFluent to your case directory (the Fluent mesh is put in fluentInterface/)
5. Clear all meshes in constant and all time directories in your case directory
6. Import the exported Mesh with fluent3DMeshToFoam
7. Use stitchMesh on the next pair of congruent patches
8. Repeat steps 3-7 for every other stitchMesh action
--

Does anyone have a simpler solution?

regards,
Andras

lord_kossity May 13, 2008 11:00

Hi Andras, I just followed
 
Hi Andras,

I just followed the steps you listed, but they can't solve my problem.

Maybe first a little remark: Since fluent3DMeshToFoam always runs in a Segmentation fault, I'm using fluentMeshToFoam which works without any problem at least for the initial mesh import.

So, following your steps, I succeed until I reach point 6.
fluent3DMeshToFoam runs into a Segmentation fault as already witnessed.
The problem is that fluentMeshToFoam can't help me out of trouble this time either...

Applying fluentMeshToFoam the resulting error is the following one:

Dimension of grid: 3
Number of points: 2636330
Number of cells: 2468160
number of faces: 7571842
Reading points
Reading mixed faces

--> FOAM FATAL IO ERROR : wrong token type - expected int found on line 1 the word 'f'

file: IStringStream.sourceFile at line 1.

From function operator>>(Istream&, int&)
in file primitives/int/intIO.C at line 74.

FOAM exiting

What is actually happening there in detail and does anybody have a clue how to solve this problem?

I would appreciate that very much because stitchMesh already took a lot of my time...

andras May 14, 2008 04:10

Hi Andreas, Could you try run
 
Hi Andreas,
Could you try running fluent3DMeshToFoam on the small test case posted above?
By the way: did checkMesh (output of the latest time directory) complain about anything after stitching the patches?


Andras

lord_kossity May 14, 2008 04:42

Hi Andras, From your case I
 
Hi Andras,

From your case I created a Fluent mesh by foamMeshToFluent and tried to re-import it by using fluent3DMeshToFoam resulting in this error:

**********

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

Exec : fluent3DMeshToFoam . stitchTest stitchTest/fluentInterface/stitchTest.msh
Date : May 14 2008
Time : 10:38:47
Host :
PID : 22763
Root : /scratch/stitchTest
Case : stitchTest
Nprocs : 1
Create time

Dimension of grid: 3
Number of points: 6156
Number of cells: 4887
Number of faces: 15828
PointGroup: 1 start: 0 end: 6155. Reading points...done.
FaceGroup: 2 start: 0 end: 13493. Reading mixed faces...done.
FaceGroup: 10 start: 13494 end: 14618. Reading mixed faces...done.
FaceGroup: 11 start: 14619 end: 14938. Reading mixed faces...done.
FaceGroup: 12 start: 14939 end: 15338. Reading mixed faces...done.
FaceGroup: 13 start: 15339 end: 15563. Reading mixed faces...done.
FaceGroup: 14 start: 15564 end: 15663. Reading mixed faces...done.
FaceGroup: 15 start: 15664 end: 15763. Reading mixed faces...done.
FaceGroup: 16 start: 15764 end: 15827. Reading mixed faces...done.
CellGroup: 1 start: 0 end: 4886 type: 1
Zone: 1 name: fluid-1 type: fluid. Reading zone data...done.
Zone: 2 name: interior-1 type: interior. Reading zone data...done.
Zone: 10 name: wall:010 type: wall. Reading zone data...done.
Zone: 11 name: wall:001 type: wall. Reading zone data...done.
Zone: 12 name: wall type: wall. Reading zone data...done.
Zone: 13 name: if_b1 type: wall. Reading zone data...done.
Zone: 14 name: if_b0 type: wall. Reading zone data...done.
Zone: 15 name: if_a1 type: wall. Reading zone data...done.
Zone: 16 name: if_a0 type: wall. Reading zone data...done.

FINISHED LEXING

--> FOAM Warning :
From function boundBox::boundBox(const pointField& points)
in file meshes/boundBox/boundBox.C at line 52
cannot find bounding box for zero sized pointFieldreturning zero
Creating patch 0 for zone: 10 name: wall:010 type: wall
Creating patch 1 for zone: 11 name: wall:001 type: wall
Creating patch 2 for zone: 12 name: wall type: wall
Creating patch 3 for zone: 13 name: if_b1 type: wall
Creating patch 4 for zone: 14 name: if_b0 type: wall
Creating patch 5 for zone: 15 name: if_a1 type: wall
Creating patch 6 for zone: 16 name: if_a0 type: wall
Creating cellZone 0 name: fluid-1 type: fluid
patch 0 from Fluent indices: 13494 to: 14618 type: wall
patch 1 from Fluent indices: 14619 to: 14938 type: wall
patch 2 from Fluent indices: 14939 to: 15338 type: wall
patch 3 from Fluent indices: 15339 to: 15563 type: wall
patch 4 from Fluent indices: 15564 to: 15663 type: wall
patch 5 from Fluent indices: 15664 to: 15763 type: wall
patch 6 from Fluent indices: 15764 to: 15827 type: wall
Segmentation fault

**********

So it seems there's something running quite wrong... any hints?

andras May 14, 2008 07:13

Andreas, You are running Open
 
Andreas,
You are running OpenFOAM "Version: 1.4.1-dev". I am using 1.4.1 "vanilla" and haven't had any segmentation faults in the mesh converters until now. You could try reverting to 1.4.1 and try my recipe again...

Maybe you can do multiple stitches without using the mesh converters at all, but I don't know how.

Andras

lord_kossity May 14, 2008 07:42

Hi Andras, I thought this t
 
Hi Andras,

I thought this thread is all about using stitchMesh in the 1.4.1-dev version...

I'll try it your way again with 1.4.1 and will report the result to you.

Thanks,
Andreas


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