CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Cylinder tutorial

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 29, 2008, 13:10
Default I was trying to do the cylinde
  #1
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 17
robbo is on a distinguished road
I was trying to do the cylinder tutorial explained in the programmer's guide.
Once i've finished to do it I've started to wonder how to make the cylinder rotate.
What boundary condition I've to give to the cylinder instead of symmetry? It should be Wall? and if is this the right way how i can specify the angular speed of the cylinder? I've to specify a non uniform speed (point to point in cartesian coordinates) for all the points of the cylinder's surface?

thanks in advance for the help

Robbo
robbo is offline   Reply With Quote

Old   April 29, 2008, 14:13
Default Hi Roberto You need to prog
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Roberto

You need to program a new boundary condition (at least that is what I think). The programming is rather simple, and I have something at another computer, which might help you. The short story is, that you know the point on the surface, x_S, and the center of the cylinder, x_0. Then specify

v = x_S - x_0.

Say that the angular frequency is omega, then the boundary condition for the velocity for the cylinder surface in any given point is given as (assume 2D)

U = - omega * vector(-v_2,v_1,0)

where v_1 and v_2 are the first and second component of v. Assumed that the cylinder rotates clockwise, if anti-clockwise just remove the minus in front.

Have fun, and if you need my source, just send me an email.

- Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 11, 2010, 01:52
Default Cylindrical boundary condition
  #3
New Member
 
Joseph
Join Date: Mar 2010
Posts: 14
Rep Power: 15
tamsilian is an unknown quantity at this point
Hi
Could you send me your code about cylindrical boundary condition?
TANX
Joseph
tamsilian is offline   Reply With Quote

Old   May 11, 2010, 02:58
Default Hi
  #4
ata
Senior Member
 
ata's Avatar
 
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 323
Rep Power: 17
ata is on a distinguished road
Hi
I think that in that file which I have send for you, is a link to cylindrical B.C.
Best regards
ata is offline   Reply With Quote

Old   June 1, 2018, 09:41
Default mapping a cylinder in OpenFoam
  #5
Member
 
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 8
Ben UWIHANGANYE is on a distinguished road
Quote:
Originally Posted by ngj View Post
Hi Roberto

You need to program a new boundary condition (at least that is what I think). The programming is rather simple, and I have something at another computer, which might help you. The short story is, that you know the point on the surface, x_S, and the center of the cylinder, x_0. Then specify

v = x_S - x_0.

Say that the angular frequency is omega, then the boundary condition for the velocity for the cylinder surface in any given point is given as (assume 2D)

U = - omega * vector(-v_2,v_1,0)

where v_1 and v_2 are the first and second component of v. Assumed that the cylinder rotates clockwise, if anti-clockwise just remove the minus in front.

Have fun, and if you need my source, just send me an email.

- Niels





Hello Niels,


I want to map a cylinder in OpenFoam with the following boundary conditions:


n(x,y,t)={n=1, when (x-xt)^2 -(y-yt)^2 <= R^2

n=0, when (x-xt)^2 -(y-yt)^2 > R^2 }


where: x,y are the Cartesian coordinate of the computational cell center
and xt, yt are the center of the cylinder at time t. R is the radius of the cylinder.

It means that the cylinder will be oscillating as n alternate from 0 to 1.
I am using OF 4.1.


May you advise how i can do that ?


I would appreciate!
Ben UWIHANGANYE is offline   Reply With Quote

Old   June 7, 2018, 05:24
Default
  #6
Member
 
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 8
Ben UWIHANGANYE is on a distinguished road
Quote:
Originally Posted by ngj View Post
Hi Roberto

You need to program a new boundary condition (at least that is what I think). The programming is rather simple, and I have something at another computer, which might help you. The short story is, that you know the point on the surface, x_S, and the center of the cylinder, x_0. Then specify

v = x_S - x_0.

Say that the angular frequency is omega, then the boundary condition for the velocity for the cylinder surface in any given point is given as (assume 2D)

U = - omega * vector(-v_2,v_1,0)

where v_1 and v_2 are the first and second component of v. Assumed that the cylinder rotates clockwise, if anti-clockwise just remove the minus in front.

Have fun, and if you need my source, just send me an email.

- Niels



Hello Niels,


May you help to know where this program should be written?


Indeed I want to map a cylinder on a Cartesian grid and move it with a simple program.
I have been advised to learn about vector form programming in Open Foam but i don't know where to start.


Thank you!
Ben UWIHANGANYE is offline   Reply With Quote

Old   May 1, 2008, 09:16
Default Hi Niels, I've tried to sen
  #7
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 17
robbo is on a distinguished road
Hi Niels,

I've tried to send you a mail but i'm not sure you have received it.
Could you send me please your code? i've understood what you said but I don't know exactly how to do it.

tia

Roberto
robbo is offline   Reply With Quote

Old   May 1, 2008, 13:38
Default Hi Roberto As you said in t
  #8
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Roberto

As you said in the email, you are not completely sure how to compile, so I will make a small walk-through:

First here is the boundary condition.



