# boundary condition for constant pipe flow

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

 July 25, 2014, 16:13 boundary condition for constant pipe flow #1 New Member   Join Date: Jul 2014 Posts: 17 Rep Power: 5 hello guys, right know I try to simulate a simple constant pipe flow with Open Foam. I use the solver "SimpleFoam". The pipe consisits of an an inlet on the left site and an outlet on the right site. At the cylindrical middle part friction exist. I know the inflow velocity of 3 m/s. What about the BC? Following BC are used in the velocity file: Inlet type fixed value value uniform (3 0 0) Outlet zero gradient middle part fixed value uniform (0 0 0) in the Pressure file: inlet zero gradient middle part zero gradient outlet typ fixed value value 0 I do not know why, but the simulation does not work. Can you give me a reason for that? Are the BC wrong? Thanks! Specialist

 July 26, 2014, 22:32 #2 New Member   Debb Join Date: Sep 2011 Location: Toronto, Canada Posts: 20 Rep Power: 8 you might want to try specifying an inlet pressure, rather than an outlet pressure I've encountered this problem myself and this was how I got around it,

 July 27, 2014, 02:38 #3 New Member   Join Date: Jul 2014 Posts: 17 Rep Power: 5 I thought about that. Look at that example: http://www.foamcfd.org/Nabla/guides/...Guidese13.html The pressure at the outlet must be defined with 0. I am interested in the loss of pressure in the pipe. If I define the pressure at the inlet and at the outlet, I would definde the loss of pressure for myself. That does not make sense? Do I have to use other types of BC? Something like OutletInlet oder Inletoutled? But I thought, I should be possible with the normal simple BC.

 July 30, 2014, 05:32 #4 Senior Member   Joachim Herb Join Date: Sep 2010 Posts: 427 Rep Power: 13 What does mean, your simulation does not work? Could you post the output of the solver.

October 29, 2014, 04:37
#5
Member

Join Date: Aug 2011
Posts: 83
Rep Power: 8
Hello,
I am dealing with the same topic at the moment.
My aim is the calculation of the pressure drop in a pipe (diameter d=0.02m, length L=5 m).
I consider at the beginning a stationary, laminar, incompressible flow and try the simulation with simpleFoam.
To see that everything is correct I want to compare the simulation with the analytical result.

I calculate the analytical result in the following way:
velocity at the inlet: v=0.0884 m/s
viscosity: 1x10e-6 m^2/s
pressure drop : delta_p = lambda * L*density *v^2/d/2
lambda is the coefficient, defined: lambda=64/Reynolds-Number=0.0362
So the calculated pressure drop is: 35.3 Pa

