Problem verifying Hagen–Poiseuille flow in a Pipe
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! 
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 
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? 
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 
Hi Niels,
thank you for your reply. Yes, I know that Open Foam renormalizes the presure:) For that purpose I used the hagenpoiseuille 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! 
What does your mesh look like?

I used a 3D unstructured tetraeder mesh. I tried different resolution but the change was very small.

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 brickpipe 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, 
Hi
You would need to share your case, otherwise it is very hard to give any qualified response. Kind regards, Niels 
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.

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*(1Foam: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 !!! 
All times are GMT 4. The time now is 11:08. 