
[Sponsors] 
October 12, 2013, 17:37 
simpleFoam convergance problem

#1 
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
Sponsored Links
I am trying to simulate a simple problem which includes a single straight pipe. The flow is laminar and incompressible (steady state). As for the boundary condition, I am using: inlet: pressureInlet 1333.2 Pa outlet: pressureOutlet 0 Pa I can easily get convergence on fluent in a minute. (residual order 1e6) Now when I try the same case in OpenFOAM (same mesh), it gives me a hard time to converge, as I think its going to take even a day to reach convergence tolerance.(simpleFoam solver) here is my case setup in OpenFOAM ( the case is attached): Boundary condition: Code:
/** C++ **\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 1.5dev   \\ / A nd  Revision: 1736   \\/ M anipulation  Web: http://www.OpenFOAM.org  \**/ FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 2 0 0 0 0]; internalField uniform 0; boundaryField { FSI { type zeroGradient; } OUTLET { type fixedValue; value uniform 0; } INLET { type fixedValue; value uniform 1333.2; } } // ************************************************************************* // Code:
/** C++ **\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 1.5dev   \\ / A nd  Revision: 1736   \\/ M anipulation  Web: http://www.OpenFOAM.org  \**/ FoamFile { version 2.0; format ascii; class volVectorField; location "0"; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { FSI { type fixedValue; value uniform (0 0 0); } OUTLET { type zeroGradient; } INLET { type zeroGradient; } } // ************************************************************************* // Code:
/**\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 1.3   \\ / A nd  Web: http://www.openfoam.org   \\/ M anipulation   \**/ FoamFile { version 2.0; format ascii; root ""; case ""; instance ""; local ""; class dictionary; object fvSchemes; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ddtSchemes { default steadyState; } gradSchemes { default cellMDLimited Gauss linear 0.5; grad(p) cellMDLimited Gauss linear 0.5; } divSchemes { default none; div(phi,U) Gauss linearUpwindV cellMDLimited Gauss linear 0.5; div((nuEff*dev(grad(U).T()))) Gauss linear corrected; } laplacianSchemes { default Gauss linear limited 0.5; } interpolationSchemes { default linear; interpolate(U) linear; } snGradSchemes { default limited 0.5; } fluxRequired { default no; p; } // ************************************************************************* // Am I missing something obvious in OpenFOAM setup? you can download the case here: http://www.rodfile.com/w4xt9xwxesqo thank in advance regards 

Sponsored Links 
October 13, 2013, 13:52 

#2 
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
Residual plots have been attached.


October 14, 2013, 07:52 

#3 
Member
Artem Shaklein
Join Date: Feb 2010
Location: Russia, Izhevsk
Posts: 43
Rep Power: 9 
Hello, Daniel.
I haven't calculated the right value of friction and corresponding velocity. But I calculate max velocity restricted by laminar conditions (Re ~2000). So, velocity is about 0.6 m/s. I set this velocity as INLET boundary condition,with p=0 being set up at OUTLET, and I get average pressure at INLET about 0.1324 Pa. Looks similar to your value * 10^4. May be there is some mistake in physical settings used? 

October 14, 2013, 14:49 

#4  
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
Quote:
but in incompressible solvers, its actually p/rho, so I should have used the value of 1.3332 instead of 1333.2  Now the only problem is that p does not go lower than a specific value (order of 10^3), while the residual of U is acceptable (10^8). However, the result is the same as fluent. 

October 15, 2013, 04:42 

#5 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 20 
Can you show us the fvSolutionfile?
__________________
The skeleton ran out of shampoo in the shower. 

October 15, 2013, 05:57 

#6 
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
yes, here you are:
Code:
/** C++ **\  =========    \\ / F ield  OpenFOAM Extend Project: Open Source CFD   \\ / O peration  Version: 1.6ext   \\ / A nd  Web: www.extendproject.de   \\/ M anipulation   \**/ FoamFile { version 2.0; format ascii; class dictionary; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { p { solver PCG; preconditioner DIC; tolerance 1e06; relTol 0.01; }; U { solver PBiCG; preconditioner DILU; tolerance 1e05; relTol 0.1; }; } SIMPLE { nNonOrthogonalCorrectors 2; } relaxationFactors { p 0.3; U 0.7; } // ************************************************************************* // By the way, is there anyway to use a step function (function of time) as a boundary condition? 

October 15, 2013, 06:14 

#7 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 20 
Some ideas:
1) In gnuplot use "plot ... using ... every 3 ..." to get an accurate residual plot of your pressure. If you use 2 orthogonal correctors, you have 3 pressure values each iteration. You just want the first one to be plotted. Then, you can also plot all variables (u,p) in the same windows. 2) Are you sure this is the correct syntax for the relaxation factors? I always use: Code:
relaxationFactors { fields { "p.*" 0.3; "nuSgs.*" 0.5; } equations { "U.*" 0.8; "k.*" 0.8; "omega.*" 0.8; } } 2) Did you try to use a lower "relTol" for the pressure? Maybe you should use GAMG solver for "p" to save some time. 3) What numerical settings (discretization) did you use in Fluent? When I was comparing Fluent and OpenFoam it was always the case, that Fluent converges easily while OpenFoam had problems. Using limiters and bounding schemes at every possible location solved the problems. This lead me to the assumption that Fluent does the same...
__________________
The skeleton ran out of shampoo in the shower. 

