
[Sponsors] 
May 7, 2009, 19:24 
Problem with transient simulation (icoFoam)

#1 
Senior Member
Senthil Kabilan
Join Date: Mar 2009
Posts: 113
Rep Power: 9 
Hi Foamers,
Attached are two snap shots of static pressure from a steady state case and a transient case. The pressure gradient is 0.0003 pa. simpleFoam gives me the correct results but when I slowly ramp up the pressure from zero to 0.0003 pa using icoFoam, it does not convergence. I think its got to do with the tolerances. Any suggestions? Thanks Senthil My FvScheme file: ddtSchemes { default Euler; } gradSchemes { default Gauss linear; grad(p) Gauss linear; } divSchemes { default none; div(phi,U) Gauss upwind; } laplacianSchemes { default none; laplacian(nu,U) Gauss linear corrected; laplacian((1A(U)),p) Gauss linear corrected; } interpolationSchemes { default linear; interpolate(HbyA) linear; } snGradSchemes { default corrected; } fluxRequired { default no; p; } My FvSolution file: solvers { p GAMG { agglomerator faceAreaPair; nCellsInCoarsestLevel 100; cacheAgglomeration true; directSolveCoarsest true; nPreSweeps 1; nPostSweeps 2; nFinestSweeps 2; tolerance 1e05; relTol 0.1; smoother GaussSeidel; mergeLevels 1; minIter 0; maxIter 10; }; U PBiCG { preconditioner DILU; tolerance 1e06; relTol 0.01; minIter 0; maxIter 10; }; } PISO { momentumPredictor yes; nCorrectors 2; nNonOrthogonalCorrectors 0; pRefCell 0; pRefValue 0; } 

May 8, 2009, 07:03 

#2 
Senior Member

Hi,
I think relTol in fvSolution should be 0 both for U and P when using the PISO algorithm. Regards, Jose Santos 

May 9, 2009, 13:56 

#3 
Senior Member
Senthil Kabilan
Join Date: Mar 2009
Posts: 113
Rep Power: 9 
Hi Jose,
Thanks for the suggestion. Reducing the relative tolerance did help bring down the residual but still the solution did not converge. Any other suggestion or tricks that I can try? Regards, Senthil 

May 9, 2009, 16:22 

#4 
Senior Member

Hi Senthil,
Maybe it could help if you could provide more details about your case: Re, mesh, boundary conditions, turbulence models, etc. And why do you say it does not converge? Regards, Jose Santos 

May 9, 2009, 23:30 

