
[Sponsors] 
May 17, 2013, 01:29 
pimpleFoam for full transient problems?

#1 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,209
Rep Power: 20 
i need to know is rhoPimleFoam suitable to have accurate results in each time step since in code it does some relaxations?
Also in the code comments it is written:for pseudotransient Does it mean it isnt appropriate for full transient flow capturing?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. 

May 21, 2013, 04:44 
transient solver

#2 
Senior Member
Daniel Witte
Join Date: Nov 2011
Posts: 142
Rep Power: 8 
Hello Immortality,
I have the same question. See http://www.cfdonline.com/Forums/ope...tml#post425784 I did not get any answer. I googled some older leads, but there is no clear answer. Somebody told me setting the variable momentPredictor in fvSolution to yes, but this did not help much. I am even not sure that the results without relaxation are correct. Why would they if they are different for different relaxion factors. Maybe there is some possibility setting some other variables like nOuterCorrectors or nCorrectors to some higher value. In the case mentioned in my lead it is 1 and 2. If there is some advice how to use these values, that would be helpful. The numerical methods that I haved used in the past, there is always a function that is set to 0 (or the 0 vector if there is a system of equations). The correction to get the next guess value is typically the Newtonian method or a similar method (like the Secant method). The definition of residual then can be the difference between two following guess values, but this can lead to big problems since a slow converging solution will stop the iteration regardless if it is close to that solution or not. So, I always use the function itself to be smaller than a tolerance value. Relaxing then does not make a difference in respect to the solution, but only to the speed of calculation and convergence. If a value like P or U is relaxed, it seems to me, this means there is not a function converging to 0 relaxed, but a value different to 0 since there should be pressure and flow, no? So you should relax the "pressure equation", "the momentum equation", such that the pressure, momentum is calculated, but as an implicit equation with the value 0 on the right side. Hope this helps. If you have a solution, please let me know. Regards, Daniel 

May 21, 2013, 09:42 

#3 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,974
Blog Entries: 6
Rep Power: 33 
Hi,
as far as I know the values of variables that are relaxed could never represent the truth at that Moment. A relaxation just limits the range of change due to a variable from one time step to the other. If you set the Relaxation (for example) to 0.1 but the variable value changes too strong, then you get a falsification in the value. Thats only okay if you are calculating steadystate Problem. In my opinion you have to set the relaxation factors to 1 = no relaxation and set the momentum prediction to true. If I am wrong, please correct me Greetings Tobi 

May 21, 2013, 11:05 

