CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Gmres fails to converge, but LU is fine (http://www.cfd-online.com/Forums/main/116005-gmres-fails-converge-but-lu-fine.html)

 sbabbi April 10, 2013 20:01

Gmres fails to converge, but LU is fine

Hi,
I am working on a finite-element simulation for the 3D prandtl boundary layer equations on a flat plate, using fenics.
I am using P2-P1 elements in the plane normal to the flow, and implicit euler along the stream direction.
Everything works fine if i use the LU method to factorize the Jacobian in the newton solver. On the other hand, gmres fails to converge on the very same matrix.
Now, to my understanding of gmres, there is no way that it can fail if the LU solver converge (am I wrong?).
I tested the gmres solver in other problems, and it works fine. I also tried to coarse the grid and to increase the restart parameter, with no luck.
Are there any particular reasons for which gmres may fail to converge, or is it a bug in my code?

 Jonas Holdeman April 11, 2013 08:54

I have experienced a similar problem in MATLAB and will give you my solution. My lines of code are,

% Parameters for GMRES solver
GM.Tol=1.e-13;
GM.MIter=20;
GM.MRstrt=6;
% parameters for ilu preconditioner
su.type = 'ilutp';
su.droptol = 2.e-5;
[Lm,Um] = ilu(Mat,su); % incomplete LU
Qr = gmres(Mat,RHS,GM.MIter,GM.Tol,GM.MRstrt,Lm,Um,[]); % GMRES

When the drop tolerance su.droptol is too large, GMRES does not converge. Making it sufficiently small has worked in all cases.

According to the documentation, ilutp is supposed to be the default, but the MATLAB code does not follow the documentation in ver. R2012b and must be set as above. I have not checked to see if this has been corrected in R2013a.
The parameter values are those I use in one program and vary for other programs.

 All times are GMT -4. The time now is 14:32.