On 17/06/15 21:09, Mark Adams wrote:
Thanks,

There are two problems: 1) GAMG is not setting PREONLY & 2) PCSetup_MG
sets the coarse grid KSP, with bjacobi/lu, to GMRES.  I have made a pull
request in to fix this.

You seem to be destroying the PC with PCDestroy (or KSPDestroy).  Is
that right?

Hm not entirely sure what you mean. We destroy the KSP (and thus the PC) after the solve, yes - but that's in any of the lines I gave you.

Can you please test this and see if works, without your fix?

  'git fetch; git checkout mark/gamg-crs',

Great! That fixes everything for me: it uses KSP+PREONLY for mg_coarse by default again and I can also override it with -mg_coarse_ksp_type

Thanks a lot for fixing this
Cheers
Stephan



Mark

On Wed, Jun 17, 2015 at 1:03 PM, Stephan Kramer <s.kra...@imperial.ac.uk
<mailto:s.kra...@imperial.ac.uk>> wrote:

    On 17/06/15 17:37, Mark Adams wrote:



                 Second question (less important): I didn't manage to
        change this
                 at the command line. I would have thought
        -mg_coarse_ksp_type
                 preonly should have done the trick but seemed to be
        ignored.
                 Instead I had to do it with some calls in the code:



        Humm, this seems to work for me (I just cut and pasted this).
        Can you
        try using -options_left.


    It does pick up the -mg_coarse_ksp_type option (so it's not printed
    with -options_left) but gets overwritten later on. I've been tracing
    the various calls to KSPSetType() and it seems to be doing the
    following with the ksp of the coarse solve:

    1) it sets it to KSPCHEBY on mg.c:226
    2) it overwrites it with KSPPREONLY on mg.c:240 - I guess this is
    the expected behaviour
    3) it sets it to KSPPREONLY again on mg.c:717 via KSPSetFromOptions
    - that is, it's picking up the "-mg_coarse_ksp_type preonly" option
    4) it sets it back to KSPGMRES on mg.c:806 - because it seems to
    think that the coarse solve is not a direct solve and therefore
    shouldn't be using preonly. The reason for this is that the direct
    solve is wrapped in a PCBJACOBI (gamg.c:713) and therefore the
    pctype of mg_coarse is not PCLU but PCBJACOBI

    (all line numbers refer to petsc master)

    So I'm guessing it's that last one causing me trouble

    Cheers
    Stephan



Reply via email to