
[Sponsors] 
January 9, 2010, 13:47 
Equations in Cylinder Coordinates

#1 
New Member
Steffen K.
Join Date: Jan 2010
Posts: 11
Rep Power: 8 
Hi,
I just started learning OpenFOAM and somewhere on the first manual pages it is mentioned, that OpenFOAM uses the carthesian coordinate system by default. I want to simulate the flow through a cylinder and so want to set up my equations in cylindrical coordinates... can I "teach" OpenFOAM to use another system than the cathesian one? Thanks a lot Greez Steffen P.S. is there a good source for learning how to develop a simulation case by hand? = not take an example and change the settings but develop a case by myself... Thanks 

January 9, 2010, 16:41 
additional question

#2 
New Member
Steffen K.
Join Date: Jan 2010
Posts: 11
Rep Power: 8 
Hi again,
it seems to me that icoFOAM bases on the NavierStokes Equation, which I need. But... ... is the continuity equation also included there? ... how can I set up additional boundary and starting conditions? Do I need to write them into any part of the C Code and recompile the Files or is it possible to set them up into the "normal" config files? ... again  how can I make OpenFOAM use cylindrical Coordinates? So I have to change and recompile the code for that or can I set that up in any of the config files? ... If I have to change so many things on an existing project, will it be better/ easier to built a project by myself? Thanks a lot  I am a little "overextended" because of the huge power and possibilities of the program. Greez Steffen 

January 9, 2010, 19:06 

#3 
Senior Member
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 12 
I don't think so. Prove me wrong, developers ...
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!" 

January 9, 2010, 19:13 

#4  
Senior Member
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 12 
Yes. icoFoam uses the PISOalgorithm which includes the numerical treatment of the continuity equation.
Quote:
Quote:
Have a look at Fig. 5.4 in the User Guide. Are you talking about a single simulation or the whole OpenFOAM when you say "project"?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!" 

January 10, 2010, 09:05 

#5 
New Member
Steffen K.
Join Date: Jan 2010
Posts: 11
Rep Power: 8 
Boundaries:
For solving a DiffEq one needs boundary and starting conditions, like e.g. U(t=0)=0 or p(x=0)=0; How and where are such conditions set up in a simulation (=project) (as e.g. icoFOAM)? And If I want to change such conditions in an existing project, where can I do so? Do I have to touch the C code or can it be realized via changing parameters in the already compiled files (as one can find in the tutorials folder). Sorry if my questions are not posed very precisely, but it is because I just started with OpenFOAM. Thanks a lot Greez Steffen 

January 10, 2010, 15:33 

#6  
Senior Member
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 12 
Quote:
Initial and boundary conditions for each fields are stored within the case directory's subdirectory '0' (corresponsing to time = 0). Like: 0/U (Velocity) or 0/p (Pressure) You don't have to touch the OpenFOAM code, but simply run the icoFoam on a case. But if you haven't figured that out yet I supposed you haven't had a look into the User Guide. I suggest you do that in the next step.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!" 

January 11, 2010, 04:42 

#7  
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 780
Rep Power: 19 
Quote:


January 11, 2010, 05:52 

