# Dynamic under relaxation factors in simpleFoam

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

 June 24, 2015, 10:14 Dynamic under relaxation factors in simpleFoam #1 New Member   Corrado Sotgiu Join Date: Jan 2013 Posts: 12 Rep Power: 4 Hello there, following the procedure described by Alberto Passalacqua in "Suggested unsteady, implicit solver stable with arbitrarily large time steps" I am trying to implement dynamic under relaxation factors in simpleFoam. Right now, what I want to accomplish is this: - check if the maximum intial pressure residual is decreasing - if it's decreasing, go further - if not, stop the SIMPLE loop right after the solution of the pressure equation and repeat from the values of U and p which I had at the beginning of the current time. At this stage I do not want to decrease the under relaxation factors. What I would expect, is that in the second case all the subsequent SIMPLE loops at a fixed time level will look exactly the same, since they are starting from the same values. What happens, is that I have slight variations of U and p for the first four or five loops. Then everything seems not to vary anymore. I am clearly missing something Any help would be much appreciated! For simplicity, I have included bot the pEqn.H and UEqn.H in the same file: Code: ```{ while (true) { U = U.oldTime(); p = p.oldTime(); // momentum predictor tmp UEqn ( fvm::div(phi, U) + turbulence->divDevReff(U) == fvOptions(U) ); UEqn().relax(URelaxationFactor); fvOptions.constrain(UEqn()); solve(UEqn() == -fvc::grad(p)); fvOptions.correct(U); // pressure corrector { volScalarField rAU(1.0/UEqn().A()); volVectorField HbyA("HbyA", U); HbyA = rAU*UEqn().H(); UEqn.clear(); // compute the surface flux of H/A surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); fvOptions.makeRelative(phiHbyA); // correct the flux at the boundaries adjustPhi(phiHbyA, U, p); // Non-orthogonal pressure corrector loop while (simple.correctNonOrthogonal()) { // pressure equation fvScalarMatrix pEqn ( fvm::laplacian(rAU, p) == fvc::div(phiHbyA) ); pEqn.setReference(pRefCell, pRefValue); currentResidual = pEqn.solve().initialResidual(); if (simple.finalNonOrthogonalIter()) { phi = phiHbyA - pEqn.flux(); } } // Explicitly relax pressure for momentum corrector p.relax(pRelaxationFactor); // Momentum corrector U = HbyA - rAU*fvc::grad(p); fvOptions.correct(U); } #include "continuityErrs.H" if (currentResidual < initialResidual) { Info << "Residuals are going down" << endl; initialResidual = currentResidual; break; cin.get(); } else { Info << "Residuals are going up" << endl; cin.get(); } } }```

 June 25, 2015, 02:31 #2 New Member   Corrado Sotgiu Join Date: Jan 2013 Posts: 12 Rep Power: 4 Here is the output of two subsequent loops at the same time level, including the values of U and p at three different points. The initial values of U and p are the same, but the subsequent SIMPLE loop is different (0.0855723 1.80568e-20 0) (0.0855981 1.42406e-20 0) (0.0855982 -1.22332e-20 0) 2.33476e-18 1.05554e-18 1.60639e-18 smoothSolver: Solving for Ux, Initial residual = 0.0824525, Final residual = 0.000293527, No Iterations 2 smoothSolver: Solving for Uy, Initial residual = 0.245928, Final residual = 0.00069289, No Iterations 3 Pressure gradient source: uncorrected Ubar = 0.0855981, pressure gradient = 0.000423014 GAMG: Solving for p, Initial residual = 0.370823, Final residual = 0.000364608, No Iterations 145 Pressure gradient source: uncorrected Ubar = 0.0855981, pressure gradient = 0.000412304 time step continuity errors : sum local = 4.60786e-19, global = -2.71051e-20, cumulative = -1.0842e-19 Residuals are going up (0.0855723 1.80568e-20 0) (0.0855981 1.42406e-20 0) (0.0855982 -1.22332e-20 0) 2.33476e-18 1.05554e-18 1.60639e-18 smoothSolver: Solving for Ux, Initial residual = 0.0826425, Final residual = 0.000297825, No Iterations 2 smoothSolver: Solving for Uy, Initial residual = 0.245928, Final residual = 0.00069289, No Iterations 3 Pressure gradient source: uncorrected Ubar = 0.0855981, pressure gradient = 0.000420528 GAMG: Solving for p, Initial residual = 0.402558, Final residual = 0.000397567, No Iterations 60 Pressure gradient source: uncorrected Ubar = 0.0855982, pressure gradient = 0.000412294 time step continuity errors : sum local = 5.42101e-20, global = -5.42101e-20, cumulative = -1.6263e-19 Residuals are going up Last edited by ingcorra; June 25, 2015 at 03:58.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post chriss85 OpenFOAM Running, Solving & CFD 32 July 1, 2015 10:00 Ivan OpenFOAM Programming & Development 0 April 10, 2015 12:13 philippose OpenFOAM Running, Solving & CFD 19 March 20, 2014 05:39 Mohsin FLUENT 5 April 30, 2010 11:57 Tim Phoenics 3 June 30, 2004 02:03

All times are GMT -4. The time now is 16:35.