
[Sponsors] 
Attempt to understand icoFoam transientSimpleFoam on cavity testcase 

LinkBack  Thread Tools  Display Modes 
April 28, 2008, 09:06 
Dear All
Greetings.
Conc

#1 
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 10 
Dear All
Greetings. Conceptually both SIMPLE and PISO formulations can be used to solve problems of transient nature. In the list of OpenFOAM solvers > icoFoam is the transient solver for incompressible, laminar flow of Newtonian fluids. > transientSimpleFoam is the transient solver for incompressible, turbulent flow of onNewtonian fluids. In principle if one modifies the transientSimpleFoam solver by removing the turbulence calculation part then the two solvers should deliver the same result. As far my as understanding goes the transientSimpleFoam shall take more time to converge as it uses underrelaxation. The original icoFoam solver in its unmodified form is: int main(int argc, char *argv[]) { # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" # include "createFields.H" # include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; for (runTime++; !runTime.end(); runTime++) { Info<< "Time = " << runTime.timeName() << nl << endl; # include "readPISOControls.H" # include "CourantNo.H" fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U)  fvm::laplacian(nu, U) ); solve(UEqn == fvc::grad(p)); //  PISO loop for (int corr=0; corr<nCorr; corr++) { volScalarField rUA = 1.0/UEqn.A(); U = rUA*UEqn.H(); phi = (fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rUA, U, phi); adjustPhi(phi, U, p); for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix pEqn ( fvm::laplacian(rUA, p) == fvc::div(phi) ); pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); if (nonOrth == nNonOrthCorr) { phi = pEqn.flux(); } } # include "continuityErrs.H" U = rUA*fvc::grad(p); U.correctBoundaryConditions(); } runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return(0); } Now here is the transientSimpleFoam with the changes. I have just removed the turbulence calculation part and the fvMatrixMatrix UEqn is same as in icoFoam. Here is the changed version: int main(int argc, char *argv[]) { # include "setRootCase.H" # include "createTime.H" # include "createMesh.H" # include "createFields.H" # include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; for (runTime++; !runTime.end(); runTime++) { Info<< "Time = " << runTime.timeName() << nl << endl; # include "readPISOControls.H" # include "CourantNo.H" // Pressurevelocity SIMPLE corrector loop for (int corr=0; corr<nCorr; corr++) { // Momentum predictor tmp<fvvectormatrix> UEqn ( fvm::ddt(U) + fvm::div(phi, U) + fvm::laplacian(nu, U) ); UEqn().relax(); solve(UEqn() == fvc::grad(p)); p.boundaryField().updateCoeffs(); volScalarField rUA = 1.0/UEqn().A(); U = rUA*UEqn().H(); UEqn.clear(); phi = fvc::interpolate(U) & mesh.Sf(); adjustPhi(phi, U, p); // Store pressure for underrelaxation p.storePrevIter(); // Nonorthogonal pressure corrector loop for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix pEqn ( fvm::laplacian(rUA, p) == fvc::div(phi) ); pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); if (nonOrth == nNonOrthCorr) { phi = pEqn.flux(); } } # include "continuityErrs.H" // Explicitly relax pressure for momentum corrector p.relax(); // Momentum corrector U = rUA*fvc::grad(p); U.correctBoundaryConditions(); } runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s\n\n" << endl; } Info<< "End\n" << endl; return(0); } I ran both solvers on the cavity with same settings in the controlDict, fvSchemes, fvSolution. the fvSolution has the subDict settings for both algorithms: PISO { nCorrectors 2; nNonOrthogonalCorrectors 0; pRefCell 0; pRefValue 0; } // Relaxation factors are used for transient SIMPLE relaxationFactors { p 0.5; U 0.8; } The results I get are completely different. I am posting here the pressure and velocity fields at t=0.5 for both solvers. IcoFoam results (all the settings are standard by which I mean the settings given in the UserGuide for the lid driven cavity tutorial) transientSimpleFoam results Note the difference in the direction of velocity vectors The difference in the results could be due to several reason. All I am trying here is to understand how to tune these two solvers which are solving the same physics but using different pressurevelocity coupling. Any inputs will be helpful With best regards Jaswi 

April 28, 2008, 10:47 
Hi Jaswi
Looking at the low

#2 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,702
Rep Power: 27 
Hi Jaswi
Looking at the lowermost plot, which I suspect is the velocity field, I cannot see any boundary, where the velocity is not zero!?! Thus could it be that you have forgotten to set the boundary condition on U? Best regards, Niels
__________________
Please note that I do not use the Friendfeature, so do not be offended, if I do not accept a request. 

April 28, 2008, 19:04 
Hi Niels
Thank for the comm

#3 
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 10 
Hi Niels
Thank for the comment. Please take a notice of the comments in the post. I have mentioned above that the first two pictures, i.e. pressure and velocity plots are for the led driven cavity using icoFOAM Now icoFoam uses PISO pressurevelocity coupling algorithm. There is also another solver called transientSimpleFoam which uses the SIMPLE pressurevelocity coupling algorithm . The last two picture are pressure and velocity for the same led driven cavity but now using the modifeid transientSimpleFoam given above in the post. I again emphasize on the fact that the two solvers differing only in their pressurevelocity coupling algorithm were run on the same case i.e. lid driven cavity. Hope that clears the doubt. I am waiting eagerly for the comments :) With Regards Jaswi 

