# Number of GMRES iterations increase when stepping forward in time, using the Newton method

I am solving a system of nonlinear time-dependent equations using the Newton method in a finite-element-setting, i.e. first I create the jacobian matrix for the current time, and afterwards I try to solve the system (using a GMRES-solver, preconditioned using the AMG-method) to get the solution update. This is repeated until the residual does not get smaller anymore, then the time is increased by one time step. For each time step the necessary GMRES iterations are recorded.
Now I noticed that initially the GMRES iterations stay constant at 50 iterations for each time step, but after a certain time (depending on the input parameters) they increase suddenly to 75-100 iterations, and in the next time step the solver fails to converge at all (even after >10000 iterations).
Several suggestions are given here: Why is my iterative linear solver not converging?, but implementing those suggestions will take some time, thus, if there are already some hints based on the behaviour I could use giving me an initial idea, that would reduce the time necessary for finding the bug.
Furthermore, using a direct solver is not possible, after I currently am using > 40kk elements (which is way to big for the memory available). In order to calculate the equations correctly without introducing oscillations, I can not reduce the amount of elements.

• I am discretizing my time step using the Crank-Nicholson-method, to avoid instabilities
• My system consists out of three coupled non-linear heat-equation-like equations, which are strongly coupled during solving
• I am using a fixed time step and a fixed mesh density
• My system has ~40e6 degrees of freedom. Usually (for smaller systems) I allow the solver to use as many iterations as I have degrees of freedom, but here I wanted to investigate the behavior of the system, thus I reduced the amount of allowed iterations. In addition, ~50 iterations take ~50 seconds, thus allowing 40e6 iterations will stop solving the program entirely.
• Currently I am using 28 krylov vectors (default setting of the solver), but can change that. If there are suggestions for the size I should use instead, I can implement that, though
• Preconditioning is from the left
• If I'm understanding you correctly, you're using Newton's method for the nonlinear implicit time step? What's you're time discretization. Can you be more specific with your problem? What is you solution strategy? Do you have CFL ramping, what are you simulating... – EMP Sep 1 at 9:00
• Also, how many unknowns do you have? You say you did 10000 GMRES iterations, but how many krylov vectors per iteration? – EMP Sep 1 at 12:15
• @EMP: I hope I could address all your comments in the edited question – arc_lupus Sep 2 at 5:47
• Thanks for the update. But I think the most important piece of information is how many krylov vectors are you using? Restarted GMRES can stagnate, so if be curious to know how many krylov vectors per iteration and are you left or right or flexible preconditioned. – EMP Sep 2 at 10:37
• @EMP: Added, but those values can be changed. Unfortunately, I am not that familiar with those settings, thus suggestions for improvement are welcome. – arc_lupus Sep 2 at 11:03

You begin with a linear system: $$Ax = b$$ and you want to find an x vector such that $$r = b - Ax = 0$$ You begin with some guess for x (usually x = 0) and you get a residual vector $$r_0 = b$$ and this will be your search direction (v vector), so you normalize it and multiply it by the A matrix to get a w vector. This vector gets dotted with each previous search direction (v vector) and then the w vector gets subtracted from it the components that were along each previously used search direction. this w vector gets normalized and becomes the new search direction. you go up to the top and repeat. The thing to notice is that this is the description for the full GMRES solver and it is guaranteed to obtain the solution to the linear system after using at most the number of unknowns of the system for the search direction. It is obviously untenable to use this many search directions, as each search direction has n elements for the nxn system. This would mean that for n search directions we're storing a full nxn system, which is clearly expensive; so we use restarted GMRES. Restarted GMRES uses a given number of krylov vectors, usually far fewer than the number of columns, and will loop over this partial GMRES solver, now with $$x_0 \neq 0$$ and resuming with the last guess for $$x$$. Restarted GMRES is far more efficient memorywise, but it can stagnate, so oftentimes peoples will use various preconditioners or varying numbers of krylov vectors to help solve the stiffer problems.