#4 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,209
Rep Power: 20 
Thanks Daniel and Tobias
is nSweep in some solvers like rhoCentralFoam related to relaxation factors? I don't use relaxation factors directly in the fvSolution but I think maybe there is some relaxations inside of the code itself that cause to not to obtain accurate results in each time step specially in rhoPimpleFoam and rhoCentralFoam I work with.and whats your suggestion about using rhoPimpleFoam for really transient case I have? could you give me your opinion about fvSolution's? ehoCentralFoam: Code:
solvers { "(rhorhoUrhoE)" { solver diagonal; } U { solver smoothSolver; smoother DICGaussSeidel; nSweeps 3; tolerance 1e8; relTol 0; maxIter 25000; } h { $U; //tolerance 1e12; //nSweeps 10; //relTol 0; //maxIter 25000; } e { $U; //tolerance 1e12; //relTol 0; //maxIter 25000; } gas { $U; smoother DILUGaussSeidel; tolerance 1e9; //relTol 0; //maxIter 25000; } "(komega)" { solver smoothSolver; smoother GaussSeidel; //nSweeps 5; //tolerance 1e12; //relTol 0; } } Code:
solvers { p { solver PCG; preconditioner DIC; tolerance 1e20; relTol 0; maxIter 25000; /*solver GAMG; smoother DICGaussSeidel; cacheAgglomeration true; nCellsInCoarsestLevel 200; nPreSweeps 0; nPostSweeps 2; nFinestSweeps 2; agglomerator faceAreaPair; mergeLevels 2; tolerance 1e012; relTol 0;*/ } pFinal { $p; relTol 0; } "rho.*" { $p; tolerance 1e18; relTol 0; } "(Uehkomega)" { solver PBiCG; preconditioner DILU; tolerance 1e18; relTol 0; maxIter 25000; } gas { solver PBiCG; preconditioner DILU; tolerance 1e8; relTol 0; maxIter 2500; } "(UhRkepsilonomega)Final" { $U; relTol 0; } } PIMPLE { momentumPredictor yes; nOuterCorrectors 6; nCorrectors 5; nNonOrthogonalCorrectors 0; rhoMin rhoMin [ 1 3 0 0 0 ] 0.2; rhoMax rhoMax [ 1 3 0 0 0 ] 15; maxCo 0.02; /*residualControl { "(Ukomega)" { relTol 0; tolerance 0.00000000001; } }*/ }
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. 

May 22, 2013, 11:34 

#5 
Senior Member
Daniel Witte
Join Date: Nov 2011
Posts: 142
Rep Power: 8 
Hello again,
Maybe you look at this: http://www.tfd.chalmers.se/~hani/kur...reportfin.pdf So, to answer the question, these parameters are used to determine how much coarse your grid is for the approximation of a Matrix calculation. This is apparently used to speed up the calculation. I would not change it unless you have a very big grid and lack of computer power. Getting back to the answer of Tobias: I do not agree unless somebody tells otherwise. PIMPLE is supposely a transient solver meaning that it shall represent the real time behavior of the flow. There is a supposely similar solver in the extended package named "transientSimple". Pimple is, acc. to the same leads, a replacement of that other solver. In that lead, Prof. Hasak proposes using relaxation. You would not do this if you think it has an influence on real time behavior. So, I made a couple trials. My solver is pimpleDymFoam, but this does not matter, it is still PIMPLE. The case is the mixerVesselAMI case having the viscosity set to 300. You can see that this case is transient and there is a periodic fluctuation of the plotted shaft torque (ztorque) of 4 Hz frequency just as the number of baffels would suggest (the number of rotor blades is also 4, so they interact simultanously with the baffles). For a relaxation of U of 0.1, the solution is quite a bit smaller than for 0.6. However, as you increase nCorrectors and nOuterCorrectors, the solution merge back together. Setting momentumPredictor to yes and all relTol to 0 has no significant impact. Relax to 1 does not work. The case slows down quite significantly setting nCorrectors and nOuterCorrectors to 32. I would therefore advice increasing relaxation as much as possible until the case starts diverging. Then increase nCorrectors and nOuterCorrectors until the case does not change anymore. Do you agree? It may be advisable limiting the end time and restarting the calculation having some higher relaxation and lower nCorrectors and nOuterCorrectors when you get some more stability in your flow (using the 1st calculation as initial condition). Another clonclusion: having no relaxation does not mean that you got the final solution unless you have set nCorrectors and nOuterCorrectors correctly. Maybe this is why the solver is called "pseudo transient" and not fully transient. For this to be, there needs to be some adaptive method setting nCorrectors and nOuterCorrectors automatically. Time step adaptation is already implemented as far as I can see. Regards, Daniel 

May 22, 2013, 12:12 

#6 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,209
Rep Power: 20 
thanks both of you
so if I don't use relaxations rhoPimpleFoam could give an accurate result in each time step,did I understand correctly or didn't? a small question meanwhile,that what does this expression do? Code:
correctPhi no;
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. 

May 23, 2013, 07:45 

#7 
Senior Member
Daniel Witte
Join Date: Nov 2011
Posts: 142
Rep Power: 8 
I do not think so. Reading other posts in this forum, SIMPLE does accept relaxation, PISO not and PIMPLE does as SIMPLE.
You get accurate results only adjusting nCorrectors and nOuterCorrectors high enough to your problem. This has nothing to do with relaxation. Phi is the flux. I do not know what this is good for. Maybe somebody else. Regards, Daniel 

May 23, 2013, 08:16 

#8 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,209
Rep Power: 20 
thanks Daniel.
If I want to summary what have said till now I can say:if someone wants to do a real transient compressible(accurate results without relaxation in each time step) he/she have to use: 1)rhoCentralFoam 2)sonicFoam(PISO loop) 3)rhoPimpleFoam with high numbers of nCorrectors and nOuterCorrectors if not correct let me know.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. 

May 23, 2013, 11:46 

#9  
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,974
Blog Entries: 6
Rep Power: 33 
Quote:
But if you set relaxation factors and increase the nCorrectors and nOuterCorrectors you can set down the timestep too I think it depends on your case and that was just a hint to the topic. In my opinion its only clear if you are 1000% involved into openfoam code + greate background nkowledge of cfd of / and making a test case and a validation 

May 23, 2013, 14:53 

#10 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,209
Rep Power: 20 
but I don't know clearly if rhoPimpleFoam is applicable to puretransient problems or not(i don't use any relaxation in fvSolution).why should increase nCorrectors and nOuterCorrectors?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. 

May 23, 2013, 15:07 

#11 
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Leoben (Austria)
Posts: 1,974
Blog Entries: 6
Rep Power: 33 
Normally you should get accurate solutions with pimpleFoam.
Compared with pisoFoam it should be the same. The difference is that pimple is a pisosimple merged algo that allows you to have larger timesteps as the piso algorithm itselfs. 

May 23, 2013, 15:21 

#12 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,209
Rep Power: 20 
so you say that outer loop in rhoPimpleFoam doesn't need to be 1 and can be higher(2,3, or more) and it has no effect on the final values calculated "for each time step" ?
but I have doubt about relaxations in it.for example in the part of pEqn.H here it uses relaxations.how can PIMPLE loop give us an exactly the same values in each time step if I want exact answer in each timestep? please clarify me a bit more. thanks. Code:
// Explicitly relax pressure for momentum corrector p.relax(); // Recalculate density from the relaxed pressure rho = thermo.rho(); rho = max(rho, rhoMin); rho = min(rho, rhoMax); rho.relax();
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. 

