|
[Sponsors] |
August 21, 2012, 10:40 |
Problem while getting the initial residual
|
#1 |
Member
Laurent Orgogozo
Join Date: Mar 2011
Location: Toulouse
Posts: 33
Rep Power: 15 |
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. |
|
March 6, 2013, 12:59 |
|
#2 |
New Member
Join Date: Apr 2012
Posts: 21
Rep Power: 14 |
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! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Foam::error::PrintStack | almir | OpenFOAM Running, Solving & CFD | 91 | December 21, 2022 04:50 |
icoLagrangianFoam OF1.6 myNewParticleSolver | heavy_user | OpenFOAM | 23 | June 2, 2020 02:18 |
Compressible Nozzle Flow | sebastian | OpenFOAM Running, Solving & CFD | 14 | September 21, 2016 10:47 |
Extrusion with OpenFoam problem No. Iterations 0 | Lord Kelvin | OpenFOAM Running, Solving & CFD | 8 | March 28, 2016 11:08 |
Full pipe 3D using icoFoam | cyberbrain | OpenFOAM | 4 | March 16, 2011 09:20 |