CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (http://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   OpenFoam Flow over a Circular Cylinder (http://www.cfd-online.com/Forums/openfoam-meshing/81918-openfoam-flow-over-circular-cylinder.html)

 WolfgangS. November 10, 2010 10:18

OpenFoam Flow over a Circular Cylinder

hi guys!

I am doing my first steps to openfoam :eek:.. and i need yours help! :o

I like to simulate a laminar and turbulent flow over a circular cylinder (RANS k-w-Modell, LES). Later i want to simulate the magnus (flow over a rotating circlar cylinder) and inverse magnus effect (maby you know it from sports) for a studyproject.

First i made a big block (will be meshed with blockMesh) in OpenFoam and i want a smaler block, which will be meshed with sappyHexMesh. The cylinder will lie in smaler block.

So i started:

FoamFile
{ version 2.0; format ascii; class dictionary; object blockMeshDict;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(110 0 -200) //0 front circle
(77.781746 77.781746 -200) //1 45 Degrees
(0 110 -200) //2
(-77.781746 77.781746 -200) //3
(-110 0 -200) //4
(-77.781746 -77.781746 -200) //5
(0 -110 -200) //6
(77.781746 -77.781746 -200) //7
(110 0 200) //8 back circle
(77.781746 77.781746 200) //9
(0 110 200) //10
(-77.781746 77.781746 200) //11
(-110 0 200) //12
(-77.781746 -77.781746 200) //13
(0 -110 200) //14
(77.781746 -77.781746 200) //15
(-1100 -1100 -200) //16 front big block
(3300 -1100 -200) //17
(3300 1100 -200) //18
(-1100 1100 -200) //19
(-1100 -1100 200) //20 back big block
(3300 -1100 200) //21
(3300 1100 200) //22
(-1100 1100 200) //23
);

blocks
(
hex (16 17 18 19 20 21 22 23) (1 1 1) simpleGrading (1 1 1)
);

edges
(
arc 0 1 (95.262794 55 -200) //front circle
arc 1 2 (55 95.262794 -200) //30 and 60 Degrees ( cos() and sin() )
arc 2 3 (-55 95.262794 -200)
arc 3 4 (-95.262794 55 -200)
arc 4 5 (-95.262794 -55 -200)
arc 5 6 (-55 -95.262794 -200)
arc 6 7 (55 -95.262794 -200)
arc 7 0 (95.262794 -55 -200)
arc 0 1 (95.262794 55 -200) //back circle
arc 1 2 (55 95.262794 -200)
arc 2 3 (-55 95.262794 -200)
arc 3 4 (-95.262794 55 -200)
arc 4 5 (-95.262794 -55 -200)
arc 5 6 (-55 -95.262794 -200)
arc 6 7 (55 -95.262794 -200)
arc 7 0 (95.262794 -55 -200)
);

patches
(
patch outlet
(
(18 22 21 17)
)
patch inlet
(
(16 20 23 19)
)
patch fixedWalls
(
(19 23 22 18)
(17 21 20 16)
)
patch frontAndBack
(
(16 19 18 17)
(20 21 22 23)
)
patch hole // I think it must be here, where is something wrong
(
(2 1 9 10)
(1 0 8 9)
(0 7 15 8)
(7 6 14 15)
(6 5 13 14)
(5 4 12 13)
(4 3 11 12)
(3 2 10 11)
)
);

mergePatchPairs
(
);

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

:confused:Unfortunately it doesn´t work :confused:. I always get this information:

Default patch type set to emptyface 0 in patch 4 does not have neighbour cell face: 4(2 1 9 10)#0 Foam::error::printStack(Foam::Ostream&) in "/opt/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"#1 Foam::error::abort() in "/opt/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"#2 Foam::Ostream& Foam::operator<< <Foam::error>(Foam::Ostream&, Foam::errorManip<Foam::error>) in "/opt/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"#3 Foam::polyMesh::facePatchFaceCells(Foam::List<Foam ::face> const&, Foam::List<Foam::List<int> > const&, Foam::List<Foam::List<Foam::face> > const&, int) const in "/opt/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"#4 Foam::polyMesh::polyMesh(Foam::IOobject const&, Foam::Xfer<Foam::Field<Foam::Vector<double> > > const&, Foam::List<Foam::cellShape> const&, Foam::List<Foam::List<Foam::face> > const&, Foam::List<Foam::word> const&, Foam::List<Foam::word> const&, Foam::word const&, Foam::word const&, Foam::List<Foam::word> const&, bool) in "/opt/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"#5 Foam::blockMesh::createTopology(Foam::IOdictionary &) in "/opt/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"#6 Foam::blockMesh::blockMesh(Foam::IOdictionary&) in "/opt/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"#7 main in "/opt/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/blockMesh"#8 __libc_start_main in "/lib64/libc.so.6"#9 _start at /usr/src/packages/BUILD/glibc-2.9/csu/../sysdeps/x86_64/elf/start.S:116 From function polyMesh::facePatchFaceCells(const faceList& patchFaces,const labelListList& pointCells,const faceListList& cellsFaceShapes,const label patchID) in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 125.FOAM aborting
What´s wrong ? I do not realy understand where the problem is? I think it must be in the "patch hole".

!!!!!!!!!! I have a further question: !!!!!!!!!!!!!

Maby this Mesh i have created will run, how could i rotate the cylinder? or will i need there a flow around the cylinder, which will simulate the rotation?
Would it be better to simulate a flow over a CAD created cylinder (.stl) ????

maby there is somebody with experience with cylinders! ;)

