I think that `callback` is called once for each outer cycle, and the default inner number of iterations is 30, so 30 x 5 = 150 iterations, it seems more realistic.

Pierre Seize


On 09/12/20 17:25, Stefano Zampini wrote:
Could it be that scipy lgmres is reporting the wrong number of iterations?

I would try to replicate the scipy code first https://github.com/scipy/scipy/blob/master/scipy/sparse/linalg/isolve/lgmres.py

Il Mer 9 Dic 2020, 19:17 Florian Bruckner <[email protected] <mailto:[email protected]>> ha scritto:

    Dear PETSc developers,
    I am currently re-implementing our FEM-BEM code using Firedrake.
    The original code we were using is based on FEniCS and uses scipy
    sparse solvers for the solution of the coupled FEM / BEM system.

    For some reason the scipy lgmres method seems to outperform all
    other methods which we tried. E.g. for the strayfield-calculation
    of a 10x10x10 unit cube scipy-lgmres needs 5 iterations (without
    preconditioner), whereas scipy-gmres needs 167. The new
    implementation uses petsc-gmres and petsc-lgmres, but both need
    around 170 iterations.

    If I understand lgmres correctly it only improves convergence if
    gmres is restarted. Since it only needs 5 iterations i think this
    cannot be the reason. But nevertheless since the method seems to
    perform very good, it would be worth looking at the differences in
    detail. I provide the dense data of the system-matrix and
    right-hand-side vector that I used, as well as scripts for the
    different considered methods.

    Any ideas how scipy-lgmres could be that good? It would be nice if
    someone could validate my results (lgmres solves within 5
    iterations). For me the next step will be to wrap scipy-lgmres
    using petsc4py. I know how to do it with petsc4py directly, but I
    am not exactly sure how it works with the firedrake interface.

    best wishes
    Florian


Reply via email to