October 15, 2013, 11:55 

#8  
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
Quote:
1) Thanks for the tip man now the life is easier 2) I think the difference we are seeing here is because of different versions of OpenFOAM ( I am using 1.6ext) 3) Well GAMG is just faster in my case and does not help the convergence, not yet I will try to apply your suggestion. 3) in fluent: second order for pressure and second order upwind for momentum. I have already tested cellMDLimited and cellLimited schemes, is there any other schemes that you have tried? 

October 15, 2013, 15:19 

#9 
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
well I have tested several options, but as you can see in the log file, pressure initial residual does change any more, could something be wrong with my mesh?
Code:
Time = 0.0199 DILUPBiCG: Solving for Ux, Initial residual = 0.00024647, Final residual = 1.10217e07, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 0.000111814, Final residual = 1.58072e06, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 0.000111592, Final residual = 1.57813e06, No Iterations 1 GAMG: Solving for p, Initial residual = 0.0106645, Final residual = 7.35506e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.010268, Final residual = 7.64759e05, No Iterations 4 time step continuity errors : sum local = 1.40317e07, global = 1.63051e08, cumulative = 0.00461193 ExecutionTime = 39.56 s ClockTime = 40 s Time = 0.02 DILUPBiCG: Solving for Ux, Initial residual = 0.000231742, Final residual = 1.03637e07, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 0.000105065, Final residual = 1.4862e06, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 0.000104864, Final residual = 1.48377e06, No Iterations 1 GAMG: Solving for p, Initial residual = 0.0106366, Final residual = 7.3698e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.0102653, Final residual = 7.64477e05, No Iterations 4 time step continuity errors : sum local = 1.40306e07, global = 1.63289e08, cumulative = 0.00461194 ExecutionTime = 40.2 s ClockTime = 41 s Time = 0.0201 DILUPBiCG: Solving for Ux, Initial residual = 0.000217894, Final residual = 9.74417e08, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 9.87491e05, Final residual = 1.39652e06, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 9.85661e05, Final residual = 1.39436e06, No Iterations 1 GAMG: Solving for p, Initial residual = 0.0106104, Final residual = 7.38322e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.0102628, Final residual = 7.64237e05, No Iterations 4 time step continuity errors : sum local = 1.403e07, global = 1.63521e08, cumulative = 0.00461196 ExecutionTime = 40.38 s ClockTime = 41 s Time = 0.0202 DILUPBiCG: Solving for Ux, Initial residual = 0.000204872, Final residual = 9.1616e08, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 9.28788e05, Final residual = 1.31221e06, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 9.27076e05, Final residual = 1.31033e06, No Iterations 1 GAMG: Solving for p, Initial residual = 0.0105859, Final residual = 7.39572e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.0102604, Final residual = 7.64029e05, No Iterations 4 time step continuity errors : sum local = 1.40297e07, global = 1.63755e08, cumulative = 0.00461198 ExecutionTime = 40.57 s ClockTime = 41 s Time = 0.0203 DILUPBiCG: Solving for Ux, Initial residual = 0.000192629, Final residual = 8.61439e08, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 8.74158e05, Final residual = 1.23364e06, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 8.72505e05, Final residual = 1.232e06, No Iterations 1 GAMG: Solving for p, Initial residual = 0.0105629, Final residual = 7.40766e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.0102582, Final residual = 7.63834e05, No Iterations 4 time step continuity errors : sum local = 1.40295e07, global = 1.63987e08, cumulative = 0.00461199 ExecutionTime = 40.76 s ClockTime = 41 s Time = 0.0204 DILUPBiCG: Solving for Ux, Initial residual = 0.000181116, Final residual = 8.10066e08, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 8.22841e05, Final residual = 1.16056e06, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 8.21225e05, Final residual = 1.15904e06, No Iterations 1 GAMG: Solving for p, Initial residual = 0.0105413, Final residual = 7.41916e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.0102561, Final residual = 7.63641e05, No Iterations 4 time step continuity errors : sum local = 1.40292e07, global = 1.64205e08, cumulative = 0.00461201 ExecutionTime = 40.95 s ClockTime = 41 s Time = 0.0205 DILUPBiCG: Solving for Ux, Initial residual = 0.00017029, Final residual = 7.61809e08, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 7.74076e05, Final residual = 1.09227e06, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 7.72516e05, Final residual = 1.09076e06, No Iterations 1 GAMG: Solving for p, Initial residual = 0.0105211, Final residual = 7.43008e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.0102542, Final residual = 7.63447e05, No Iterations 4 time step continuity errors : sum local = 1.40286e07, global = 1.644e08, cumulative = 0.00461203 ExecutionTime = 41.14 s ClockTime = 42 s Time = 0.0206 DILUPBiCG: Solving for Ux, Initial residual = 0.000160109, Final residual = 7.16425e08, No Iterations 2 DILUPBiCG: Solving for Uy, Initial residual = 7.27476e05, Final residual = 1.02781e06, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 7.26005e05, Final residual = 1.02631e06, No Iterations 1 GAMG: Solving for p, Initial residual = 0.0105021, Final residual = 7.44023e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.0102523, Final residual = 7.63259e05, No Iterations 4 time step continuity errors : sum local = 1.40279e07, global = 1.64572e08, cumulative = 0.00461204 ExecutionTime = 41.33 s ClockTime = 42 s . . . . . Time = 0.0838 DILUPBiCG: Solving for Ux, Initial residual = 4.71877e10, Final residual = 4.71877e10, No Iterations 0 DILUPBiCG: Solving for Uy, Initial residual = 1.72695e10, Final residual = 1.72695e10, No Iterations 0 DILUPBiCG: Solving for Uz, Initial residual = 1.72301e10, Final residual = 1.72301e10, No Iterations 0 GAMG: Solving for p, Initial residual = 0.0102061, Final residual = 7.59525e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.0102235, Final residual = 7.60813e05, No Iterations 4 time step continuity errors : sum local = 1.40268e07, global = 1.67351e08, cumulative = 0.00462262 ExecutionTime = 151.43 s ClockTime = 153 s Time = 0.0839 DILUPBiCG: Solving for Ux, Initial residual = 4.64124e10, Final residual = 4.64124e10, No Iterations 0 DILUPBiCG: Solving for Uy, Initial residual = 1.69857e10, Final residual = 1.69857e10, No Iterations 0 DILUPBiCG: Solving for Uz, Initial residual = 1.69469e10, Final residual = 1.69469e10, No Iterations 0 GAMG: Solving for p, Initial residual = 0.0102061, Final residual = 7.59525e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.0102235, Final residual = 7.60813e05, No Iterations 4 time step continuity errors : sum local = 1.40268e07, global = 1.67351e08, cumulative = 0.00462263 ExecutionTime = 151.61 s ClockTime = 154 s Time = 0.084 DILUPBiCG: Solving for Ux, Initial residual = 4.56497e10, Final residual = 4.56497e10, No Iterations 0 DILUPBiCG: Solving for Uy, Initial residual = 1.67066e10, Final residual = 1.67066e10, No Iterations 0 DILUPBiCG: Solving for Uz, Initial residual = 1.66685e10, Final residual = 1.66685e10, No Iterations 0 GAMG: Solving for p, Initial residual = 0.0102061, Final residual = 7.59525e05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.0102235, Final residual = 7.60813e05, No Iterations 4 time step continuity errors : sum local = 1.40268e07, global = 1.67351e08, cumulative = 0.00462265 ExecutionTime = 151.77 s ClockTime = 154 s 

