I write a code in C using mkl FGMRES to solve a Ax=b linear system. I follow the example code given in mkl handbook here: http://sepwww.stanford.edu/sep/claudio/Research/Prst_ExpRefl/ShtPSPI/int..., which use ILU0 as the preconditioner. The structure of the code is almost the same as the example code so I don't put it here. Now I met a problem. For some problems, my code can solve the problem successfully; but sometimes it can not.
For example, today it happens like this: I put A, b and initial guess solution into the code, when it run after calling dfgmres function, depending on the value of RCI_request parameter, it will do different operations (for example if RCI_request = 0, then we get the answer; if RCI_request = 1, we should do what what). This example will keep repeat RCI_request = 1 and RCI_request = 3, and the while loop in the code will not stop and I can not get the answer. My guess is that the matrix A doesn't have a good property (for example condition number is too large,etc) and the solver can not deal with it. But I am not sure about this. My question is in what condition the RCI_request can repeat between 1 and 3? How can I make sure this is because of the bad property of the input matrix A? If this is ture, does it mean FGMRES can not solve this problem?
Another question is about the preconditioner. In the example code, it used ilu0 as the preconditioner. If the solver can not deal with one problem well, if I change to a different preconditioner (like LU), will it help or not?
Also, which parameter, the number of rows N in the matrix, or the number of non-zeros M in matrix A will determine the scalibility of this FGMERES solver?