CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Numerical error or case error? Flow in a 3D pipe (https://www.cfd-online.com/Forums/openfoam/78942-numerical-error-case-error-flow-3d-pipe.html)

fsalvucci August 6, 2010 11:50

Numerical error or case error? Flow in a 3D pipe
 
4 Attachment(s)
Hi everyone! i´ve trying to find out what i am doing wrong, but still cant figure out. Hope someone can help, since im stucked and work is not advancing.
The thing is, i am runnig laminar, incompressible, steady flow through a 3D pipe. I´m setting as bounday conditions a pressure at the inlet and a pressure at the outlet, in order to compare with Poiseuille´s analytical solution.

Poiseuille predicts:

Umax = ((p2 - p1) * R^2)/(4 * mu* L)

Since my flow is incompressible (simpleFoam), i have to enter nu instead of mu, that in my case is nu = 3.047e-6. So, p2 and p1 i have to enter them as "kinematic pressures", that is p/rho. So, the equation could be also:

Umax = ((p2' - p1') * R^2)/(4* nu * L),

being p1' and p2' the respective kinematic pressures.

For may case (L = 0.04 m , R = 0.0015, (p2' - p1') = 0.026), the equation predicts Umax = 0.119 m/s.

The thing is that when i run the case, the flow developes but Umax of the parabola is 0.84 m/s.!!!!!

I have actually run the case for different values of L, R and nu, but the numerical resulta always underestimates the analytical solution.

I attach the images of my results, and the case, in case anyone wants to chek the configuration or even run the case and take a look. I could not include the mesh in "constant" since it was too heavy and couldnt upload it. It is a simple 3D pipe with L = 0.04 and R = 0.0015)

Thanks very much nad hope someone could help me!!

Regard,

Fernando

l_r_mcglashan August 6, 2010 14:47

Have you tried refining your mesh?

You're using upwind on velocity, try using linear or GammaV, or anything higher order.

Not too sure about your boundary conditions either.

msrinath80 August 6, 2010 19:05

Quote:

Originally Posted by fsalvucci (Post 270576)
Hi everyone! i´ve trying to find out what i am doing wrong, but still cant figure out. Hope someone can help, since im stucked and work is not advancing.
The thing is, i am runnig laminar, incompressible, steady flow through a 3D pipe. I´m setting as bounday conditions a pressure at the inlet and a pressure at the outlet, in order to compare with Poiseuille´s analytical solution.

Poiseuille predicts:

Umax = ((p2 - p1) * R^2)/(4 * mu* L)

Since my flow is incompressible (simpleFoam), i have to enter nu instead of mu, that in my case is nu = 3.047e-6. So, p2 and p1 i have to enter them as "kinematic pressures", that is p/rho. So, the equation could be also:

Umax = ((p2' - p1') * R^2)/(4* nu * L),

being p1' and p2' the respective kinematic pressures.

For may case (L = 0.04 m , R = 0.0015, (p2' - p1') = 0.026), the equation predicts Umax = 0.119 m/s.

The thing is that when i run the case, the flow developes but Umax of the parabola is 0.84 m/s.!!!!!

I have actually run the case for different values of L, R and nu, but the numerical resulta always underestimates the analytical solution.

I attach the images of my results, and the case, in case anyone wants to chek the configuration or even run the case and take a look. I could not include the mesh in "constant" since it was too heavy and couldnt upload it. It is a simple 3D pipe with L = 0.04 and R = 0.0015)

Thanks very much nad hope someone could help me!!

Regard,

Fernando

Paraview is reporting 0.084 m/s NOT 0.84 m/s. Perform some additional refinement near the walls and tighten the pressure tolerances and all will be well :)

alberto August 8, 2010 20:46

In Poiseuille flow in a cylindrical pipe, the velocity is

U(r) = 2*Umean(1-(r/R)^2)

being Umax = 2*Umean, and being Umean the velocity you specify at a uniform inlet. No need to go through pressure drops :-)

Simply set the inlet at Umean, and you will get a perfectly parabolic profile if the pipe is long enough. Keep in mind that you must be at least at 10 diameters from the inlet and the outlet to obtain a fully developed flow.

Best,

fsalvucci August 9, 2010 10:53

Hi everyone for the replies. Let´s see:

Quote:

Originally Posted by l_r_mcglashan (Post 270604)
Have you tried refining your mesh?

You're using upwind on velocity, try using linear or GammaV, or anything higher order.

Not too sure about your boundary conditions either.


You mean in fvSchemes, in the divSchemes? You mean, instead of div(phi,U) Gauss upwind; i should try with linear?

fsalvucci August 9, 2010 10:55

And,

Quote:

Originally Posted by msrinath80 (Post 270615)
Paraview is reporting 0.084 m/s NOT 0.84 m/s. Perform some additional refinement near the walls and tighten the pressure tolerances and all will be well :)

Yes, i typed it wrong. When you say "tighten the pressure tolerances", you mean, in fvSolution, in

solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.01;
}


i should change the tolerance for, let´s say, 1e-07 ?

Thanks a lot!!!

fsalvucci August 18, 2010 16:50

Hi everyone! Still with this problem.

I refined the mesh a lot. Still the Umax value is underestimated.

I changed in the fvSchemes, the scheme for divergence to:
div(phi,U) Gauss linear;
The simulation doesnt converge and U values go to 10e+8 m/s.

I tightened the p tolerance to 10e-7, still the Umax value is underestimated.

Anyone has a clue on what´s happening? If you want to check my case settings, i have attached it in a previous post.

Thanks!

alberto August 18, 2010 18:51

Please make the case available, or it is impossible to see what is wrong.

P.S. I would use div(phi, U) Gauss limitedLinearV 1;
Your mesh is probably not fine enough to satisfy the stability criterion required by the linear scheme.

Best,

l_r_mcglashan August 19, 2010 04:54

1 Attachment(s)
When I first started with CFD I did a laminar pipe flow (don't we all). Provided the case is set up properly, the two things to watch out for are mesh density and to make sure you are using a second order discretisation scheme on velocity. I've attached a graph showing the importance of mesh density.

fsalvucci August 19, 2010 08:52

Quote:

Originally Posted by alberto (Post 271947)
Please make the case available, or it is impossible to see what is wrong.

P.S. I would use div(phi, U) Gauss limitedLinearV 1;
Your mesh is probably not fine enough to satisfy the stability criterion required by the linear scheme.

Best,

Look up, at the begginig of the post, i attach the pipe-3D file with the case. The mesh is too big to be attached.

I will try with that scheme, and see what happens. Thanks a lot!

alberto August 19, 2010 10:28

Quote:

Originally Posted by fsalvucci (Post 272014)
Look up, at the begginig of the post, i attach the pipe-3D file with the case. The mesh is too big to be attached.

- In the case there is no mesh => impossible to check it :)
- Pressure at outlet should be fixedValue.

Best,
Alberto

fsalvucci August 19, 2010 10:55

Quote:

Originally Posted by alberto (Post 272035)
- - Pressure at outlet should be fixedValue.

It is actually fixedValue 0;

(outlet patch is salida, sorry for the spanish)

fsalvucci August 19, 2010 13:26

Quote:

