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.047e6. 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 
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. 
Quote:

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, 
Hi everyone for the replies. Let´s see:
Quote:
You mean in fvSchemes, in the divSchemes? You mean, instead of div(phi,U) Gauss upwind; i should try with linear? 
And,
Quote:
solvers { p { solver PCG; preconditioner DIC; tolerance 1e06; relTol 0.01; } i should change the tolerance for, let´s say, 1e07 ? Thanks a lot!!! 
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 10e7, 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! 
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, 
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.

Quote:
I will try with that scheme, and see what happens. Thanks a lot! 
Quote:
 Pressure at outlet should be fixedValue. Best, Alberto 
Quote:
(outlet patch is salida, sorry for the spanish) 
Quote:
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! 
Quote:
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/pipe3D_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 
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 μ=1E3 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.584e8 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. 
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); } } // ************************************************** *********************** // 
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((1A(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 1e08; 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 1e08; relTol 0.1; } nuTilda { solver smoothSolver; smoother GaussSeidel; nSweeps 2; tolerance 1e08; relTol 0.1; } } SIMPLE { nNonOrthogonalCorrectors 1; pRefCell 0; pRefValue 0; } relaxationFactors { default 0; p 0.3; U 0.7; nuTilda 0.7; } // ************************************************** *********************** // 
Also the residuals for the final steps >>
Time = 999 smoothSolver: Solving for Ux, Initial residual = 0.00059155, Final residual = 1.14422e05, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 0.000577205, Final residual = 1.06019e05, No Iterations 4 smoothSolver: Solving for Uz, Initial residual = 5.82043e06, Final residual = 1.12108e07, No Iterations 4 GAMG: Solving for p, Initial residual = 1.25485e07, Final residual = 6.79484e09, No Iterations 3 GAMG: Solving for p, Initial residual = 9.51563e09, Final residual = 9.51563e09, No Iterations 0 time step continuity errors : sum local = 3.59221e07, global = 2.41345e09, cumulative = 1.71276e05 ExecutionTime = 302.97 s ClockTime = 304 s Time = 1000 smoothSolver: Solving for Ux, Initial residual = 0.000587961, Final residual = 1.13731e05, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 0.000573677, Final residual = 1.05372e05, No Iterations 4 smoothSolver: Solving for Uz, Initial residual = 5.78361e06, Final residual = 1.11398e07, No Iterations 4 GAMG: Solving for p, Initial residual = 1.24755e07, Final residual = 6.75283e09, No Iterations 3 GAMG: Solving for p, Initial residual = 9.4657e09, Final residual = 9.4657e09, No Iterations 0 time step continuity errors : sum local = 3.57335e07, global = 2.44649e09, cumulative = 1.71301e05 ExecutionTime = 303.7 s ClockTime = 304 s End 
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.046e3*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.91358e06, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 0.000153262, Final residual = 3.60992e06, No Iterations 4 smoothSolver: Solving for Uz, Initial residual = 1.24232e06, Final residual = 3.12179e08, No Iterations 4 GAMG: Solving for p, Initial residual = 2.72346e08, Final residual = 4.86485e09, No Iterations 2 GAMG: Solving for p, Initial residual = 5.10714e09, Final residual = 5.10714e09, No Iterations 0 time step continuity errors : sum local = 5.6672e08, global = 4.12545e10, cumulative = 0.00149578 ExecutionTime = 354.72 s ClockTime = 355 s Time = 1000 smoothSolver: Solving for Ux, Initial residual = 0.000157434, Final residual = 3.88319e06, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 0.000152073, Final residual = 3.58192e06, No Iterations 4 smoothSolver: Solving for Uz, Initial residual = 1.23268e06, Final residual = 3.09756e08, No Iterations 4 GAMG: Solving for p, Initial residual = 2.70237e08, Final residual = 9.97178e09, No Iterations 1 GAMG: Solving for p, Initial residual = 1.0082e08, Final residual = 4.81098e09, No Iterations 1 time step continuity errors : sum local = 5.33856e08, global = 4.26169e10, cumulative = 0.00149578 ExecutionTime = 355.75 s ClockTime = 356 s End 
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 20:38. 