# Problem verifying Hagen–Poiseuille flow in a Pipe

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

 August 30, 2012, 13:05 Problem verifying Hagen–Poiseuille flow in a Pipe #1 New Member   Join Date: Aug 2012 Posts: 5 Rep Power: 7 Hello everyone, I am trying to model Hagen–Poiseuille flow in a pipe of circular cross section with a radius of 0.1m . The pipe is 1m long and the pressure difference applied is one Pa. The viscosity is set to 0.01. From the theory I would expect a parabolic velocity profile (which is correctly computed). With a maxmal velocity of 0.25 m/s in the center. Open Foam computes the maximal velocity as 0.15 m/s. I tried different boundary conditions but that changed the velocity values only slightly. I also used the same mesh in ELMER FEM were I computed the correct velocity of 0.25 m/s. The initial conditions are as follows: for p: FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { Wall { type zeroGradient; } In { type fixedValue; value 1; } Out { type fixedValue; value 0; } } // ************************************************** *********************** // and U: --*/ FoamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { Wall { type fixedValue; value uniform (0 0 0); } In { type pressureInletVelocity; value uniform (0 0 0); } Out { type zeroGradient; } } // ************************************************** *********************** // the transport properties read: FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object transportProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // nu nu [ 0 2 -1 0 0 0 0 ] 0.01; // ************************************************** *********************** // The rest is taken from the icoFoam lid driven cavity example. I hope somebody knows the answer to this problem. Thank you!

 August 31, 2012, 06:18 #2 Senior Member   Goutam Saha Join Date: Dec 2011 Location: UK Posts: 131 Rep Power: 7 Its better to use coded fixed value Bcs or Groovy BC options at the inlet where you can set the parabolic velocity profile i.e. u(r) = 2 U_mean [ 1 - (r/R)^2 ] where U_mean = neu * Re / D. So, flow will be fully developed from inlet to outlet and you will get the correct results. Thanks

 August 31, 2012, 14:06 #3 New Member   Join Date: Aug 2012 Posts: 5 Rep Power: 7 Hello Goutam, thank you for your reply. I already experimented with different boundary conditions. My intitial conditions were: FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { Wall { type zeroGradient; } In { type fixedValue; value uniform 1; } Out { type fixedValue; value uniform 0; } } // ************************************************** *********************** // FoamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { Wall { type fixedValue; value uniform (0 0 0); } In { type zeroGradient; } Out { type zeroGradient; } } // ************************************************** *********************** // I assumed these conditions are reasonable and started with this setting. Only after getting the wrong results I experimented with different boundary conditions but all the results are far of the analytic solution. The above intitial conditions give a maximum velocity of 0.152 instead of 0.15 when using the intial conditions from my first post. So yes their is a small influence from the boundary but the error has to be somewhere else. I also made an interesting observation: When I reduce the diameter by a factor of two I also reduce the error (from 40%) by a factor of two (to 20%). Any other suggestions?

 August 31, 2012, 14:24 #4 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,758 Rep Power: 29 Hi Please note that unless you use the density of air as being 1 kg/m3, then the pressure difference is not 1 Pa. You have given a pressure difference of 1 m2/s2, because you are using a solver, which is normalised by rho. This also means that the viscosity is the kinematic one and not the dynamic one. Kind regards, Niels vs1 likes this.

 August 31, 2012, 14:55 #5 New Member   Join Date: Aug 2012 Posts: 5 Rep Power: 7 Hi Niels, thank you for your reply. Yes, I know that Open Foam renormalizes the presure For that purpose I used the hagen-poiseuille equation with the kinematic viscosity. In the computation I did with ELMER FEM, I used a density of 1 and also a viscosity of 0.01 so either way the analytic solution, ELMER and OpenFoam should compute the same velocity in the center of the pipe. Elmer agrees to less than 1% to the analytic solution but OpenFoam is way of (40% resp. 20% depending on the pipe diameter). Regards!

 September 1, 2012, 08:26 #6 Senior Member     Anton Kidess Join Date: May 2009 Location: Germany Posts: 1,264 Rep Power: 23 What does your mesh look like? __________________ *On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer.

 September 2, 2012, 04:27 #7 New Member   Join Date: Aug 2012 Posts: 5 Rep Power: 7 I used a 3D unstructured tetraeder mesh. I tried different resolution but the change was very small.

 September 2, 2012, 05:47 #8 New Member   Join Date: Aug 2012 Posts: 5 Rep Power: 7 I think the problem is linked to the unstructured mesh. I did some further experiments on a pipe with a rectangular cross section. If I discretize the pipe with tetraeder (even with high resolution) I get around 10% deviation in the velocity computed by ELMER FEM and simpleFoam. If I model the brick-pipe with blockMesh, the ELMER FEM and simpleFoam results are virtually identical (less than 0.1% deviation). Is this a known openFoam issue? Or am I doing something wrong with the unstructured mesh in OpenFoam? Best Regards,

 September 2, 2012, 05:55 #9 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,758 Rep Power: 29 Hi You would need to share your case, otherwise it is very hard to give any qualified response. Kind regards, Niels

 September 3, 2012, 02:04 #10 Senior Member     Anton Kidess Join Date: May 2009 Location: Germany Posts: 1,264 Rep Power: 23 This is not an issue with OpenFOAM, but with finite volumes in general - the discretization error converges much faster with orthogonal meshes. Are you sure you've reached mesh independence even on the grid you call very fine? You should take that one, double the cell count and then compare. __________________ *On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer.

 September 3, 2012, 06:41 #11 Senior Member   Goutam Saha Join Date: Dec 2011 Location: UK Posts: 131 Rep Power: 7 Where you set your inlet velocity !!! You can use the following coded BC: FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { inlet { type zeroGradient; } outlet { type fixedValue; value uniform 0; } Walls { type zeroGradient; } } --------------------------- FoamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inlet { type codedFixedValue; value \$internalField; redirectType ramp; code #{ scalar U_0=Your_Umean; scalar r=Your_Radius; fixedValueFvPatchVectorField myPatch(*this); forAll(this->patch().Cf(),i) { myPatch[i]=vector(2*U_0*(1-Foam:Pow(this->patch().Cf()[i].x(),2)/pow(r,2)),0,0); } operator==(myPatch); #}; } outlet { type zeroGradient; } Walls { type fixedValue; value uniform (0 0 0); } } You can use coded Boundary condition given above. Its better to share you file here so we can understand the problem. Otherwise its really difficult to understand your problem !!! Best of Luck. Cheers !!! vs1 likes this.