Originally Posted by l_r_mcglashan (Post 271977)
When I first started with CFD I did a laminar pipe flow (don't we all). Provided the case is set up properly, the two things to watch out for are mesh density and to make sure you are using a second order discretisation scheme on velocity. I've attached a graph showing the importance of mesh density.

Ok, lets assume the case is correctly set up, and that mesh density is quite good (the mesh consists of 1,300,000 elements, the geometry is a pipe of 0.08 m lenght and 0.0015 m radius), the thing would be to choose a correct second order scheme for U, right?

The div(phi,U) scheme i was using was upwind. You mean that i should use another scheme? for example, the one that alberto suggests:

div(phi, U) Gauss limitedLinearV 1;

I´m running the simulation now with that scheme, ill se what happens.
What other suggestion canyou make me? Another scheme? Anything else?
Thanks a lot!

alberto August 19, 2010 17:19

Quote:

Originally Posted by fsalvucci (Post 272036)
It is actually fixedValue 0;

(outlet patch is salida, sorry for the spanish)

Sorry, I confused p and U files. :(

I do not think the setup is correct, since you solve for an incompressible flow and you force the pressure at both inlet and outlet.

Also, if you check the residuals your case does not converge.

A proper setup would be to specify the velocity at the inlet and the pressure at the outlet, as in the case I run, which is equivalent to yours, and gives the exact result for the radial velocity profile (the mesh is much less refined than yours).

http://dl.dropbox.com/u/659842/pipe-3D_UInlet.tar.gz

If you do not want to use this setup, then your case is analogous to a periodic pipe with a fixed forcing term in the momentum equation, where inlet and outlet are replaced by cyclic conditions, and your UEqn is modified to include the forcing term.

Best,
Alberto

fivos August 20, 2010 08:03

3 Attachment(s)
Dear Fernando,

I took a look into OpenFOAM simpleFoam solver for a similar case to the one you describe. I set up a 3d pipe with D = 0.001 m, L =0.01 m and set a pressure difference of 0.032 m2/s2 (kinematic pressure, real pressure 32 Pa assuming water with ρ= 1000kg/m3).

Expected Umean= (R^2 * Δp ) / (8 * μ * L ) = 0.1 m/sec (for water dynamic viscosity μ=1E-3 Pa.s) and expected Reynolds 100. Expected Umax = 2 * Umean = 0.2 m/sec

For the mesh : element size 0.00005 m (~20 elements on diameter), see also attached figure (mesh.png).

Turbulence is turned off in the RASproperties, but a laminar model is used as a RASModel.

Take a look at the calculated results below >

Calculated max velocity 0.198m/sec
Calculated vol. flow through inlet/outlet : 7.584e-8 m3/sec (see in the velocity.png at the table below the results window the integration of velocity U over the inlet surface, the third component). This means that there is an average velocity of 0.09656m/sec (close to the theoretical 0.1m/sec).

Those results were obtained after 1000 iterations.

A better mesh and more iterations might give better results.

fivos August 20, 2010 08:05

Boundary conditions >

p file

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
outlet
{
type fixedValue;
value uniform 0 ;
}
Inlet
{
type fixedValue;
value uniform 0.032 ;
}
wall.2
{
type zeroGradient;
}
}

// ************************************************** *********************** //

U file

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
outlet
{
type zeroGradient;
}
Inlet
{
type zeroGradient;
}
wall.2
{
type fixedValue;
value uniform (0 0 0);
}
}

// ************************************************** *********************** //

fivos August 20, 2010 08:08

Finally
- controlDict >

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application simpleFoam;

startFrom latestTime;

startTime 0;

stopAt endTime;

endTime 1000;

deltaT 1;

writeControl timeStep;

writeInterval 200;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;


// ************************************************** *********************** //

- fvSchemes >

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
default steadyState;
}

gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
grad(U) Gauss linear;
}

divSchemes
{
default none;
div(phi,U) Gauss linearUpwind Gauss linear;
div(phi,nuTilda) Gauss linearUpwind Gauss linear;
div((nuEff*dev(grad(U).T()))) Gauss linear;
}

laplacianSchemes
{
default none;
laplacian(nuEff,U) Gauss linear corrected;
laplacian((1|A(U)),p) Gauss linear corrected;
laplacian(DnuTildaEff,nuTilda) Gauss linear corrected;
laplacian(1,p) Gauss linear corrected;
}

interpolationSchemes
{
default linear;
interpolate(U) linear;
}

snGradSchemes
{
default corrected;
}

fluxRequired
{
default no;
p ;
}


// ************************************************** *********************** //


- and fvSolution >

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
p
{
solver GAMG;
tolerance 1e-08;
relTol 0.1;
smoother GaussSeidel;
nPreSweeps 1;
nPostSweeps 2;
cacheAgglomeration true;
nCellsInCoarsestLevel 10;
agglomerator faceAreaPair;
mergeLevels 1;
}

U
{
solver smoothSolver;
smoother GaussSeidel;
nSweeps 2;
tolerance 1e-08;
relTol 0.1;
}

nuTilda
{
solver smoothSolver;
smoother GaussSeidel;
nSweeps 2;
tolerance 1e-08;
relTol 0.1;
}
}

SIMPLE
{
nNonOrthogonalCorrectors 1;
pRefCell 0;
pRefValue 0;
}

relaxationFactors
{
default 0;
p 0.3;
U 0.7;
nuTilda 0.7;
}


// ************************************************** *********************** //

fivos August 20, 2010 08:15

Also the residuals for the final steps >>

Time = 999