#8 
New Member
Steffen K.
Join Date: Jan 2010
Posts: 11
Rep Power: 8 
As a first approxomation for my diploma thesis I want to simulate the flow through a pipe (=cylinder), which has specific properties. When using a cylindrical coordinate system, the equations look much easier than in carthesian coordinates. For sure I could use the carthesian one, but then the equations become quite ugly...
@ Mark: Do you think it makes sense to make OpenFOAM use another coordinate system? (I found this: http://openfoamwiki.net/index.php/Si...ry_/_Tutorials). If I used the carthesian system, my boundary conditions become quite complicated (e.g. describe a condition on the wall of the cylinder...) @ Sebastian: I read the user guide's chapters about boundaries, but it is still unclear how to handle them. Now I know that somehow the "boundary" file and the "p" and "U" files correspond, but I still dont understand in which way... e.g. If I simply wanted to say: "U_x(x=0,y,z,t)=0" or "p(t=0,x,y,z)=p_start", how could I set this up? Perhaps one can explain my problem with a little example: "boundary file": movingWall { type wall; nFaces 20; startFace 760; } "/0/p file": movingWall { type zeroGradient; } Does that mean that the moving wall (specified in polyMeshDict) has a zeroGradient (in what?) for all the time? And what does nFaces and startFaces mean? Sorry for this huge postings  but I am really interested in OpenFOAM and this unclearity in my brain drives me crazy Thank you! 

January 11, 2010, 06:39 

#9  
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 780
Rep Power: 19 
Quote:
... not even considering how something like the Reynolds' stresses would look like in cylindrical coordinates! Also consider that the code would internally need different definitions for the gradient, divergence, laplacian etc. operators, as well as cell positions, volume calculations etc. And of course, your cylindrical domain would always need to be exactly coincide with the global coordinates .... I hope you can see why Cartesian coordinates are used for general purpose CFD codes (commercial or open source). If you wish to solve your problem with OpenFOAM, STARCD, Fluent, CFX, etc. just get used to the idea that you need to solve in Cartesian coordinates. Of course you are still free to transform your final results back into cylindrical if that's what you need. 

January 11, 2010, 06:49 

#10 
New Member
Steffen K.
Join Date: Jan 2010
Posts: 11
Rep Power: 8 
Oh all right  I see the problem... thanks for advice :)
At the moment I am trying to simulate a simple HagenPoisseuilles Flow in a cylindrical tube  just for Practice... If I wanted to extend this first test to a nonrigid (= extesible tube), how do I have to build up my mesh? Does it have to be variable in size? Or is there any "common" technique for that? Thx and Greez Steffen 

January 11, 2010, 07:48 

#11  
Senior Member
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 12 
Quote:
First of all you mesh with the blockMesh tool. This is where you specify the boundary conditions, like wall in you example. blockMesh writes the boundary file which should not be touched by you at this moment. All you have to do is to manipulate the 0/U file! Code:
movingWall { type wall; } Well, at least for such a simple boundary condition this may be true. Wall corresponds to U=0 at this boundary. If you have specified wall as boundary condition in the blockMesh file zeroGradient (velocity gradient normal to the boundary) would not be possible as it is allready set to U=0 from blockMesh and written to the boundary file. Still with me? Make sure you understand that you specify the boundaries within the blockMeshDict and in the field file as well and they have to correspond. Example (besides the many in the tutorial cases): To set up a Neuman boundary condition, select patch in the blockMeshDict file and select zeroGradient in the field file. To select a moving Wall, select patch in the blockMeshDict file and select type fixedValue; value uniform(0 1 0) corresponding to the velocity direction you wall is moving.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!" 

March 26, 2010, 01:27 
Advantage of cylindrical coordinates

#12 
New Member
Andrew Medlin
Join Date: Mar 2010
Posts: 1
Rep Power: 0 
The main advantage of cylindrical coordinates as I see it is that you can more easily exploit rotational symmetry in your problem to make it more computationally tractable.
For example, if your 3D geometry is axisymmetric, you could write your equations in cylindrical coordinates and reduce it to a 2D problem. A 2D simulation domain is likely to run orders of magnitude faster than the same thing modelled in 3D. I'm not sure if OpenFOAM supports it, but even with your mesh in cartesian coordinates you could effectively solve it in a 2D domain if the solver implements angular cyclic boundary conditions. In this case your mesh dimension in the theta direction could be 1 cell, effectively turning it into a 2D problem. 

March 26, 2010, 04:11 

#13  
Senior Member
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 12 
Quote:
It's all 3D cartesian!
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!" 

June 8, 2010, 10:09 