#5 
Senior Member
Senthil Kabilan
Join Date: Mar 2009
Posts: 113
Rep Power: 9 
Hi Jose,
It is a low Reynolds number simulation. The mesh is an all tetraherdal mesh. Below are my p and U files... p file: dimensions [0 2 2 0 0 0 0]; internalField uniform 0; boundaryField { inlet { type fixedValue; value uniform 0; } out1 { type timeVaryingUniformFixedValue; fileName "inletdata"; outOfBounds clamp; value uniform 0; } w1 { type zeroGradient; } } The inletdata is basically a sinewave with an amplitude of 0.0003 U file: dimensions [0 1 1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { inlet { type pressureInletOutletVelocity; phi phi; value uniform (0 0 0); } out1 { type zeroGradient; } w1 { type fixedValue; value uniform (0 0 0); } } 

May 10, 2009, 03:37 

#6 
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 104
Rep Power: 9 
Hi,
reading your nNonOrthogonalCorrectors 0; what is your checkMesh saying? do you have a good convergence of pressure in those two PISO steps? and the velocities? good luck matej 

May 10, 2009, 13:22 

#7 
Senior Member
Senthil Kabilan
Join Date: Mar 2009
Posts: 113
Rep Power: 9 
Hi Matej,
Below is the output from checkMesh and also the OpenFoam output at maximum amplitude of the sineWave. Time = constant Mesh stats points: 5615 faces: 63469 internal faces: 60627 cells: 31024 boundary patches: 3 point zones: 0 face zones: 0 cell zones: 0 Number of cells of each type: hexahedra: 0 prisms: 0 wedges: 0 pyramids: 0 tet wedges: 0 tetrahedra: 31024 polyhedra: 0 Checking topology... Boundary definition OK. Point usage OK. Upper triangular ordering OK. Topological cell zipup check OK. Face vertices OK. Faceface connectivity OK. Number of regions: 1 (OK). Checking patch topology for multiply connected surfaces ... Patch Faces Points Surface inlet 300 171 ok (not multiply connected) out1 276 159 ok (not multiply connected) w1 2266 1173 ok (not multiply connected) Checking geometry... Domain bounding box: (0.0100289 1.50034 0.6268) (0.0100095 1.4803 0.6858) Boundary openness (2.71894e18 3.67424e18 4.62755e17) OK. Max cell openness = 3.91249e16 OK. Max aspect ratio = 13.6051 OK. Minumum face area = 9.1356e08. Maximum face area = 4.39183e06. Face area magnitudes OK. Min volume = 1.57027e11. Max volume = 3.28196e09. Total volume = 1.83797e05. Cell volumes OK. Mesh nonorthogonality Max: 74.7668 average: 22.4209 *Number of severely nonorthogonal faces: 1. Nonorthogonality check OK. <<Writing 1 nonorthogonal faces to set nonOrthoFaces Face pyramids OK. Max skewness = 1.23326 OK. All angles in faces OK. All face flatness OK. Mesh OK. End OpenFOAM output: DILUPBiCG: Solving for Ux, Initial residual = 0.00261819, Final residual = 2.19482e12, No Iterations 1 DILUPBiCG: Solving for Uy, Initial residual = 0.0120803, Final residual = 3.25385e11, No Iterations 1 DILUPBiCG: Solving for Uz, Initial residual = 0.0026254, Final residual = 3.57156e12, No Iterations 1 GAMG: Solving for p, Initial residual = 0.000172203, Final residual = 4.80234e06, No Iterations 2 time step continuity errors : sum local = 1.99962e14, global = 3.54193e17, cumulative = 3.4998e11 GAMG: Solving for p, Initial residual = 1.33206e05, Final residual = 1.89225e06, No Iterations 1 time step continuity errors : sum local = 7.88021e15, global = 1.38887e17, cumulative = 3.49979e11 ExecutionTime = 311.9 s ClockTime = 312 s I think the problem is with the velocity. Any thoughts? Regards, Senthil 

May 14, 2009, 19:08 

#8 
Senior Member
Senthil Kabilan
Join Date: Mar 2009
Posts: 113
Rep Power: 9 
Hi Foamers,
I get good convergence with pressure, but the problem is with the velocities. Is there a way to improve velocity convergence? Regards, Senthil 

June 16, 2014, 02:00 

#9 
New Member
Filippo
Join Date: May 2014
Posts: 27
Rep Power: 4 
Hi Skabilan,
I have the same problem you described in this post... have you solved it? Can you tell me how? Cheers, FS 

June 16, 2014, 02:26 

#10 
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 104
Rep Power: 9 
What exactly means "same problem"?
Is it with the same settings? with similarly not so good mesh? nonorthogonality to 74% is pretty high. And as you can see upwind is not saving you. If your problem is pressure is coverged but velocities are not, the problem could be: * mesh * boudary settings * discretisation * initial conditions * combination of the above Try to give more detail on what is really going on. Matej 

June 16, 2014, 05:33 

#11 
New Member
Filippo
Join Date: May 2014
Posts: 27
Rep Power: 4 
Hi there Matej,
thank you very much for your reply. I suspect that my problem is related to Mesh, as you suggested. I have a nonorthogonality of around 74... I have a bifurcation (as you can see attached) with one inlet and two outlets. You can also find attached my initial conditions, controlDict, fvSchemes and fvSolution. Can you give me some enlightment, please? My fluid has a kinematic viscosity of 0.000003 m2/s and I use a velocity of 0.4m/s. Re = 300. I'm using icoFoam to solve my flow. Hope to hear from you soon, FS 

June 16, 2014, 06:43 

#12 
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 104
Rep Power: 9 
Hi,
looking at your bounding box dimensions, checking with your Re number, your tube diameter is 2 mm, is it right? It is only one face which is wrong  according to checkMesh skweness looks OK. I'd suggest to make better mesh to get rid of the nonorthogonal cells. further on, what is your currant number with your time step? It should be below 5, maybe smaller. in fvSchemes, you may try to limit the gradients with: default cellLimited Gauss linear 1; but I would guess that the main problem is in BC settings anyways. try inletOutlet http://www.openfoam.org/docs/user/boundaries.php for U: outlet { type inletOutlet; inletValue uniform (0 0 0); value $internalField; } for p at outlet: fixedValue which will help to stop backflow at the outlet. hope this helps. matej 

June 16, 2014, 17:49 

#13 
New Member
Filippo
Join Date: May 2014
Posts: 27
Rep Power: 4 
Matej, thank you very much for your reply.
I have one doubt: In the outlet boundary condition that you suggested, ux shouldn't be 0.4 (my imposed velocity)? outlet { type inletOutlet; inletValue uniform (0.4 0 0); value $internalField; } I've also limited gradient schemes as you suggested: gradSchemes { default cellLimited Gauss linear 1; } So, I implemented your suggestions and started a new simulation!! The volume of my smallest cell is v=1.79118e15. I calculated the length of the edge, l=0.000012 and obtained time step of 0.000015 imposing a Courant = 0.5. Anyway, if I use this time step I have Courant Number increasing again: Time = 1e05 Courant Number mean: 0.0115924 max: 1.26092 ... Time = 0.0001 Courant Number mean: 0.0115948 max: 1.05487 ... Time = 0.00012 Courant Number mean: 0.0115962 max: 1.03125 ... Time = 0.00013 Courant Number mean: 0.011597 max: 1.03159 Time = 0.00014 Courant Number mean: 0.0115977 max: 1.03203 Time = 0.00015 Courant Number mean: 0.0115984 max: 1.03255 ... Time = 0.00025 Courant Number mean: 0.0116055 max: 1.03957 ... I will now try to improve my mesh... If you have any idea that you could share with me I'll be very thankful! Cheers, FS 

June 17, 2014, 02:53 

#14 
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 104
Rep Power: 9 
Hi,
your timeStep is constant, and you are getting rising mean and max. courant number. This could mean 2 things. A) you are starting from zero field imposing velocity at the inlet, which means rising Co, B) you are starting from steady state solution and during the first few times (which are very small) your velocity field jumps. C) something wrong happens. You may (after getting better mesh):  set the timeStep to variable with setting maxCourant number to e.g. 2,  use pimpleFoam solver (with turbulence model switched to laminar) Pimple solver is more robust solver with SIMPLE loop around PISO time step. You will find examples in tutorials. But your problem should be simple and should behave. How do you make your mesh? What software? Do you generate the mesh in meters and then scale down? You will always have better mesh like that. Let us know how it is going. And please post the log and settings text files as text files not as word documents. it is smaller and easier to read. Thanks. Mat 

