
[Sponsors] 
April 14, 2014, 04:09 
Preprocessing of Turbulent Pipe Flow

#1 
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
Hello Foamers,
I'm quite new at CFD and OpenFOAM. I am trying to simulate turbulent pipe flow using the channelFoam solver. My case was set using channel395 as a base. At first, I tried to get the turbulence (Re_tau = 170) with non perturbed initial conditions, but I only got laminar flow. Then, I used the perturbU, and perturbCylinder applications, but the oscillations were damped as the time increased. Then, I created my own perturbations by adding some noise to the U file in the 0 directory, but still got no turbulence. Would you mind helping me with a hint? Cheers, Byron 

April 14, 2014, 04:35 

#2 
Senior Member
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,133
Rep Power: 20 

April 14, 2014, 04:57 

#3 
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
Thank you for your quick response Alexey,
Yes, I have been adding Gaussian noise, I also used perturbU, and perturbCylinder, but still got no turbulence. Do you have any suggestions of what should I do in order to obtain turbulent structures? Cheers, Byron 

April 14, 2014, 05:16 

#4 
Senior Member
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,133
Rep Power: 20 
Well, it partly depends on the nature of your case. For example you can use boxTurb utility to initialize flow (as it uses FFT, number of cells in certain directions should be power of 2).
"...turbulent pipe flow..." is rather broad term, you should be more specific. 

April 14, 2014, 08:11 

#5 
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
Thank you Alexey,
I will try to do what you recommend. About pipe flow, I am trying to simulate turbulent flow at different Reynolds numbers. This pipe has a 30*D length, and I am using cyclic boundary conditions in the inlet and the outlet. Regards, Byron 

April 15, 2014, 00:17 

#6  
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
Hello Alexey,
Quote:
Quote:


April 15, 2014, 03:01 

