# Problem with transient simulation (icoFoam)

 Register Blogs Members List Search Today's Posts Mark Forums Read

May 7, 2009, 19:24
Problem with transient simulation (icoFoam)
#1
Senior Member

Senthil Kabilan
Join Date: Mar 2009
Posts: 113
Rep Power: 17
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;
}
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss upwind;
}
laplacianSchemes
{
default none;
laplacian(nu,U) Gauss linear corrected;
laplacian((1|A(U)),p) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
interpolate(HbyA) linear;
}
{
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 1e-05;
relTol 0.1;
smoother GaussSeidel;
mergeLevels 1;
minIter 0;
maxIter 10;
};
U PBiCG
{
preconditioner DILU;
tolerance 1e-06;
relTol 0.01;
minIter 0;
maxIter 10;
};
}

PISO
{
momentumPredictor yes;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
Attached Images
 ss.jpg (41.4 KB, 33 views) trans.jpg (46.7 KB, 37 views)

 May 8, 2009, 07:03 #2 Senior Member     Jose Luis Santos Join Date: Mar 2009 Location: Portugal Posts: 215 Rep Power: 18 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: 17 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     Jose Luis Santos Join Date: Mar 2009 Location: Portugal Posts: 215 Rep Power: 18 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: 17 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: 182 Rep Power: 17 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: 17 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 zip-up check OK. Face vertices OK. Face-face 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.71894e-18 -3.67424e-18 4.62755e-17) OK. Max cell openness = 3.91249e-16 OK. Max aspect ratio = 13.6051 OK. Minumum face area = 9.1356e-08. Maximum face area = 4.39183e-06. Face area magnitudes OK. Min volume = 1.57027e-11. Max volume = 3.28196e-09. Total volume = 1.83797e-05. Cell volumes OK. Mesh non-orthogonality Max: 74.7668 average: 22.4209 *Number of severely non-orthogonal faces: 1. Non-orthogonality check OK. <

 May 14, 2009, 19:08 #8 Senior Member   Senthil Kabilan Join Date: Mar 2009 Posts: 113 Rep Power: 17 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: 12 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: 182 Rep Power: 17 What exactly means "same problem"? Is it with the same settings? with similarly not so good mesh? non-orthogonality 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: 12
Hi there Matej,

I suspect that my problem is related to Mesh, as you suggested. I have a non-orthogonality 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
Attached Images
 Bifurcation.jpg (48.4 KB, 15 views)
Attached Files
 checkMesh.docx (4.3 KB, 7 views) Initial Conditions.docx (3.7 KB, 4 views) controlDict.docx (3.6 KB, 3 views) fvSchemes & fv Solution.docx (4.1 KB, 6 views)

 June 16, 2014, 06:43 #12 Senior Member   matej forman Join Date: Mar 2009 Location: Brno, Czech Republic Posts: 182 Rep Power: 17 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 non-orthogonal 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 fs.chemech likes this.

 June 16, 2014, 17:49 #13 New Member   Filippo Join Date: May 2014 Posts: 27 Rep Power: 12 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.79118e-15. 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 = 1e-05 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: 182 Rep Power: 17 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: 12 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.92903e-06, Final residual = 2.92903e-06, No Iterations 0 smoothSolver: Solving for Uy, Initial residual = 2.37159e-05, Final residual = 3.81699e-08, No Iterations 1 smoothSolver: Solving for Uz, Initial residual = 5.21709e-06, Final residual = 5.21709e-06, No Iterations 0 GAMG: Solving for p, Initial residual = 3.55236e-05, Final residual = 2.21321e-06, No Iterations 3 GAMG: Solving for p, Initial residual = 2.73077e-05, Final residual = 8.81428e-07, No Iterations 3 GAMG: Solving for p, Initial residual = 4.72646e-06, Final residual = 5.43796e-07, No Iterations 3 time step continuity errors : sum local = 1.17938e-11, global = 1.05586e-12, cumulative = -4.44951e-07 GAMG: Solving for p, Initial residual = 3.56183e-05, Final residual = 2.25281e-06, No Iterations 3 GAMG: Solving for p, Initial residual = 2.74372e-05, Final residual = 9.23554e-07, No Iterations 3 GAMG: Solving for p, Initial residual = 4.80607e-06, Final residual = 5.7571e-07, No Iterations 3 time step continuity errors : sum local = 1.2486e-11, global = -1.07163e-12, cumulative = -4.44952e-07 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.92724e-06, Final residual = 2.92724e-06, No Iterations 0 smoothSolver: Solving for Uy, Initial residual = 2.3706e-05, Final residual = 3.81499e-08, No Iterations 1 smoothSolver: Solving for Uz, Initial residual = 5.21476e-06, Final residual = 5.21476e-06, No Iterations 0 GAMG: Solving for p, Initial residual = 3.56616e-05, Final residual = 2.21383e-06, No Iterations 3 GAMG: Solving for p, Initial residual = 2.73196e-05, Final residual = 8.80519e-07, No Iterations 3 GAMG: Solving for p, Initial residual = 4.72298e-06, Final residual = 5.43404e-07, No Iterations 3 time step continuity errors : sum local = 1.17854e-11, global = 1.05574e-12, cumulative = -4.44951e-07 GAMG: Solving for p, Initial residual = 3.55978e-05, Final residual = 2.2518e-06, No Iterations 3 GAMG: Solving for p, Initial residual = 2.74235e-05, Final residual = 9.23134e-07, No Iterations 3 GAMG: Solving for p, Initial residual = 4.80382e-06, Final residual = 5.75612e-07, No Iterations 3 time step continuity errors : sum local = 1.2484e-11, global = -1.07123e-12, cumulative = -4.44952e-07 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: 182 Rep Power: 17 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: 12 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 non-newtonian fluid! FS

 June 17, 2014, 07:23 #18 Senior Member   matej forman Join Date: Mar 2009 Location: Brno, Czech Republic Posts: 182 Rep Power: 17 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 fs.chemech likes this.

 June 17, 2014, 07:59 #19 New Member   Filippo Join Date: May 2014 Posts: 27 Rep Power: 12 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: 182 Rep Power: 17 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: http://www.cfd-online.com/Forums/ope...residuals.html You may use gnuplot also for plotting the probes. mat