Thank you in anticipation!!

Wolfgang

 l_r_mcglashan November 10, 2010 10:35

Before you start, may I point you towards Frank Bos's work here:

http://www.aero.lr.tudelft.nl/~frank...search/cfd/cfd

You can download his code which probably has meshes within it you can use and manipulate.

 WolfgangS. November 11, 2010 13:34

hi l_r_mcglashan!

Thank you for your quick reply. I hope this side will help me.

The download-files are unfortunately made with OpenFoam 1.3, the code-structure (especially the Mesh-code) is completely different to OpenFoam 1.6.

 niklas November 12, 2010 05:53

I think this setup should fit you pretty well
http://openfoamwiki.net/index.php/Be...coftac_ufr2-02

The only thing you need to add are the arc's for the cylinder.

EDIT: actually, I think you only need to modify the perl-script and remove the comments for the edges.

 WolfgangS. November 16, 2010 09:29

hi niklas!

the mesh works good.

Now i only need a capability to rotate the cyinder (patch: wall).
Where can i find a good way to do that?
(is the "swirlAndRotation" a good option to do that??)

Regards
Wolfgang

 chris Liu December 1, 2010 05:54

problem with the perl script for circular cylinder

HI, niklas. M and wolfgang. S

I want to simulate the flow around circular cylinder.
As niklas said, i modify the perl-script
and remove the comments for the arc's edges.
However when i run blockMesh with default parameters,
there were floating number exception when Creating curved edges:

#0 Foam::error::printStack(Foam::Ostream&) in "/home/lhx/OpenFOAM/OpenFOAM-1.7.1/lib/linuxGccDPOpt/libOpenFOAM.so"
...

Could you give me a clue how to solve this problem,
and generate the mesh of circular cylinder?
Thank you very much!

 WolfgangS. December 1, 2010 06:26

hi chris lui!

The arcs problem of http://openfoamwiki.net/index.php/Be...coftac_ufr2-02 is:

example:

edges
(

arc 5 6 ( 0 0.02 0 )

);

definition of 5 = ( -0.02 0.02 0 )
definition of 6 = ( 0.02 0.02 0 )

The points (0 0.02 0) , 5 and 6 lie on a line, and not a arc.
You have to create a new point instead of (0 0.02 0) use (0.02828 0).

For
http://openfoamwiki.net/index.php/Be...coftac_ufr2-02
set new edges:

edges
(

arc 5 6 ( 0 0.02828 0 )
arc 6 10 ( 0.02828 0 0 )
arc 9 10 ( 0 -0.02828 0 )
arc 9 5 ( -0.02828 0 0 )
arc 21 22 ( 0 0.02828 0.392 )
arc 26 22 ( 0.02828 0 0.392 )
arc 25 26 ( 0 -0.02828 0.392 )
arc 25 21 ( -0.02828 0 0.392 )

);

Now it should work :)

Best Regards and good luck

Wolfgang

 chris Liu December 1, 2010 21:41

Hi wolfgang!

Yes, indeed. That helps me understand the blockMeshDict better.
Thank you for your detailed explanation.

Best regards!:)

 WolfgangS. December 2, 2010 12:47

no prob!

Have fun

wolfi

 Goutam March 5, 2012 11:24

Quote:
 Originally Posted by WolfgangS. (Post 285545) hi chris lui! edges ( arc 5 6 ( 0 0.02 0 ) ); definition of 5 = ( -0.02 0.02 0 ) definition of 6 = ( 0.02 0.02 0 ) The points (0 0.02 0) , 5 and 6 lie on a line, and not a arc. You have to create a new point instead of (0 0.02 0) use (0.02828 0). edges ( arc 5 6 ( 0 0.02828 0 ) arc 6 10 ( 0.02828 0 0 ) arc 9 10 ( 0 -0.02828 0 ) arc 9 5 ( -0.02828 0 0 ) arc 21 22 ( 0 0.02828 0.392 ) arc 26 22 ( 0.02828 0 0.392 ) arc 25 26 ( 0 -0.02828 0.392 ) arc 25 21 ( -0.02828 0 0.392 ) ); Wolfgang

Could you please explain how you get the coordinates (0 0.02828 0) and (0 0.02828 0.392)???

 vishalsacharya March 7, 2012 02:25

Goutam,

If you look in tutorials for potentialFoam, the circular cylinder is an example. the blockmesh file and the case are already setup. you can just start with that.
Also, for the rotating cylinder, you can use a velocity non-zero BC on the cylinder boundary patch. this can be easily done using some inbuilt features in OF.

~vishal

 yasmil January 12, 2013 18:00

using icoFoam

3 Attachment(s)
Hello,

I'm also trying to build a case for the flow around a circular cylinder problem. I've read the OpenFOAM tutorial on it and I 've also taken a look here http://openfoamwiki.net/index.php/Be...coftac_ufr2-02

Currently my boundary conditions are almost the same as the OpenFOAM tutorial (I added walls perpendicular to the cylinder), if I erase them it does not converge either. But I've also tried those in the above link, and it does not converge

I was wondering if this was a mesh problem, since I created the mesh in salome and exported it to openfoam.

this is the error that I get ;

#0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigFpe::sigHandler(int) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#2 Uninterpreted:
#3 Foam::PBiCG::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#4
in "/opt/openfoam211/platforms/linuxGccDPOpt/bin/icoFoam"
#5
in "/opt/openfoam211/platforms/linuxGccDPOpt/bin/icoFoam"
#6
in "/opt/openfoam211/platforms/linuxGccDPOpt/bin/icoFoam"
#7 __libc_start_main in "/lib/i386-linux-gnu/libc.so.6"
#8
in "/opt/openfoam211/platforms/linuxGccDPOpt/bin/icoFoam"
Floating point exception (core dumped)

Could someone please take a look at the case, and make some suggestions?

Attachment 18120

Attachment 18121

Attachment 18122

 Maimouna March 3, 2014 11:53

Flow past a circular cylinder

2 Attachment(s)
Dear All OpenFOAM users,

I'm try to implement flow past circular cylinder in pimpleFoam solver. I attached the case that I'm looking for (pdf file). I blocked and checked mesh everything was fine. I run the case without any problem. But, when I plotted drag and lift forces (using Matlab), it gave me inconvenience result. I don't know where is my mistake.

Anyway, I attached my case if you could please go through all files and checked please what are my mistakes.

NT: D = 1, Re = 100. I'm trying to fix nu in transportProperties file and change u in the attached file because I didn't know where are my errors so I'm trying to do different ways. Also, might blockMeshDict affects my results if you could check please.