#7 
Senior Member
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,133
Rep Power: 20 
To understand the reason of the error we should look at Kmesh.C:
Code:
boundBox box = mesh.bounds(); l_ = box.span(); vector cornerCellCentre = ::Foam::max(mesh.C().internalField()); vector cellL = 2*(box.max()  cornerCellCentre); vector rdeltaByL; label nTot = 1; forAll(nn_, i) { nn_[i] = label(l_[i]/cellL[i] + 0.5); nTot *= nn_[i]; if (nn_[i] > 1) { l_[i] = cellL[i]; } rdeltaByL[i] = nn_[i]/(l_[i]*l_[i]); } You can try to modify the code of Kmesh like this (this part is located just below forAll loop I've posted): Code:
if (nTot != mesh.nCells()) { FatalErrorIn("Kmesh::Kmesh(const fvMesh& mesh)") << "calculated number of cells is incorrect.\n" << "Mesh size: " << mesh.nCells() << "\n" << "Calculated size: " << nTot << abort(FatalError); } Code:
> FOAM FATAL ERROR: calculated number of cells is incorrect. Mesh size: 60000 Calculated size: 249600 From function Kmesh::Kmesh(const fvMesh& mesh) in file Kmesh/Kmesh.C at line 76. So I guess, you've tried channel395 mesh and it does have grading. If you'd like to have grading in your mesh and initialize it with boxTurb, you can initialize flow on the uniform mesh and then use mapFields utility to interpolate between meshes (uniform and graded). 

April 15, 2014, 03:47 

#8 
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
Thanks a lot Alexey.
That was really helpful. I actually have grading in my mesh. I'll try to do what you recommend. Cheers 

April 15, 2014, 04:17 

#9 
Member
Dejan Morar
Join Date: Nov 2010
Posts: 78
Rep Power: 7 
Hi Byron,
an easy solution would be to increase your Re in order to get turbulence. Afterwards, just map the velocity field to another case with lower bulk velocity. Regards 

April 15, 2014, 05:17 

#10 
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
Thank you Dejan,
I will also try to do what you suggest. Cheers. 

April 18, 2014, 03:04 

#11 
Senior Member
Cedric DUPRAT
Join Date: Mar 2009
Location: Belgium
Posts: 179
Rep Power: 8 
Morning Byron,
I've ran such a case few years ago. You could have a look there : LES turbulent pipe flow #39 One idea is to use a coarse grid first, with cyclic BC to let the turbulence develop then map this results into your fine grid. Notice that in PerturbU you can also increase the amplitude of your initial noise. Then if I remember correctly, I've managed also add a swirl in the flow to help the turbulence develop. I switched this swirl off after few second of calculation. Then, as Dejan suggested, increase your Re seems to be a good idea in order to get turbulence. I hope this will help you, Cedric 

April 18, 2014, 06:35 

#12 
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
Thank you Cedric,
I will try to do what you suggest. Regards, Byron 

April 19, 2014, 04:48 

#13 
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
Thank you Cedric, Alexey and Dejan,
I was finally able to get the turbulence. What I did was to first create turbulence in a square channel without bounded walls which fits within my pipe, and has the same length with the boxTurb utility. Then, I perturbed my wallbounded pipe with perturbCylinder, and I mapped the velocity fields of the box within the pipe. That was my initial condition. Then I ran the simulation for 500 seconds, and I finally got some continous turbulence. Cheers. 

April 19, 2014, 04:59 

#14 
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
[QUOTE=cedric_duprat;486826] I've ran such a case few years ago. [Quote]
Hello Foamers, I have been trying to obtain the averages of the velocity fields from the different time directories to obtain the U+ vs y+ curve by using the sample utility. However, I has become very laborious and I have been trying to make a script for this task but it will take me a while. Would you mind suggesting me an easier way to obtain this data? Regards. 

April 24, 2014, 06:50 

#15 
Senior Member
Join Date: Nov 2012
Location: Bavaria
Posts: 144
Rep Power: 4 
Dear byrong,
please have a look at this thread started by Florian Krause: y+ and u+ values with lowRe RANS turbulence models: utility + testcase The utility has been changed/expanded during time by others. formulas: y+ and u+ values with lowRe RANS turbulence models: utility + testcase Questions to utility yPlusLES I've used combination of different versions: yPlusLES.tar I am not clear about line 173 in file yPlusLES.C Does this line map from the closest perpendicular boundary field face to the current face to have for computation of ? Is it correct to map to faces of cells inside the volume to finally compute and ? was at first computed in the cells next to the wall, therefore I understand for this case that you need according to could be computed with gradient between current cell and neighbour cell instead of mapping the value from closest boundary field cell. But obviously must be mapped from boundary cell. Could you explain me why? I have a problem with the underlying physics. You've mentioned that you 've used perturbU as well. I haven't read the paper ("Coherent structure dynamics in near wall turbulence") yet. Is there a possibility to validate the perturbed field U (before using it)? Regards, Aylalisa 

April 25, 2014, 09:19 

#16 
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
Hello Aylalisa,
First, thanks a lot for your references. They are really helpful. I may not be the best person to reply your questions since I am just becoming familiar with openFoam. If you want to validate perturbU, you should check Eugene de Villier's PhD thesis. He coded the perturbU utility. You can find his thesis in the following link http://foamcfd.org/resources/theses.html. Cheers, Byron 

April 25, 2014, 11:12 

#17 
Senior Member
Cedric DUPRAT
Join Date: Mar 2009
Location: Belgium
Posts: 179
Rep Power: 8 
Dear Aylalisa,
I'm not sure about the line you are talking about but regarding this code: http://foam.sourceforge.net/docs/cpp/a08929_source.html I guess you are talking about these lines: Code:
81 yPlus.boundaryField()[patchi] = 82 d[patchi] 83 *sqrt 84 ( 85 nuEff.boundaryField()[patchi] 86 *mag(U.boundaryField()[patchi].snGrad()) 87 ) 88 /nuLam.boundaryField()[patchi]; In this formula, is calculate like this: The class member snGrad is the gradient of velocity normal to each face of the wall patches (you could find more information about this snGrad in the forum). and is your closest point to the wall in the normal direction (volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y(). About PerturbU, one easy way to validate (or to see what it's doing) is to applied it to one time step. You can then visualize this time step. You should/will see a nice parabolic profile and if you zoom at the wall, you'll see the sinusoidal noise added close to the wall in the spanwise and wall normal direction. I hope this will help you, Cedric 

April 25, 2014, 12:29 

#18 
Senior Member
Join Date: Nov 2012
Location: Bavaria
Posts: 144
Rep Power: 4 
Dear Cedric,
Your explanation is very good for me. I've already tried to understand the code (C++ beginner) for computation of y+ and concluded that (with this formula) I can compute y+ 'only' for cells next to the walls (???). Your explanation seems to confirm this. I've mixed up the uploaded versions for computation of yPlus, excuse me! Therefore you could not find the code line I've mentioned. First I've started with florian krause's code: plusPostRANSUtility.tar.gz (y+ and u+ values with lowRe RANS turbulence models: utility + testcase) Following the thread I stumbled over y+ and u+ values with lowRe RANS turbulence models: utility + testcase > yPlusUPlus! My question refers to line 180 in the version 'yPlusUPlus' offered by chegdan, #35. I would like to get yPlus and uPlus for the domain, to create plots yPlus/uPlus at different positions in the domain. Therefore I use the code from chegdan with some question marks in mind(line 180, in my personal version it was line 173). I see the sinusoidal noise close to the walls! Thanks! Best regards, Aylalisa Last edited by aylalisa; April 29, 2014 at 10:37. 

June 18, 2014, 03:17 

#19  
New Member
Winson Chen
Join Date: Mar 2014
Posts: 4
Rep Power: 3 
Quote:
I am trying to run exactly the same case as you, turbulent pipe flow with Re_tau = 180. I am also new to OpenFoam. Could you please elaborate more on how to modify the perturbCyl code to fit into your case? I downloaded perturbCyl from the forum but am not sure how to interpret the code. Cheers, Winson Chen 

June 18, 2014, 04:02 

#20  
New Member
Byron
Join Date: Apr 2014
Posts: 11
Rep Power: 3 
Quote:
I assume you already got a proper mesh. However, to obtain a proper perturbation, I kind of cheated because I tried thousands of times using the perturbCylinder, and it did not work. In fact, the sine waves always became laminar. Therefore, what I did was the following: 1. Create a square channel with only two plates at the top and at the bottom which fits within the pipe you have. 2. Generate an initial perturbation using the boxTurb utility. Check a tutorial to use boxTurb first since the mesh must be divided in powers of two in each direction. 3. Run the case with the same velocity and viscosity parameters as the ones you will use in your pipe maybe for 5 to 10 cycles within the flow domain, or until you reach constant turbulence. 4. Once you got the turbulence map the velocity field of the squared channel to the pipe geometry with developed flow as an initial condition (both geometries should have the same length). To do this you require to use the mapFields utility, and create a mapFieldsDict within the system directory (there are plenty of tutorials of this online). 5. Run your pipe case. At the begining, the initial condition will look weird, but as long as the flow develops, you will get some nice turbulence. Run the case through the pipe domain for at least 10 complete cycles. Then use your last time step as a new initial condition, and run your case again for another 5 cycles. By doing this I got really nice statistics. Indeed, my statistics were very close to some DNS statistics that my supervisor gave me. I hope it helps. If you still need to use perturbCyl, you might have to write to Eugene de Villers, since he coded that utility, but in my case it did not work. And if you make it work properly, please let me know. Cheers, Byron 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
sonicFoam  pressure driven pipe: flow continuity violation and waveTransmissive BC  Endel  OpenFOAM Running, Solving & CFD  3  September 11, 2014 16:29 
Simulating turbulent flow in rectangle pipe with rhoPimpleFoam  zqlhzx  OpenFOAM Running, Solving & CFD  1  January 6, 2014 06:24 
turbulent pipe flow result validation  preetam69  FLUENT  0  September 13, 2013 05:10 
Turbulent flow through a pipe with variable inlet velocity  lobstar  OpenFOAM Running, Solving & CFD  8  March 28, 2012 11:15 
Appropriate model for turbulent, steady state pipe elbow flow  milos  OpenFOAM Running, Solving & CFD  4  July 9, 2009 02:24 