October 16, 2013, 04:26 

#10 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 20 
Hey,
The mesh looks really coarse. Can you tell us the diameter of the pipe and the inlet velocity? I read, that for such systems it is better to have a velocity inlet and a pressure outlet  not two pressure b.c. like you have. But this is so simple, it should run as well with two pressure b.c... Are you sure this is laminar?
__________________
The skeleton ran out of shampoo in the shower. 

October 16, 2013, 05:08 

#11  
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
Quote:
1) the diameter of the pipe is 10 mm 2) the length of the tube is 50 mm 3) The pressure at the inlet of the tube is 1333.2 Pa ( I am using p/rho=1.3332 as a inlet pressure ) Now I am using the totalPressure boundary condition for inlet, like fluent. 4) I have 0 Pa pressure at the outlet. That was the initial mesh, so first I have tried to test it on fluent and when there was no problem, I have decided to test it on OpenFOAM. I am using these value according to the paper I have. 

October 16, 2013, 05:12 

#12 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 20 
1) Can you upload the .msh file somewhere?
2) Are you 100% sure you use the same b.c. and viscosity as fluent?
__________________
The skeleton ran out of shampoo in the shower. 

October 16, 2013, 05:30 

#13  
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
Quote:
1) here you are: http://www.rodfile.com/w4dsnlx58l1o 2) I am pretty sure, because values of both simulations are almost the same with a little difference in pressure! fluent: dynamic viscosity = 0.003 and density = 1000 pressure inlet= total Gage pressure = 1333.2 Pa OpenFOAM: kinematic viscosity = 3e6 pressure inlet= total pressure = 1.3332 [m^2/s^2] (p/rho) 