Unpack the archive and from the command-line you go into the directory and type:

wmake libso

This creates a dynamic library which is placed in the folder $FOAM_LIBBIN. The library is called librotatingCylinderFvPatchVectorField.so.

Then unpack the following



which is a small test case with to concentric circles, where the large one rotates with a given cyclic frequency. The frequency and the center of the rotating cylinder is given in case/0/U. The library is only for 2D-case in the xy-plane, as I have not extended the code. Notice that the linking of the new boundary condition to icoFoam happens through /case/system/controlDict, where the library is added at the bottom.

Hope it works, otherwise to not hesitate to ask.

/ Niels

BTW: The setup is actually how viscosity was measured, because the flow is a couette-type of flow for large radii and small gaps. Thus the velocity profile is known, and therefore by measuring the force acting on the still cylinder, the viscosity can be determined as the velocity of the 'lid' is known.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 1, 2008, 13:42
Default Hi Roberto As you said in t
  #9
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Roberto

As you said in the email, you are not completely sure how to compile, so I will make a small walk-through:

First here is the boundary condition.

rotatingCylinder.tar.gz

Unpack the archive and from the command-line you go into the directory and type:

wmake libso

This creates a dynamic library which is placed in the folder $FOAM_LIBBIN. The library is called librotatingCylinderFvPatchVectorField.so.

Then unpack the following

viscosityTest.tar.gz

which is a small test case with to concentric circles, where the large one rotates with a given cyclic frequency. The frequency and the center of the rotating cylinder is given in case/0/U. The library is only for 2D-case in the xy-plane, as I have not extended the code. Notice that the linking of the new boundary condition to icoFoam happens through /case/system/controlDict, where the library is added at the bottom.

Hope it works, otherwise to not hesitate to ask.

/ Niels

BTW: The setup is actually how viscosity was measured, because the flow is a couette-type of flow for large radii and small gaps. Thus the velocity profile is known, and therefore by measuring the force acting on the still cylinder, the viscosity can be determined as the velocity of the 'lid' is known.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   June 1, 2018, 11:20
Default
  #10
Member
 
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 8
Ben UWIHANGANYE is on a distinguished road
Quote:
Originally Posted by ngj View Post
Hi Roberto

As you said in the email, you are not completely sure how to compile, so I will make a small walk-through:

First here is the boundary condition.

rotatingCylinder.tar.gz

Unpack the archive and from the command-line you go into the directory and type:


This creates a dynamic library which is placed in the folder $FOAM_LIBBIN. The library is called librotatingCylinderFvPatchVectorField.so.

Then unpack the following

viscosityTest.tar.gz

which is a small test case with to concentric circles, where the large one rotates with a given cyclic frequency. The frequency and the center of the rotating cylinder is given in case/0/U. The library is only for 2D-case in the xy-plane, as I have not extended the code. Notice that the linking of the new boundary condition to icoFoam happens through /case/system/controlDict, where the library is added at the bottom.

Hope it works, otherwise to not hesitate to ask.

/ Niels

BTW: The setup is actually how viscosity was measured, because the flow is a couette-type of flow for large radii and small gaps. Thus the velocity profile is known, and therefore by measuring the force acting on the still cylinder, the viscosity can be determined as the velocity of the 'lid' is known.



wmake libso



Dear Niels,


I have tried to go through this exercises and when i run icoFoam got the following fatal error:


--> FOAM FATAL IO ERROR:
keyword pFinal is undefined in dictionary "/home/ben/OpenFOAM/ben-4.1/run/visicosity/system/fvSolution.solvers"

file: /home/ben/OpenFOAM/ben-4.1/run/visicosity/system/fvSolution.solvers from line 0 to line 38.

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

FOAM exiting


Can you help to correct that error?


I would appreciate your help



I would appreciate you support.!
Ben UWIHANGANYE is offline   Reply With Quote

Old   June 7, 2018, 07:07
Default
  #11
Member
 
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 8
Ben UWIHANGANYE is on a distinguished road
Quote:
Originally Posted by Ben UWIHANGANYE View Post
wmake libso



Dear Niels,


I have tried to go through this exercises and when i run icoFoam got the following fatal error:


--> FOAM FATAL IO ERROR:
keyword pFinal is undefined in dictionary "/home/ben/OpenFOAM/ben-4.1/run/visicosity/system/fvSolution.solvers"

file: /home/ben/OpenFOAM/ben-4.1/run/visicosity/system/fvSolution.solvers from line 0 to line 38.

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

FOAM exiting


Can you help to correct that error?


I would appreciate your help



I would appreciate you support.!



Solved.


Thank you!
Ben UWIHANGANYE is offline   Reply With Quote

Old   May 1, 2008, 17:18
Default When you want to rotate the cy
  #12
New Member
 
Mark Michael
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 5
Rep Power: 17
mark_michael is on a distinguished road
When you want to rotate the cylinder-patch ! Why didn't you take the "movingWallVelocity" - Boundary Condition in the U - file of your Time-step ??
mark_michael is offline   Reply With Quote