#14  
Senior Member
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 1,139
Rep Power: 20 
Quote:
It's all 3D cartesian, but it is possible to specify a wedge boundary condition (angular cyclic) as amedlin described to effectively reduce your computation to 2D. 

January 4, 2012, 11:51 

#15 
New Member
Join Date: Jul 2011
Location: Berlin, Germany
Posts: 8
Rep Power: 7 
Hi,
sorry i resurrect this old Thread but I have exactly the same question as the original poster, plus the answers of akidess & amedlin go in the direction I want: My problem has cylinder symmetry which reduces my 3D Problem to 2D. My Problem is now to design a solver with the governing equations which of cause differ a little from their Cartesian form. My equations read: momentum equation: (radial direction) (vertical direction) together with the mass conservation: whereas: r,z are coordinate variable names G,M are constants P is the pressure field rho is the density field Now how do I formulate this in the OF language? In particular how do I use the coordinate position in the formulation of the equations? Can I write something like: Code:
volScalarField temp1(r*rho & v_r); volScalarField temp2(rho & v_z); solve ( fvm::ddt(rho) + 1/r * fvm::grad(temp1) + fvm::grad(temp2) ==  fvc::grad(p) ); I would really like to use OpenFOAM for this because I like C++ and the OO programming style. I also think OpenFOAM knowledge can be a key ability for later jobs. If you like to know where the equations come from: It is going to be the simulation of a solar nebula in its disk phase. Thank you for helping! p.s.: The singularity at r=0 is no problem because I stop the simulation before the Sun starts ;) Last edited by skynet4ever; January 4, 2012 at 12:01. Reason: clarification 

January 12, 2012, 08:08 

#16 
New Member
Join Date: Jul 2011
Location: Berlin, Germany
Posts: 8
Rep Power: 7 
Hi Foamers,
can't somebody give me a hint? I have done a sketch of my problem which I appended as an attachment. I have already constructed a grid using wedge boundary conditions. Which can be found in this Thread Wedge geometry with two blocks as I read in multiple Threads I can't use equations in cylindrical symetry, right? (please answer) So I have to transform my equations. But as my grid is only 2D I see no point in giving an expression for the symmetric Coordinate. If that is so can I simply replace r>x and z>z? Or dose the wedge boundary internally need the full equation? The continuity equation is straightforward but I have trouble with the momentum equation... I also could really need some help for the construction of the corresponding field from the equation above. I found some useful code in the tutorial "Flow around a cylinder" from the programmers guide: Code:
Info<< "\nEvaluating analytical solution" << endl; const volVectorField& centres = UA.mesh().C(); volScalarField magCentres(mag(centres)); volScalarField theta(acos((centres & vector(1,0,0))/magCentres)); volVectorField cs2theta ( cos(2*theta)*vector(1,0,0) + sin(2*theta)*vector(0,1,0) ); UA = uInfX*(dimensionedVector(vector(1,0,0))  pow((radius/magCentres),2)*cs2theta); From the http://openfoamwiki.net/index.php/Si...ry_/_Tutorials I learn that it is at least possible to introduce a Cylindrical Coordinate Systems... Thanks in advance. Philipp Last edited by skynet4ever; January 12, 2012 at 11:04. Reason: mistakes 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Guide: Writing Equations in LaTeX on the CFD Online Forums  pete  Site Help, Feedback & Discussions  20  June 16, 2015 13:52 
benchmark: flow over a circular cylinder  goodegg  Main CFD Forum  12  January 22, 2013 12:47 
Moving a Cylinder in cross flow after solving Dynamics equations of motion  maruthamuthu_venkatraman  OpenFOAM  1  November 19, 2009 14:55 
rotating cylinder using sliding mesh  Tim Daly  FLUENT  1  November 10, 2008 00:02 
Turbulent steady flow around a circular cylinder  Mirek Kabacinski  FLUENT  0  July 23, 2003 18:40 