This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Default solve function outperforms solve from KrylovSolver instance

+3 votes

Hi everybody,
I am experiencing this curious behavior: given a matrix A and two vectors x and b, solving by

dolfin::solve (A,x,b,"gmres","petsc_amg");

is better than solving by

PETScKrylovSolver s("gmres","petsc_amg");
s.solve(A,x,b);

The first solution method takes fewer iterations to converge.

I don't touch the parameters of my instance s and, as far as I can tell from reading through the source code, dolfin::solve simply ends up instantiating a new KrylovSolver with default parameters.

Can anybody help me understand what changes between the two approaches? I would like to use the second, which is preferable, but with the performances of the first.

Thanks in advance!

asked Mar 25, 2015 by Massimiliano Leoni FEniCS User (1,760 points)
...