June 17, 2014, 06:43 

#15 
New Member
Filippo
Join Date: May 2014
Posts: 27
Rep Power: 4 
Hi Mat,
thank you very much for your answer. Your help is being truly enlightening! Well, once I also use Ansys Fluent, I'm using a mesh I generated with Ansys Meshing. Now I'm trying to mesh my geometry with ICEM wich looks a better solution to generate hexahedral mesh. I tried snappyhexmesh but it didn't go well. Just one question: icoFoam supports variable time step? Well, I left my simulation running all night long and now it is going like that: Time = 0.05822 Courant Number mean: 0.01246 max: 1.72783 smoothSolver: Solving for Ux, Initial residual = 2.92903e06, Final residual = 2.92903e06, No Iterations 0 smoothSolver: Solving for Uy, Initial residual = 2.37159e05, Final residual = 3.81699e08, No Iterations 1 smoothSolver: Solving for Uz, Initial residual = 5.21709e06, Final residual = 5.21709e06, No Iterations 0 GAMG: Solving for p, Initial residual = 3.55236e05, Final residual = 2.21321e06, No Iterations 3 GAMG: Solving for p, Initial residual = 2.73077e05, Final residual = 8.81428e07, No Iterations 3 GAMG: Solving for p, Initial residual = 4.72646e06, Final residual = 5.43796e07, No Iterations 3 time step continuity errors : sum local = 1.17938e11, global = 1.05586e12, cumulative = 4.44951e07 GAMG: Solving for p, Initial residual = 3.56183e05, Final residual = 2.25281e06, No Iterations 3 GAMG: Solving for p, Initial residual = 2.74372e05, Final residual = 9.23554e07, No Iterations 3 GAMG: Solving for p, Initial residual = 4.80607e06, Final residual = 5.7571e07, No Iterations 3 time step continuity errors : sum local = 1.2486e11, global = 1.07163e12, cumulative = 4.44952e07 ExecutionTime = 42399.2 s ClockTime = 42409 s Time = 0.05823 Courant Number mean: 0.01246 max: 1.72784 smoothSolver: Solving for Ux, Initial residual = 2.92724e06, Final residual = 2.92724e06, No Iterations 0 smoothSolver: Solving for Uy, Initial residual = 2.3706e05, Final residual = 3.81499e08, No Iterations 1 smoothSolver: Solving for Uz, Initial residual = 5.21476e06, Final residual = 5.21476e06, No Iterations 0 GAMG: Solving for p, Initial residual = 3.56616e05, Final residual = 2.21383e06, No Iterations 3 GAMG: Solving for p, Initial residual = 2.73196e05, Final residual = 8.80519e07, No Iterations 3 GAMG: Solving for p, Initial residual = 4.72298e06, Final residual = 5.43404e07, No Iterations 3 time step continuity errors : sum local = 1.17854e11, global = 1.05574e12, cumulative = 4.44951e07 GAMG: Solving for p, Initial residual = 3.55978e05, Final residual = 2.2518e06, No Iterations 3 GAMG: Solving for p, Initial residual = 2.74235e05, Final residual = 9.23134e07, No Iterations 3 GAMG: Solving for p, Initial residual = 4.80382e06, Final residual = 5.75612e07, No Iterations 3 time step continuity errors : sum local = 1.2484e11, global = 1.07123e12, cumulative = 4.44952e07 ExecutionTime = 42406.1 s ClockTime = 42416 s Thank your for advising me to post files in a easier way like .txt files! Cheers, FS 

