CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Problem verifying Hagen–Poiseuille flow in a Pipe (https://www.cfd-online.com/Forums/openfoam-solving/106505-problem-verifying-hagen-poiseuille-flow-pipe.html)

cp1287 August 30, 2012 13:05

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!

Goutam August 31, 2012 06:18

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

cp1287 August 31, 2012 14:06

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?

ngj August 31, 2012 14:24

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

cp1287 August 31, 2012 14:55

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!

akidess September 1, 2012 08:26

What does your mesh look like?

cp1287 September 2, 2012 04:27

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

cp1287 September 2, 2012 05:47

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,

ngj September 2, 2012 05:55

Hi

You would need to share your case, otherwise it is very hard to give any qualified response.

Kind regards,

Niels

akidess September 3, 2012 02:04

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.

Goutam September 3, 2012 06:41

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 !!!

himanshu28 April 25, 2017 19:57

Quote:

Originally Posted by Goutam (Post 379992)
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
outlet: zeroGradient
wall: Noslip

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

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


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