Now I start the simulation:
After the calculation Iīve got a pressure-field and I used paraview to calculate the pressure drop (with the calculator: pressure * densitiy (1000 kg/m^3)
The pressure drop is 15 Pa, which is not equal to the pressure drop I calculated in the analytical way.

Does anyone know where my mistake is?

I also tried to calculate the pressure drop, when I initialized the velocity profile with u(r) = u_max (1 - (r/R)^2) , called Hagen-Poiseuille, with R=0.01 m and u_max = 0.14 m/s so that the mean velocity (integrated over the above velocity profile) is 0.0884 m/s.

Thanks a lot for your help

Here are the files I used:

the U-file is:
Quote:
 dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inlet { type fixedValue; value uniform (0 0.08842 0); } outlet { type zeroGradient; //value uniform (0 0.08842 0); } fixedWalls { type fixedValue; value uniform (0 0 0); } frontAndBack { type empty; } }
The p-file is:
Quote:
 dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { inlet { type zeroGradient; } outlet { type fixedValue; value uniform 0; } fixedWalls { type zeroGradient; } frontAndBack { type empty; } }
my blockMesDict:
Quote:
 convertToMeters 1; vertices ( (0 0 0) (0.01 0 0) (0.01 5 0) (0 5 0) (0 0 0.02) (0.01 0 0.02) (0.01 5 0.02) (0 5 0.02) ); 3 blocks ( hex (0 1 2 3 4 5 6 7) (1 100 20) simpleGrading (1 1 1) ); edges ( ); boundary ( inlet { type patch; faces ( (0 1 5 4) ); } fixedWalls { type wall; faces ( (0 1 2 3) //top (6 7 4 5) //bottom ); } outlet { type patch; faces ( (6 2 3 7) ); } frontAndBack { type empty; faces ( (0 3 7 4) (6 2 1 5) ); } ); mergePatchPairs ( );
my fvSchemes:
Quote:
 ddtSchemes { default steadyState; } gradSchemes { default Gauss linear; } divSchemes { default none; div(phi,U) Gauss linearUpwindV grad(U); div(phi,k) Gauss upwind; div(phi,omega) Gauss upwind; div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes { default Gauss linear corrected; } interpolationSchemes { default linear; } snGradSchemes { default corrected; } fluxRequired { default no; p; }
my fvSolution-file:
Quote:
 solvers { p { solver GAMG; tolerance 1e-7; relTol 0.1; smoother GaussSeidel; nPreSweeps 0; nPostSweeps 2; cacheAgglomeration on; agglomerator faceAreaPair; nCellsInCoarsestLevel 10; mergeLevels 1; } U { solver smoothSolver; smoother GaussSeidel; tolerance 1e-8; relTol 0.1; nSweeps 1; } } SIMPLE { nNonOrthogonalCorrectors 0; } potentialFlow { nNonOrthogonalCorrectors 10; } relaxationFactors { fields { p 0.3; } equations { U 0.7; } } cache { grad(U); }
my transportPorperties-file:
Quote:
 transportModel Newtonian; nu nu [0 2 -1 0 0 0 0] 0.000001;

 October 29, 2014, 08:31 #6 Senior Member   Joachim Herb Join Date: Sep 2010 Posts: 427 Rep Power: 13 @idefix: Are you using a turbulence model? Which? Your Re seems to be 1770 (calculating backward from lambda). So the flow is somewhere in the transition to a turbulent flow.

 October 29, 2014, 15:37 #7 Member   Join Date: Aug 2011 Posts: 83 Rep Power: 8 Hello Joachim thanks for you answer. I dontīuse a turbulence model for this calculation, but I had the same thougth and changed the velocity to 0.265 m/s, so I am turbulent and I am using the k-epsilon-turublence model I still have a big difference between simulation and analytical result. But I changed the grid size to smaller cells and therefore I get closer to the real result. As a consequence the time for othe simulation gets very big. Is there another way to get closer to the analytical result? Thanks for your help idefix

 October 29, 2014, 17:12 #8 Senior Member   Joachim Herb Join Date: Sep 2010 Posts: 427 Rep Power: 13 Just to be sure: Your solution is converged? The pressure difference is not oscillating between (time)steps?

 October 30, 2014, 14:56 #9 Member   Join Date: Aug 2011 Posts: 83 Rep Power: 8 I used simpleFoam in the steady state-modus. It stopped when the convergence criterion is reached. Till there the pressure was not constant. I calculated the pressure drop with the help of the following command: patchAverage p inlet >inletAvP because the pressure at the outlet is set to 0, the calculated pressure is the wished pressure drop - I hope everything is correct, if not please tell me. is there a reason why you are asking? Thanks a lot idefix

 October 30, 2014, 17:14 #10 Senior Member   Joachim Herb Join Date: Sep 2010 Posts: 427 Rep Power: 13 If you look at the pressure values of different steps of the simulation, do they converge (together with the residuals)?

October 31, 2014, 02:54
#11
Member

Join Date: Aug 2011
Posts: 83
Rep Power: 8
I attached the residuals. Unfortunately the pressure is yello. I hope you can see it.
What do you think?
Attached Images
 p1.png (31.0 KB, 78 views)

 October 31, 2014, 08:25 #12 Senior Member   Joachim Herb Join Date: Sep 2010 Posts: 427 Rep Power: 13 Do your result change, if you set the convergence criteria to 1e-4?

 November 1, 2014, 03:40 #13 Member   Join Date: Aug 2011 Posts: 83 Rep Power: 8 do you mean the tolerances in fvSolution-file?

 November 1, 2014, 08:09 #14 Senior Member   Joachim Herb Join Date: Sep 2010 Posts: 427 Rep Power: 13 I mean runtime control (chapter Residual/Convergence Control): http://www.openfoam.org/version2.0.0...me-control.php

 November 3, 2014, 10:21 #15 Member   Join Date: Aug 2011 Posts: 83 Rep Power: 8 the calculation is still running. the pressure residual and the residual of the velocity component in the main flow direction is not getting smaller than 10e-4 but the solution till now changes only with the first decimal place. did you expect that? Thanks a lot idefix

 November 3, 2014, 19:00 #16 Senior Member   Joachim Herb Join Date: Sep 2010 Posts: 427 Rep Power: 13 Actually no. At the moment I do not have an idea what could cause this problem.

November 4, 2014, 12:42
#17
Senior Member

Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,807
Rep Power: 31
Hi,

my guess is: two parallel infinite planes are rather poor model of tube

I've decided to make fully 3D simulation of the described laminar case. Pressure drop is around 40 Pa. Rather high, maybe due to rather coarse mesh in X-direction.

You can find case files (mesh is in Gmsh format) and pressure colour profile attached to the message.

Also here's simpleFoam output (at the point where I've decided to stop simulation):

Code:
```...
Time = 218

DILUPBiCG:  Solving for Ux, Initial residual = 8.77581226583e-07, Final residual = 9.23550690215e-09, No Iterations 2
DILUPBiCG:  Solving for Uy, Initial residual = 3.83955671681e-05, Final residual = 1.96642296575e-07, No Iterations 2
DILUPBiCG:  Solving for Uz, Initial residual = 4.31920726089e-05, Final residual = 6.31032523367e-07, No Iterations 2
GAMG:  Solving for p, Initial residual = 3.79720211706e-06, Final residual = 3.77066594274e-07, No Iterations 141
GAMG:  Solving for p, Initial residual = 6.2556196152e-07, Final residual = 6.20062840895e-08, No Iterations 194
GAMG:  Solving for p, Initial residual = 1.54883049595e-07, Final residual = 1.52631870121e-08, No Iterations 151
time step continuity errors : sum local = 3.23088878426e-10, global = -1.41736741757e-12, cumulative = -2.60173230963e-07
ExecutionTime = 988.65 s  ClockTime = 989 s
...```
Attached Images
 pressure.png (17.1 KB, 54 views)
Attached Files
 tube-pressue-drop.tar.gz (4.9 KB, 41 views)

Last edited by alexeym; November 4, 2014 at 12:43. Reason: Addition

 November 12, 2014, 04:33 #18 Member   Join Date: Aug 2011 Posts: 83 Rep Power: 8 Hello, I tried a lot but still it doesnīt work. Unfortunately Iīve got some "bad looking" cells at the end of the pipe and also I donīt get such a nice velocity distribution as you have. I copied your whole case and just changed the mesh. The picture shows the mesh cut in the middle. Do you have any idea what I did wrong? Thanks a lot for your help

November 12, 2014, 04:34
#19
Member

Join Date: Aug 2011
Posts: 83
Rep Power: 8
here are the attached files
Attached Images
 pipe.jpg (13.7 KB, 53 views)
Attached Files
 tube.tar.gz (3.6 KB, 17 views)

November 12, 2014, 05:39
#20
Senior Member

Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,807
Rep Power: 31
Hi,

you should at least check your mesh before running case (and asking question ). Attached is a picture of the boundaries of the mesh in the attached case: green is outlet and red is walls. Well, at least inlet patch has correct geometry

Also to save computation time, try running simulation on 2D axisymmetric mesh (as anyway you're trying to check if simpleFoam will return pressure drop estimated from Darcy-Weisbach equation for circular tube).
Attached Images
 boundaries.png (9.7 KB, 52 views)

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Daniel_Khazaei OpenFOAM Running, Solving & CFD 16 May 5, 2016 07:08 preetam69 FLUENT 0 October 8, 2013 11:16 volo87 CFX 5 June 14, 2013 17:44 Brickman OpenFOAM Running, Solving & CFD 2 November 5, 2012 21:14 John FLUENT 2 August 19, 2011 00:42

All times are GMT -4. The time now is 23:51.