CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Problem while getting the initial residual

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

Like Tree2Likes
  • 2 Post By Orgogozo

Reply
 
LinkBack Thread Tools Display Modes
Old   August 21, 2012, 10:40
Default Problem while getting the initial residual
  #1
New Member
 
Laurent Orgogozo
Join Date: Mar 2011
Location: Toulouse
Posts: 18
Rep Power: 6
Orgogozo is on a distinguished road
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 and sima_op like this.
Orgogozo is offline   Reply With Quote

Old   March 6, 2013, 13:59
Default
  #2
New Member
 
Join Date: Apr 2012
Posts: 21
Rep Power: 5
Yahoo is on a distinguished road
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!
Yahoo is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 51 June 28, 2015 16:36
icoLagrangianFoam OF1.6 myNewParticleSolver heavy_user OpenFOAM 16 February 11, 2012 06:15
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM 6 April 12, 2011 11:24
Full pipe 3D using icoFoam cyberbrain OpenFOAM 4 March 16, 2011 10:20
Compressible Nozzle Flow sebastian OpenFOAM Running, Solving & CFD 13 October 21, 2010 05:25


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