April 25, 2017, 19:57
#12
Senior Member

Himanshu Sharma
Join Date: Jul 2012
Posts: 101
Rep Power: 7
Quote:
 Originally Posted by Goutam Where you set your inlet velocity !!! You can use the following coded BC: FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { inlet { type zeroGradient; } outlet { type fixedValue; value uniform 0; } Walls { type zeroGradient; } } --------------------------- FoamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inlet { type codedFixedValue; value \$internalField; redirectType ramp; code #{ scalar U_0=Your_Umean; scalar r=Your_Radius; fixedValueFvPatchVectorField myPatch(*this); forAll(this->patch().Cf(),i) { myPatch[i]=vector(2*U_0*(1-Foam:Pow(this->patch().Cf()[i].x(),2)/pow(r,2)),0,0); } operator==(myPatch); #}; } outlet { type zeroGradient; } Walls { type fixedValue; value uniform (0 0 0); } } You can use coded Boundary condition given above. Its better to share you file here so we can understand the problem. Otherwise its really difficult to understand your problem !!! Best of Luck. Cheers !!!
Hi Goutam,

I am trying to verify same Hagen-pipe flow problem with analytical results.
In the step you have shared consist of velocity BC at the inlet as a parabolic profile.
But What if one likes to put pressure Boundary conditions at the inlet since Hagen flow is basically pressure driven flow.
I am doing a 2D case where,
Velocity:
inlet: PressureInletVelocity
wall: Noslip

Pressure:
inlet: fixed value 20 pa
outlet: fixed value 0 pa

L = 0.15 m, D =0.00635m

if you use the following relation on the link (https://en.wikipedia.org/wiki/Hagen%...okes_equations) to compute the Uavg velocity it will come out to be 0.168 m/s

I am using IcoFoam solver for running till finalTime = 10 sec . and even after running for such a longer time with dt = 0.001 the solution is no where close to analytical results.

The problem is pretty much the same what the heading of this thread says.
Not able to verify the Hagen flow. let me know if something is wrong with the BC.

Edit:
I figured of out the problem, if you apply pressure gradient in case of 2D then you are solving the flow driven between two Flat plates. To simulate pipe one need to consider a wedge of a pipe or a complete 3D simulations of pipe in OpenFoam. If one need to solve in 2D pipe flow then radial coordinate equations should be consider, I don't think that is possible with OF.
To validate pressure driven pipe flow , I apply the pressure conditions on the 3D Pipe and I am getting the results close to the analytical results for the pipeFlow.

Thanks

Last edited by himanshu28; April 27, 2017 at 13:27. Reason: Problem Resolved

 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 Min FLUENT 6 January 31, 2017 15:28 Sachin U. Nimbalkar FLUENT 5 December 22, 2016 02:34 CRT FLUENT 0 July 20, 2012 13:03 keng Main CFD Forum 1 March 5, 2010 11:40 Tom Cloutier Main CFD Forum 0 April 20, 2003 13:19

All times are GMT -4. The time now is 20:14.