CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM

How to handle internal patches for p,T,U

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By tomislav_maric

Reply
 
LinkBack Thread Tools Display Modes
Old   October 6, 2011, 00:37
Default How to handle internal patches for p,T,U
  #1
New Member
 
AP
Join Date: Sep 2011
Posts: 5
Rep Power: 5
monsoon is on a distinguished road
I have two cylinders connected to each other. Mesh generated in netgen. After netgenNeutralToFoam, it creates two internal patches where these two cylinders interface with each other. If I assign the same bc to these internal faces in netgen, then one of these patches is eliminated but the other one shows up with double the number of faces. How do you handle the boundaryField p,T,U for the internal patch. I just want the fluid to pass through. Removing the patch from PloyMesh/boundary does not work. Can someone help.

my boundary file looks like this

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

6
(
patch0
{
type patch;
physicalType patch;
nFaces 0;
startFace 5532;
}
patch_wall1
{
type wall;
physicalType patch;
nFaces 1092;
startFace 5532;
}
patch2
{
type patch;
physicalType patch;
nFaces 54;
startFace 6624;
}
patch_out
{
type patch;
physicalType patch;
nFaces 27;
startFace 6678;
}
patch_wall2
{
type wall;
physicalType patch;
nFaces 1096;
startFace 6705;
}
patch_in
{
type patch;
physicalType patch;
nFaces 27;
startFace 7801;
}
)
monsoon is offline   Reply With Quote

Old   October 6, 2011, 02:39
Default
  #2
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Hi,

I'm not sure if there is any possibility of handling internal faces as transient ones. But you could have a look at mergeMeshes and stitchMesh which enables you to completely 'delete' internal faces for merged meshes. This could save you from a lot of trouble and has always worked for me.

Regards,
Arne
Arnoldinho is offline   Reply With Quote

Old   October 6, 2011, 03:58
Default
  #3
Senior Member
 
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 251
Blog Entries: 5
Rep Power: 10
tomislav_maric is on a distinguished road
Hi,

patches are usually used in OF if you need some special operation done on a set of faces (always a kind of BC), if you want the flow to just flow through, there will be no boundary condition for any internal face. The internal faces are used (together with the corresponding volume centres: owner-neighbour) to assemble the coefficient matrix of the system.

This kind of thing used to happen to me as well when I used Salome-CAD to generate meshes, but there was an option to invert the face normals, and during the creation of the so called component mesh in Salome, there was an option to merge patches. Try mergeMeshes utility, or check if there is a similar option in Netgen.

Tomislav
tomislav_maric is offline   Reply With Quote

Old   October 6, 2011, 22:00
Default
  #4
New Member
 
AP
Join Date: Sep 2011
Posts: 5
Rep Power: 5
monsoon is on a distinguished road
Thanks for your replies. Following your recommendations I did manage to run mergeMeshes and the boundary file was created in the next time step(in my case 0.0005). My question is how do I use stitchMesh now. I have two boundary files in my case folder now. one is the original one TwoCyl/contant/polyMesh/boundary and the second one is TwoCly/0.0005/polyMesh/boundary (this one has the merged patches). I still have the interface patches I need to get rid of.
monsoon is offline   Reply With Quote

Old   October 7, 2011, 04:57
Default
  #5
Senior Member
 
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 251
Blog Entries: 5
Rep Power: 10
tomislav_maric is on a distinguished road
Quote:
Originally Posted by monsoon View Post
Thanks for your replies. Following your recommendations I did manage to run mergeMeshes and the boundary file was created in the next time step(in my case 0.0005). My question is how do I use stitchMesh now. I have two boundary files in my case folder now. one is the original one TwoCyl/contant/polyMesh/boundary and the second one is TwoCly/0.0005/polyMesh/boundary (this one has the merged patches). I still have the interface patches I need to get rid of.
I've made two cases: cavity and cavityAppend.