June 17, 2014, 06:59 

#16 
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 104
Rep Power: 9 
I'm glad to hear that
Now, I can see that your time step is solved in 7 seconds and the courant number is really small. This is on the new and better mesh? ICEM is powerfull mesher. Why are you running the case in transient anyway? You have upwinded velocity and Euler discretisation in time which will not give you high precision, so no good configuration to capture the oscillations. What do you want to know from the simulation? mat 

June 17, 2014, 07:11 

#17 
New Member
Filippo
Join Date: May 2014
Posts: 27
Rep Power: 4 
Yeah, I'm glad too!
Yes, this mesh is a little bit better than previous but not too much. I'm preparing a new one with ICEM. I have a laminar flow with a Reynolds around 300. Which solver do you consider most suitable? pimpleFoam as you said? I'm trying to get velocity profiles and WSS, then I'll try to evolve to nonnewtonian fluid! FS 

June 17, 2014, 07:23 

#18 
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 104
Rep Power: 9 
If the flow is not oscillating (do you have a probe downstream of bifurcation?) and you are not planning oscillations imposed at inlet and flow is converging in steady state, I would use simpleFOAM with the turbulence set to laminar. This would save you computational time. If icoFoam is running fine for you and you need to resolve the time behavior, then there is no reason to change it, only you should go for more precision in discretisation of time (CrankNicholson) and in div schemes for velocity to linearUpwind.
mat 

June 17, 2014, 07:59 

#19 
New Member
Filippo
Join Date: May 2014
Posts: 27
Rep Power: 4 
Mat,
I usually use a flow monitoring small plane in Fluent. However, in OpenFoam I have not applied it mainly because I have not discovered yet how to do it! :s I also need to know how to put my residuals evolving in a graph... In Fluent I know that my flow is oscillating and that's the main reason I'm using icoFoam in OpenFoam! By the way, my simulation remains stable! Sorry for being such a beginner in OpenFoam and thank you very much for your time! 

June 17, 2014, 08:49 

#20 
Senior Member
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 104
Rep Power: 9 
There is nothing to be sorry about.
in console type: tut to get to the directory with tutorials. and type: find . name "controlDict" xargs grep probes (or you may try command ack probes) to see from where to copy settings to have probe lines output to text file. to plot residuals, look here: Tutorial of how to plot residuals ! You may use gnuplot also for plotting the probes. mat 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
IcoFoam continuity error in 2D transient simulation  finch  OpenFOAM Running, Solving & CFD  15  June 29, 2016 10:39 
Problem with 2d VOF Simulation  David  FLUENT  5  April 12, 2006 08:24 
Initial Values in Transient problem  Xobile  CDadapco  1  January 19, 2005 05:42 
transient problem  carno  CDadapco  7  January 16, 2004 14:46 
transient problem  Alejandro H Rossette  CDadapco  1  September 3, 2003 10:34 