October 16, 2013, 07:44 

#14 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 20 
Hi,
I use Code:
ddtSchemes { default steadyState; } gradSchemes { grad(U) cellMDLimited Gauss linear 1.0; grad(p) cellLimited Gauss linear 1.0; } divSchemes { default none; div(phi,U) bounded Gauss linearUpwind grad(U); div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes { default Gauss linear corrected; } interpolationSchemes { default linear; } snGradSchemes { default none; } fluxRequired { default no; p; } residuals.jpeg
__________________
The skeleton ran out of shampoo in the shower. 

October 16, 2013, 08:22 

#15 
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
It seems that, I can not use "bounded Gauss linearUpwind grad(U)" scheme in 1.6ext, I get the following error:
Code:
unknown convection scheme bounded Valid convection schemes are : 3 ( explicit Gauss off ) 

October 16, 2013, 08:23 

#16 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 20 
Ok, try without it?
Why don't you install the most recent version?
__________________
The skeleton ran out of shampoo in the shower. 

October 16, 2013, 08:40 

#17  
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
Quote:
Gauss linearUpwindV cellMDLimited Gauss linear 1.0; But As I can see in your residual plot, the pressure residual drops much faster than others, but I am still on the order of 10^3 after 2000 iteration. can you upload the case you have used? thanks for your attention regards  I am trying to simulate a Fluidsolid interaction and that solver is available in OpenFOAM1.6ext. At first I am trying to make sure that everything is OK with Fluid solver. 

October 16, 2013, 08:59 

#18 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 20 
Here it is
newCase.zip
__________________
The skeleton ran out of shampoo in the shower. 

October 16, 2013, 09:06 

#19  
Senior Member
Daniel
Join Date: Mar 2013
Posts: 219
Rep Power: 14 
Quote:
I have also changed U solver to smoothSolver. results are similar to fluent. I will upload the case. 22x version: http://www.rodfile.com/f6dwibedvb05 regards 

October 16, 2013, 09:42 

#20 
Senior Member
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,297
Rep Power: 20 
Great to see it worked.
__________________
The skeleton ran out of shampoo in the shower. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
a problem with simpleFoam  fring  OpenFOAM Bugs  1  January 9, 2013 13:05 
interFoam vs. simpleFoam channel flow comparison  DanM  OpenFOAM Running, Solving & CFD  11  January 5, 2013 07:21 
Problem running simpleFoam with kOmegaSST turbulence model  matzbanni  OpenFOAM Running, Solving & CFD  5  November 3, 2012 07:45 
SimpleFoam convergen problem  maolongliu  OpenFOAM  7  August 13, 2010 10:17 
Free Surface Problem  Convergance  Toby  FLUENT  0  July 2, 2008 23:16 
Sponsored Links 