This is what you can do to see how the stitchPatches works (unpack the cases in the same directory, I have set two patches of the two faces called stitch1 and stitch2 that should be stitched together to form internal set of faces, check out the blockMeshDict files):

Code:
cd cavity
blockMesh
cd ../cavityAppend
blockMesh
cd ../cavity
mergeMeshes . . ../cavityAppend ../cavityAppend
cp -r 0.005/polyMesh constant/
If you have pyFoam:

Code:
pyFoamCreateBoundaryPatches.py --clear -unused 0/p
pyFoamCreateBoundaryPatches.py --clear -unused 0/U
If you don't have pyFoam, you need to add the BCs (stitch1 and stitch2) for the fields p and U (and for your case, all the other fields that are variables in the governing equation system).

After you have added the BCs (still inside the cavity directory),

Code:
stitchMesh stitch1 stitch2 -perfect -overwrite -case .
Examine the mesh in paraFoam: the stitched patches are converted to zones, and the actual patch sizes are set to "0".

To confirm that the case is properly set up and the mesh has no internal walls or what not:
Code:
icoFoam
There you go. Two stitched patches.

Hope this helps,

Tomislav
Attached Files
File Type: zip cavity.zip (8.7 KB, 109 views)
File Type: zip cavityAppend.zip (4.5 KB, 92 views)
abelee likes this.
tomislav_maric is offline   Reply With Quote

Old   October 9, 2011, 00:36
Default
  #6
New Member
 
AP
Join Date: Sep 2011
Posts: 5
Rep Power: 5
monsoon is on a distinguished road
Thank you Tomislav and Arne. I finally got it working.
Aru
monsoon is offline   Reply With Quote

Old   December 5, 2011, 18:14
Default naming patches
  #7
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 277
Rep Power: 8
musahossein is on a distinguished road
Dear all:
I have a 2D rectangular tank. I need to label the left wall as leftwall and the right wall as rightwall. How can I name the patches accordingly?
musahossein is offline   Reply With Quote

Old   December 6, 2011, 11:58
Default Naming Patches in OpenFOAM
  #8
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 277
Rep Power: 8
musahossein is on a distinguished road
Dear all:
I am modeling a rectangular tank and my blockMeshDict file looks like as follows:
vertices
(
(-0.5 -20 -10.0) // Vertex back lower left corner = 0
(-0.5 20 -10.0) // Vertex back lower right corner= 1
(-0.5 20 10.0) // Vertex back upper right corner= 2
(-0.5 -20 10.0) // Vertex back upper left corner = 3

(0.5 -20 -10.0) // Vertex front lower left corner = 4
(0.5 20 -10.0) // Vertex front lower right corner= 5
(0.5 20 10.0) // Vertex front upper right corner = 6
(0.5 -20 10.0) // Vertex front upper left corner =7

);

blocks
(
// block0
hex (0 1 2 3 4 5 6 7)
(40 40 1)
simpleGrading (1 1 1)
);

//patches
boundary
(
lowerWall
{
type patch;
faces
(
(0 1 5 4)
);
}
rightWall
{
type patch;
faces
(
(1 2 6 5)
);
}
atmosphere
{
type patch;
faces
(
(2 3 7 6)
);
}
leftWall
{
type patch;
faces
(
(0 4 7 3)
);
}
frontAndBack
{
type Empty;
faces
(
(4 5 6 7)
(0 3 2 1)
);
}
);
when I run blockmesh it seems to run ok per output from openfoam:

musa@musa-Satellite-M35X:~/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D$ blockMesh
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.0.1-51f1de99a4bc
Exec : blockMesh
Date : Dec 06 2011
Time : 10:45:44
Host : musa-Satellite-M35X
PID : 3021
Case : /home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

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

Creating block mesh from
"/home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/constant/polyMesh/blockMeshDict"
No non-linear edges defined
Creating topology blocks
Creating topology patches

Creating block mesh topology