smoothSolver: Solving for Ux, Initial residual = 0.00059155, Final residual = 1.14422e-05, No Iterations 4
smoothSolver: Solving for Uy, Initial residual = 0.000577205, Final residual = 1.06019e-05, No Iterations 4
smoothSolver: Solving for Uz, Initial residual = 5.82043e-06, Final residual = 1.12108e-07, No Iterations 4
GAMG: Solving for p, Initial residual = 1.25485e-07, Final residual = 6.79484e-09, No Iterations 3
GAMG: Solving for p, Initial residual = 9.51563e-09, Final residual = 9.51563e-09, No Iterations 0
time step continuity errors : sum local = 3.59221e-07, global = -2.41345e-09, cumulative = -1.71276e-05
ExecutionTime = 302.97 s ClockTime = 304 s

Time = 1000

smoothSolver: Solving for Ux, Initial residual = 0.000587961, Final residual = 1.13731e-05, No Iterations 4
smoothSolver: Solving for Uy, Initial residual = 0.000573677, Final residual = 1.05372e-05, No Iterations 4
smoothSolver: Solving for Uz, Initial residual = 5.78361e-06, Final residual = 1.11398e-07, No Iterations 4
GAMG: Solving for p, Initial residual = 1.24755e-07, Final residual = 6.75283e-09, No Iterations 3
GAMG: Solving for p, Initial residual = 9.4657e-09, Final residual = 9.4657e-09, No Iterations 0
time step continuity errors : sum local = 3.57335e-07, global = -2.44649e-09, cumulative = -1.71301e-05
ExecutionTime = 303.7 s ClockTime = 304 s

End

fivos August 20, 2010 08:56

1 Attachment(s)
A final post :

I scaled my geometry x 3 for all dimensions, so I would get R = 0.0015m and L = 0.03m.
I tried again with Δp'=0.026m2/s2 kinematic pressure, or 26Pa pressure. Expected mean velocity : 0.0015^2*26/(8 * 3.046e-3*0.03) = 0.08m/sec and max velocity 0.16.

Results calculated by OpenFoam are again OK (controlDict, fvShemes and fvSolution the same as before), see below.

Final residuals >

Time = 999

smoothSolver: Solving for Ux, Initial residual = 0.000158666, Final residual = 3.91358e-06, No Iterations 4
smoothSolver: Solving for Uy, Initial residual = 0.000153262, Final residual = 3.60992e-06, No Iterations 4
smoothSolver: Solving for Uz, Initial residual = 1.24232e-06, Final residual = 3.12179e-08, No Iterations 4
GAMG: Solving for p, Initial residual = 2.72346e-08, Final residual = 4.86485e-09, No Iterations 2
GAMG: Solving for p, Initial residual = 5.10714e-09, Final residual = 5.10714e-09, No Iterations 0
time step continuity errors : sum local = 5.6672e-08, global = -4.12545e-10, cumulative = -0.00149578
ExecutionTime = 354.72 s ClockTime = 355 s

Time = 1000

smoothSolver: Solving for Ux, Initial residual = 0.000157434, Final residual = 3.88319e-06, No Iterations 4
smoothSolver: Solving for Uy, Initial residual = 0.000152073, Final residual = 3.58192e-06, No Iterations 4
smoothSolver: Solving for Uz, Initial residual = 1.23268e-06, Final residual = 3.09756e-08, No Iterations 4
GAMG: Solving for p, Initial residual = 2.70237e-08, Final residual = 9.97178e-09, No Iterations 1
GAMG: Solving for p, Initial residual = 1.0082e-08, Final residual = 4.81098e-09, No Iterations 1
time step continuity errors : sum local = 5.33856e-08, global = -4.26169e-10, cumulative = -0.00149578
ExecutionTime = 355.75 s ClockTime = 356 s

End

fsalvucci August 20, 2010 09:04

Well, i would like to thank you all very much for tour corncern and your replies.
I ´m running now my case with 1500 iterations instead of 800 as i did before, with the div scheme suggested (limitedLinearV 1), and i´ll see what happens. If it still doenst reach the steady state analytical solution, i will try with the setup fivos is suggesting.

So, ill write again in a couple of hours telling you what has happended.

Thank you all!!!!


All times are GMT -4. The time now is 21:32.