Old   May 2, 2008, 03:28
Default Hi I didn't know it existe
  #13
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi

I didn't know it existed. Thanks for the info

I have been looking at the source, and it deals with present and old face-centers, so using it wouldn't that require the use of a moving-mesh solver?

/ Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 2, 2008, 06:52
Default ok ! i didn't realised that yo
  #14
New Member
 
Mark Michael
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 5
Rep Power: 17
mark_michael is on a distinguished road
ok ! i didn't realised that you want to move the mesh ! i just thought that the boundary-condtion should implimeted U-tangential=const. and U*n=0 in the education !

Mark !
mark_michael is offline   Reply With Quote

Old   May 2, 2008, 07:34
Default Hihi, I think we are talking i
  #15
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hihi, I think we are talking in two different direction.
I am not interested in moving the mesh, but in movingWallVelocity there is call to both old and present face-locations, see below, thus isn't that the same as stating that the mesh most be moving to use the patch?

Best regards,
Niels

==========================================

void movingWallVelocityFvPatchVectorField::updateCoeffs ()
{
if (updated())
{
return;
}

const fvPatch& p = patch();
const polyPatch& pp = p.patch();
const fvMesh& mesh = dimensionedInternalField().mesh();


const pointField& oldAllPoints = mesh.oldAllPoints();

vectorField oldFc(pp.size());

forAll(oldFc, i)
{
oldFc[i] = pp[i].centre(oldAllPoints);
}

vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaT().value();

const volVectorField& U = db().lookupObject<volvectorfield>("U");
scalarField phip =
p.patchField<surfacescalarfield,>(fvc::meshPhi(U)) ;

vectorField n = p.nf();
const scalarField& magSf = p.magSf();
scalarField Un = phip/(magSf + VSMALL);


vectorField::operator=(Up + n*(Un - (n & Up)));

fixedValueFvPatchVectorField::updateCoeffs();
}
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 23, 2008, 16:55
Default Hi Niels, I had no time at
  #16
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 17
robbo is on a distinguished road
Hi Niels,

I had no time at all to continue my OpenFOAM projects during the last weeks. Now that I've found the time i've tried to compile the boundary condition you've posted but the make command gives no good results at all :-(
it exits with Error 1. How can I do? Do you think that posting you (mayba via mail) the shell's output could help (it's pretty long and unreadable though...)?

thanks for your help

Roberto
robbo is offline   Reply With Quote

Old   May 23, 2008, 17:28
Default Hi Roberto Just give it a t
  #17
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Roberto

Just give it a try, we might be able to find a solution.

- Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 26, 2008, 14:58
Default Hi Niels, i was reflecting
  #18
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 17
robbo is on a distinguished road
Hi Niels,

i was reflecting about my original question: I think I was wrong. I'll try to explain in a few words.
My original purpose was to compute numerically the lift generated on a rotating cylinder for a potential flow and compare it with analytical solution.
My first solution for that problem was: make the cylinder rotate and the solutor will do the rest.
Now iI was thinking that in a potential flow making the cylinder rotate will not affect the remaining part of the flow because of the absence of viscosity.
I think I have to change my approach.
I need to superimpose on the uniform flow field a free vortex (generated in a real fluid by the viscosity, but not in a potential flow). In a few words I have to force a flow field generated by the viscosity in a nonviscous fluid.
How can I do? and how can I subsequently calculate the resultant force acting on the cylinder by integrating the pressure distribution on the cylinder?
I'm aware that I have to change the geometry of the case because in those conditions there's no more symmetry in the flow field.

tia

Roberto
robbo is offline   Reply With Quote

Old   May 27, 2008, 03:58
Default Hi Roberto If you are going
  #19
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Roberto

If you are going to do viscous modeling, then why do you not use any of the many viscous solvers in the OF-package. Superimposing the viscous part on the potential flow is probably possible in OF - wouldn't know where to start though - but I see another problem, which is significantly more severe. Because superimposing two solutions require the equations to be linear, thus you are essentially restricted to creeping flow solutions, otherwise the convective terms may become non-negligible.
Thus using the viscous solvers you are not limited to a certain range of Reynolds numbers.

Best regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 27, 2008, 13:25
Default Hi Niels, My aim was to val
  #20
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 17
robbo is on a distinguished road
Hi Niels,

My aim was to validate the potentialFlow solver, I don't need to do viscous modeling. If anyone has sugestions...

Thanks

Roberto
robbo is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
3-d mesh gambit (cylinder within a cylinder) Jason ANSYS Meshing & Geometry 29 October 30, 2015 08:59
tutorial for solving oscillating cylinder problem CH FLUENT 8 April 2, 2014 10:56
tutorial 6 in Fluent 6.2 tutorial and Mesh pilli4u FLUENT 2 April 2, 2007 05:09
tutorial for 3D CYLINDER-PISTON ARRANGEMENT sachin bhalerao FLUENT 0 February 28, 2006 03:05
Help meeee: Wave cylinder (sine cylinder) Ngoctq FLUENT 0 December 29, 2005 20:46


All times are GMT -4. The time now is 17:09.