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

Cylinder tutorial

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

Reply
 
LinkBack Thread Tools 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: 9
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: Deltares, Delft, The Netherlands
Posts: 1,677
Rep Power: 26
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 1, 2008, 09:16
Default Hi Niels, I've tried to sen
  #3
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 9
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
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,677
Rep Power: 26
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
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,677
Rep Power: 26
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   May 1, 2008, 17:18
Default When you want to rotate the cy
  #6
New Member
 
Mark Michael
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 5
Rep Power: 9
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
  #7
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,677
Rep Power: 26
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
  #8
New Member
 
Mark Michael
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 5
Rep Power: 9
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
  #9
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,677
Rep Power: 26
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
  #10
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 9
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
  #11
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,677
Rep Power: 26
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
  #12
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 9
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
  #13
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,677
Rep Power: 26
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
  #14
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 9
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

Old   May 27, 2008, 15:18
Default Hi I have hardly ever solv
  #15
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,677
Rep Power: 26
ngj will become famous soon enoughngj will become famous soon enough
Hi

I have hardly ever solved any potential flow problems, but if you take a book in Complex number then there will probably several examples on the use of conformal mapping, and conformal mapping is basicly a mapping of the laplace-operator (at least in all the cases I have ssen).

Actually I have seen a paper of the flow under a sluice gate assuming potential flow, see [1].

Further you could look into textbooks in geotechnic, as all plane flows in soils are also based on the laplace equation with appropriate boundary conditions.

Hope this inspires you.

- Niels

[1]: Flow from a Sluice Gate under Gravity, V.J.Klassen, Journal of Mathematical Analysis and Apllications 19, pp 253-262, 1967
__________________
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 8, 2008, 05:10
Default Hi Niels, I was looking to
  #16
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 9
robbo is on a distinguished road
Hi Niels,

I was looking to the results of the cylinder tutorial simulation (that with uniform flow, I've not even added the swirl. Always facing with the lack of time :-)) and I've found something strange.
I've done the simulation as described in the programmer's guide (with nNonOrthogonalCorrectors=3).
The velocity field in this case seems to have a good agreeement with that I expected but the pressure filed is uniform across all the domain. This is not really what i expected to view... The pressure should be higher on the stagnation point on the nose of the cylinder and less on the top of it, exactly in the opposite way as the velocity does. I'm wrong? What I'm not considering?

thanks so much

Roberto
robbo is offline   Reply With Quote

Old   June 9, 2008, 03:40
Default Hi Roberto The reason p=0 i
  #17
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,677
Rep Power: 26
ngj will become famous soon enoughngj will become famous soon enough
Hi Roberto

The reason p=0 is that you do not write the pressure field by default from potentialFoam. Execute the solver as follows:

potentialFoam . cylinder -writep

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   June 9, 2008, 10:35
Default Hi Niels, I've done what yo
  #18
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 9
robbo is on a distinguished road
Hi Niels,

I've done what you wrote me to do and potentialFoam writes the pressure field. What I think is that the pressure field it plots is incorrect.
The pressure shows a sort of continuous linear decreasing towards the whole field (near and far from the cylinder). I'dont think that this has good matching with what really happens. In fact with this pressure field (and with this velocity distribution) the total pressure within the domain is not constant although it should be 'cause in a potential flow without shocks there are no losses.
Do you think that I'm right?
I'was thinking that this is because of the pressure equation used. In the programmer's guide it says that potentialFoam uses laplacian(p)=0.
I don't think that that equation is correct. I don't have books but I remember from my studies that there should be something connected with the velocity field. How can tha solver couple the velocity field with the pressure field in this way?
Thanks for your help!

Roberto
robbo is offline   Reply With Quote

Old   June 13, 2008, 03:07
Default I've found in my university st
  #19
New Member
 
Roberto
Join Date: Mar 2009
Posts: 17
Rep Power: 9
robbo is on a distinguished road
I've found in my university stuff that the pressure equation for an incompressible fluid is:

laplacian(p)=-rho*d(U_i)/d(x_k)*d(U_k)/d(x_i)

This equation is written using Einstein notation for vector components, and i and k are generic components.

Has anyone some news about this problem? Niels do you think that could be helpful if I move this discussion (or the last two messages only) in the bug section?

thanks

Roberto
robbo is offline   Reply With Quote

Old   June 13, 2008, 03:46
Default Well, if you into the source o
  #20
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,677
Rep Power: 26
ngj will become famous soon enoughngj will become famous soon enough
Well, if you into the source of potentialFoam, you will find that the pressure equation is not solves as

laplaian(p) = 0

but

laplacian(p) = div(phi)

which should be the same as you have written above. Though I agree that it is odd that you have the 'linearly' decreasing pressure.

Have a nice weekend,

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

Reply

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
3-d mesh gambit (cylinder within a cylinder) Jason ANSYS Meshing & Geometry 29 October 30, 2015 09: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 04:05
Help meeee: Wave cylinder (sine cylinder) Ngoctq FLUENT 0 December 29, 2005 21:46


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