Check topology

Basic statistics
Number of internal faces : 0
Number of boundary faces : 6
Number of defined boundary faces : 6
Number of undefined boundary faces : 0
Checking patch -> block consistency

Creating block offsets
Creating merge list .

Creating polyMesh from blockMesh
Creating patches
Creating cells
Creating points with scale 1

There are no merge patch pairs edges

Writing polyMesh
----------------
Mesh Information
----------------
boundingBox: (-0.5 -20 -10) (0.5 20 10)
nPoints: 3362
nCells: 1600
nFaces: 6480
nInternalFaces: 3120
----------------
Patches
----------------
patch 0 (start: 3120 size: 40) name: lowerWall
patch 1 (start: 3160 size: 40) name: rightWall
patch 2 (start: 3200 size: 40) name: atmosphere
patch 3 (start: 3240 size: 40) name: leftWall
patch 4 (start: 3280 size: 3200) name: frontAndBack

End

but when I try to view it in paraFoam, the viewer opens up, but soon closes and gives the following error message:

musa@musa-Satellite-M35X:~/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D$ paraFoam
created temporary 'sloshingTank2D.OpenFOAM'


--> FOAM FATAL IO ERROR:
keyword lowerWall is undefined in dictionary "/home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/0/U::boundaryField"

file: /home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/0/U::boundaryField from line 25 to line 26.

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

FOAM exiting

Sorry for the long post. But is the error in the blockMeshDict file or some where else?
musahossein is offline   Reply With Quote

Old   December 6, 2011, 12:04
Default
  #9
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
The error is what it says: "keyword lowerWall is undefined in dictionary "/home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/0/U::boundaryField"

It means that you did not define "lowerWall" in your U file under boundaryField.

Arne
Arnoldinho is offline   Reply With Quote

Old   December 6, 2011, 12:22
Default
  #10
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 277
Rep Power: 8
musahossein is on a distinguished road
Quote:
Originally Posted by Arnoldinho View Post
The error is what it says: "keyword lowerWall is undefined in dictionary "/home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/0/U::boundaryField"

It means that you did not define "lowerWall" in your U file under boundaryField.

Arne
Thanks for your response. When I look at the U file it has the following contents:
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
walls
{
type movingWallVelocity;
value uniform (0 0 0);
}
}

where would I define it? and would I need to define the other patches too? can you direct me to where this is discussed in the OpenFoam user guide -- if it is?
musahossein is offline   Reply With Quote

Old   December 6, 2011, 12:30
Default
  #11
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 8
Arnoldinho is on a distinguished road
Yup. So "lowerWall" is missing. You have to define every patch (which can be found in constant/polyMesh/boundary) in your "files" in 0 folder.

Regarding the User guide, just have a look at chapter 2.1.1.2 "Boundary and initial conditions". It might be worth working with these tutorials first...

Arne
Arnoldinho is offline   Reply With Quote

Old   December 6, 2011, 13:22
Default
  #12
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 277
Rep Power: 8
musahossein is on a distinguished road
Agreed! Thanks for the reference. One question though. Where would I find explanation of key words such as buoyantPressure in OpenFOAM.
musahossein is offline   Reply With Quote

Old   December 6, 2011, 13:44
Default
  #13
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 277
Rep Power: 8
musahossein is on a distinguished road
Quote:
Originally Posted by Arnoldinho View Post
Yup. So "lowerWall" is missing. You have to define every patch (which can be found in constant/polyMesh/boundary) in your "files" in 0 folder.

Regarding the User guide, just have a look at chapter 2.1.1.2 "Boundary and initial conditions". It might be worth working with these tutorials first...

Arne
I revised the U file to include the various patches:
dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
lowerWall
{
type movingWallVelocity;
value uniform (0 0 0);
}
rightWall
{
type movingWallVelocity;
value uniform (0 0 0);
}
atmosphere
{
type movingWallVelocity;
value uniform (0 0 0);
}
leftWall
{
type movingWallVelocity;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}

