# Problem while getting the initial residual

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

 August 21, 2012, 10:40 Problem while getting the initial residual #1 New Member   Laurent Orgogozo Join Date: Mar 2011 Location: Toulouse Posts: 20 Rep Power: 8 Dear Foamers, I am working on a solver (with OF-2.0.1) with an internal correction loop to deal with a non-linear equation. I try to use the initial residual of the resolution of each iteration of my internal loop to make the exit test of this loop (namely initialResidual<0.1), but : 1) When I use .solve().initialResidual() only, my initial residual is always 1 so that I cannot reach convergence (see Resolutions 1 and 1' and logs 1 or 1' below). 2) When I make successivly a .solve() and a .solve().initialResidual(), everything is fine in transient regime but if a steady state appears, the second resolution implied by .solve().initialResidual() makes the initial residual increasing, and thus impairs convergence (see Resolutions 2 and 2' and logs 2 or 2' below).. So my question is : in which way can I get acces to the initial residual without make a resolution, or alternatively use only .solve().initialResidual() without fixing the initial residual to one ? Thank you by advance for your help. Resolutions 1 and 1': 1 : psiIR=psiEqn.solve().initialResidual(); Info<< "psiIR = " << psiIR << endl; 1': lduMatrix::solverPerformance sp = psiEqn.solve(); psiIR=sp.initialResidual(); Info<< "psiIR = " << psiIR << endl; logs 1 or 1': DICPCG: Solving for psi, Initial residual = 1, Final residual = 3.38224e-17, No Iterations 1 psiIR = 1 DICPCG: Solving for psi, Initial residual = 1, Final residual = 1.60809e-19, No Iterations 1 psiIR = 1 DICPCG: Solving for psi, Initial residual = 1, Final residual = 9.66389e-17, No Iterations 1 psiIR = 1 and so on, the initial residual is fixed to one so that the convergence criterium can't be reached. Resolutions 2 and 2' : 2: psiEqn.solve(); lduMatrix::solverPerformance sp = psiEqn.solve(); psiIR=sp.initialResidual(); Info<< "psiIR = " << psiIR << endl; 2': psiEqn.solve(); psiIR=psiEqn.solve().initialResidual(); Info<< "psiIR = " << psiIR << endl; Logs 2 or 2': before steady state, no problem : DICPCG: Solving for psi, Initial residual = 0.0582326, Final residual = 4.93904e-20, No Iterations 1 DICPCG: Solving for psi, Initial residual = 3.70557e-16, Final residual = 3.70557e-16, No Iterations 0 psiIR = 3.70557e-16 and that's it, the residual is under the convergence criterium and the computation moves to the next time step. but as soon as the steady state is reached, the resolution made by the line to get the initial residual (e.g.: psiIR=psiEqn.solve().initialResidual() makes the initial residual increases and thus impairs convergence : DICPCG: Solving for psi, Initial residual = 0.0436467, Final residual = 2.58946e-15, No Iterations 1 DICPCG: Solving for psi, Initial residual = 0.166518, Final residual = 1.86296e-14, No Iterations 1 psiIR = 0.166518 DICPCG: Solving for psi, Initial residual = 0.0436467, Final residual = 2.58946e-15, No Iterations 1 DICPCG: Solving for psi, Initial residual = 0.166518, Final residual = 1.86296e-14, No Iterations 1 psiIR = 0.166518 DICPCG: Solving for psi, Initial residual = 0.0436467, Final residual = 2.58946e-15, No Iterations 1 DICPCG: Solving for psi, Initial residual = 0.166518, Final residual = 1.86296e-14, No Iterations 1 psiIR = 0.166518 and so on, so that the convergence criteria (initial residual less than 0.1 here) can't be reached and the computation diverge. Yahoo, babala and sima_op like this.

 March 6, 2013, 13:59 #2 New Member   Join Date: Apr 2012 Posts: 21 Rep Power: 7 Did you figured out how to fix your problem with initial residual? I am trying to solve equation fvScalarMatrix CEqn ( fvm::ddt(C) + fvm::div(phi, C) ); CeqnResidual = CEqn.solve().initialResidual(); In case where phi is zero (i.e. no flow), my initial residuals are always high (~ 0.3). When I am forcing the solver to exit without satisfying the convergence criterion (by setting a maximum for the iterations), I see that phi is zero everywhere and C is constant, as I expect. But, I don't know why CeqnResidual is high!

 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 almir OpenFOAM Running, Solving & CFD 83 July 22, 2017 08:26 sebastian OpenFOAM Running, Solving & CFD 14 September 21, 2016 10:47 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 11:08 heavy_user OpenFOAM 16 February 11, 2012 06:15 cyberbrain OpenFOAM 4 March 16, 2011 10:20

All times are GMT -4. The time now is 22:45.