April 29, 2008, 04:37 
Any reason you're adding and n

#4 
Super Moderator
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 17 
Any reason you're adding and not subtracting the viscous contribution in your UEqn?
+ fvm::laplacian(nu, U) 

April 29, 2008, 05:40 
Hi Mattijs
Thanks a lot for

#5 
Senior Member
Join Date: Mar 2009
Posts: 248
Rep Power: 10 
Hi Mattijs
Thanks a lot for pointing out that mistake. I am really sorry for not cross checking my stuff and creating unnecessary trouble. With that correction , both SIMPLE and PISO deliver identical results , at first glance at least. I am thankful to you for help. If possible please point me to necessary routines on how I can compare the error for the two solvers and make a quantitative analysis. Just some pointers. In that way I can do the quantitative analysis for these two presvelocity algorithms solving the same physical model and put the results on Wiki. It might be useful to somebody trying to understand the solution approach With Best Regards Jaswi 

April 29, 2008, 05:41 
Hi
Nice spotting Mattjis...

#6 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,702
Rep Power: 27 
Hi
Nice spotting Mattjis... That could easily explain the lowermost picture, because the change in sign makes the diffusion term into an energy source. Thus if you put on a scale bar, you will probably experience that the maximum velocities in your transientSimpleFoam case is significantly larger than the lid velocity.  Niels
__________________
Please note that I do not use the Friendfeature, so do not be offended, if I do not accept a request. 

July 10, 2009, 05:01 

#7 
Member
Bernard Esterhuyse
Join Date: Mar 2009
Location: Pretoria, South Africa
Posts: 50
Rep Power: 9 
Hi
I'm looking for the transientSimpleFoam solver, but I cannot find it in the 1.5 distribution. Is there another location for it? Thanks 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
FOAM FATAL IO ERROR attempt to read beyond EOF  unoder  OpenFOAM Running, Solving & CFD  7  September 20, 2016 05:47 
Density in icoFoam Densidad en icoFoam  manuel  OpenFOAM Running, Solving & CFD  8  September 22, 2010 04:10 
TransientSimpleFoam  skabilan  OpenFOAM Running, Solving & CFD  2  June 4, 2008 20:39 
Validation and Testcase  Araz  Main CFD Forum  0  August 5, 2004 08:36 
ERCOFTAC testcase # 11  Aldo Bonfiglioli  Main CFD Forum  0  September 11, 1998 09:02 