Since this is a 2D case, the front and back walls have been defined as empty in the blockmeshdict file. However, paraFoam does not like it:
musa@musa-Satellite-M35X:~/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D$ paraFoam
created temporary 'sloshingTank2D.OpenFOAM'


--> FOAM FATAL IO ERROR:

patch type 'genericPatch' not constraint type 'empty'
for patch frontAndBack of field U in file "/home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/0/U"

file: /home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/0/U::boundaryField::frontAndBack from line 45 to line 45.

From function emptyFvPatchField<Type>::emptyFvPatchField
(
const fvPatch& p,
const Field<Type>& field,
const dictionary& dict
)

in file fields/fvPatchFields/constraint/empty/emptyFvPatchField.C at line 100.

FOAM exiting

Any suggestions? Also, I am not sure about the "atmosphere". Is this a moving wall (in the sense it moves with the tank) since it has to move with the tank? I noted that in the sloshingTank2D examples, all patches were defined as moving wall in the U folder.
musahossein is offline   Reply With Quote

Old   July 23, 2012, 07:55
Default stitching 2 volumes
  #14
New Member
 
Join Date: Jul 2012
Posts: 4
Rep Power: 4
amirr is on a distinguished road
Hi this really helps understanding the stitching procedure. but i have a situation where i have to combine one rectangle into another ( one small volume into a bigger volume). mergeMesh works well but after running a simple flow i realize that the meshes are not combine at all. any suggestion ? thanks in advance

Quote:
Originally Posted by tomislav_maric View Post
I've made two cases: cavity and cavityAppend.

This is what you can do to see how the stitchPatches works (unpack the cases in the same directory, I have set two patches of the two faces called stitch1 and stitch2 that should be stitched together to form internal set of faces, check out the blockMeshDict files):

Code:
cd cavity
blockMesh
cd ../cavityAppend
blockMesh
cd ../cavity
mergeMeshes . . ../cavityAppend ../cavityAppend
cp -r 0.005/polyMesh constant/
If you have pyFoam:

Code:
pyFoamCreateBoundaryPatches.py --clear -unused 0/p
pyFoamCreateBoundaryPatches.py --clear -unused 0/U
If you don't have pyFoam, you need to add the BCs (stitch1 and stitch2) for the fields p and U (and for your case, all the other fields that are variables in the governing equation system).

After you have added the BCs (still inside the cavity directory),

Code:
stitchMesh stitch1 stitch2 -perfect -overwrite -case .
Examine the mesh in paraFoam: the stitched patches are converted to zones, and the actual patch sizes are set to "0".

To confirm that the case is properly set up and the mesh has no internal walls or what not:
Code:
icoFoam
There you go. Two stitched patches.

Hope this helps,

Tomislav
amirr is offline   Reply With Quote

Old   August 17, 2012, 06:59
Default
  #15
Senior Member
 
Mojtaba.a's Avatar
 
Mojtaba Amiraslanpour
Join Date: Jun 2011
Location: Zanjan, Iran
Posts: 219
Rep Power: 6
Mojtaba.a is on a distinguished road
Send a message via Yahoo to Mojtaba.a
Quote:
Originally Posted by tomislav_maric View Post
I've made two cases: cavity and cavityAppend.

This is what you can do to see how the stitchPatches works (unpack the cases in the same directory, I have set two patches of the two faces called stitch1 and stitch2 that should be stitched together to form internal set of faces, check out the blockMeshDict files):

Code:
cd cavity
blockMesh
cd ../cavityAppend
blockMesh
cd ../cavity
mergeMeshes . . ../cavityAppend ../cavityAppend
cp -r 0.005/polyMesh constant/
If you have pyFoam:

Code:
pyFoamCreateBoundaryPatches.py --clear -unused 0/p
pyFoamCreateBoundaryPatches.py --clear -unused 0/U
If you don't have pyFoam, you need to add the BCs (stitch1 and stitch2) for the fields p and U (and for your case, all the other fields that are variables in the governing equation system).

After you have added the BCs (still inside the cavity directory),

Code:
stitchMesh stitch1 stitch2 -perfect -overwrite -case .
Examine the mesh in paraFoam: the stitched patches are converted to zones, and the actual patch sizes are set to "0".

To confirm that the case is properly set up and the mesh has no internal walls or what not:
Code:
icoFoam
There you go. Two stitched patches.

Hope this helps,

Tomislav
Hi Tomislav, Thanks for your help.
I now understand how to stitch to faces, but the new problem in openFOAM is that it can't stitch multiple faces which are connected to each other. It means that as soon as I stitch to faces, the neighbor faces which are both interfaces can not be stitched. Someone reported it as a bug to openFOAM but no solution have been suggested. until now I haven't found any solution for this problem. There are lots of threads about stitchMesh but unfortunately they haven't reached to any solution. There is is just a little procedure in this post:

but I really couldn't understand it well. Do u have any idea how we can handle this?

Quote:
Originally Posted by amirr View Post
Hi this really helps understanding the stitching procedure. but i have a situation where i have to combine one rectangle into another ( one small volume into a bigger volume). mergeMesh works well but after running a simple flow i realize that the meshes are not combine at all. any suggestion ? thanks in advance
Hi amir,
Have you found any solution for this? I have the same problem.

Regards~
Mojtaba
Mojtaba.a is offline   Reply With Quote

Old   October 4, 2012, 10:04
Default stitchMesh
  #16
Senior Member
 
stephane sanchi
Join Date: Mar 2009
Posts: 299
Rep Power: 8
openfoam_user is on a distinguished road
Dear Tomislav,

I am struggling with the 'stitchMesh' command to get rid of the interface between 2 meshes. The grids have done with ICEM Hexa.

Tomislav, I have redone your testcase. It works. But you have the same point density on the 2 faces (stitch1 and stitch2).
If the point density is different does it still work ?

They are a lot a comments about it in the forum, but no final answer on how to solve it. Need help.

Regards,
Stephane.
openfoam_user is offline   Reply With Quote

Old   March 22, 2013, 17:00
Default how to create internal patch
  #17
Member
 
Jamal
Join Date: May 2012
Location: Freiburg
Posts: 54
Rep Power: 3
aujamal20 is an unknown quantity at this point
Dear
I am having a case of fluid passing through a cylinder. Fluid is entering from inlet patch and leaving the cylinder through outlet patch. There is a small tube having central axis coinciding the cylinder axis.
Now you can imagine as the fluid enters the cylinder and runs parallel to central axis a portion of fluid also passes through the tube. And I am interested to know the mass flow rate and T of fluid through that tube.
What I am trying to do is using topoSet to define a faceZone and using createBaffles utility to make a patch. I can create patch but the problems occur as that patch also appears as boundray patch and i fail to get required things.
Please let me know how I can fix this problem by defining internal patch and using that internal patch name in functionObjects which are defined in control dict to calculate mass flow through patch.


Thanks
Jamal

Last edited by aujamal20; March 22, 2013 at 20:26.
aujamal20 is offline   Reply With Quote

Reply

Tags
boundaryfield, internal patch, remove patch

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove internal patch(es) SD@TUB OpenFOAM Meshing & Mesh Conversion 15 May 17, 2012 16:01
Internal patches openFoam Aerospace OpenFOAM 1 November 6, 2010 07:30
Internal Patches : Which boundary conditions? Gearb0x OpenFOAM Running, Solving & CFD 4 April 21, 2010 15:26
Internal patches with fluentMeshToFoam sega OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 12 October 29, 2009 10:11
internal faces between patches created with snappyHexMesh romant OpenFOAM Mesh Utilities 0 August 17, 2009 09:40


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