May 24, 2013, 03:43 

#13 
Senior Member
Daniel Witte
Join Date: Nov 2011
Posts: 142
Rep Power: 8 
Hello again,
I tried setting the time step down. This does not work with PIMPLE fot my problem. As far as I can interpretate the log file, the PIMPLE loop ( or one of them) does decrease the timestep of the problem automatically. There is a variabel in ControlDic for that purpose (adjustTimeStep set to yes). Doing so, you still have the possibility to set a lower writeInterval, but this is only for plotting the results. There may a much higher time step needed for the calculation than for plotting results... The variable deltaT seems no have no meaning setting adjustTimeStep set to yes. The variable writeControl determines whether the results are plotted according to the exact writeInterval setting or only approximatly (since using adjustTimeStep it may not hit right on the target to be plotted). If you set writeInterval to endTime (starting at 0), you will get the same value as setting 1/(1000 x EndTime), you just miss any intermediairy results. Using relaxation, the calculated time step got much smaller, with 1, as small as 10^7. This means for an end time of 5 s, it needs 5 x 10^7 iteration steps... Relaxation does a big improvment compared to this. You are right, Tobi, that we would need to go much deeper into the code to make a final judgement and it depends on the case. If you have a very stiff differential function, other numerical solvers shall be used than for less stiff problems. But there shoud be some general guideline, no? This is all what we are looking for here. Regards, Daniel 

May 24, 2013, 03:49 

#14 
Senior Member
Daniel Witte
Join Date: Nov 2011
Posts: 142
Rep Power: 8 
Sorry, a mistake in my post: using relaxation, the computation time got much faster than without.
I attached the controlDic, just to make sure. Regards, Daniel 

May 27, 2013, 02:40 

#15 
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,209
Rep Power: 20 
after this long arguments,I'm not sure if rhoPimpleFoam can be used for a fulltransient problem or not?if yes,what does pseudotransient expression mean for this solver?
Please give a direct and accurate answer to save me from doubt. Thanks.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. 

May 30, 2013, 03:00 

#16 
Senior Member
Daniel Witte
Join Date: Nov 2011
Posts: 142
Rep Power: 8 
Hello Immortality,
Both, Tobi and myself are not 100 % sure as you could see. You need to either consult somebody of OpenFoam (e.g. by going to some seminar that they offer or ask somebody at an university dealing with OIpenFoam) or figger it out yourself. Since OpenFoam does not give any warranty if simulations results are accurate anyway, you will never get a 100 % answer from these guys. Best is always to have a test case, where you have well reported results from literature, which should be close enough to your case, but small enough that calculation effort is small. CFD is a computer programm that shall describe what is happening in the real nature. But without some empirical evidence, I would not trust a computer programm. Regards, Daniel 

October 17, 2013, 09:51 

#17 
Senior Member
Albrecht vBoetticher
Join Date: Aug 2010
Location: Zürich, Swizerland
Posts: 218
Rep Power: 10 
I think it is a general problem that depends on how your variables change during your time step. For example, when using interFOAM (maybe other solvers, too) together with a nonnewtonian fluid (Herschel Bulkley with shear thinning) that changes its viscosity in dependency to the shear rate (and thus in dependency to velocity), your simulation overestimates the viscosity when the material accelerates and shear rate increases, and your simulation underestimates the viscosity if it decellerates. Thus, at the end of y time step, your velcoity field will be over or underestimated. Bad thing is, this again amplifies the over / underestimation of viscosity over the next time step, the error sums up and one gets faster or slower fluid dependent on time step.
Here, a way out is to apply outer corrector loops with relaxation, to apply somehow an average viscosity that lies between the viscosity at the beginning and at the end of timestep. Since in turbulent LES simulations, most dynamic SGS models introduce flow dependent turbulent viscosities that change the viscosity of a cell, those modelers can face somehow the same problem. They like to apply 3 outer corrector steps, chranknicholson or backward ddtSchemes and maxCo 0.25. 

February 9, 2017, 04:42 

#18  
Senior Member
Join Date: Mar 2015
Posts: 250
Rep Power: 5 
Quote:
without any warranty: PIMPLE sometimes needs relaxation factors for stability reasons. But when dealing with transient simulations the relaxation factor of the last iteration (and only of the last) of each timestep hast to be 1 in order to be time accurate. This can be managed by assigning 1 to pFinal etc. in fvSolution. But this is also done implicitly by OpenFOAM. Best regards, Kate 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Inverse and Transient Heat Transfer Problem on commercial software: is it possible?  rogbrito  CFX  1  January 29, 2012 18:48 
max iterations in transient problems  vinse  FLUENT  0  November 7, 2007 06:10 
Transient vs Steady State  Adam  CFX  1  April 12, 2007 11:34 
Transient simulation and sliding mesh problems  alige  FLUENT  0  May 8, 2006 03:51 
About the difference between steady and unsteady problems  Lisa  Main CFD Forum  11  July 5, 2000 14:37 