<div dir="ltr">Thanks,  <div><br></div><div>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.</div><div><br></div><div>You seem to be destroying the PC with PCDestroy (or KSPDestroy).  Is that right?<br></div><div><br></div><div>Can you please test this and see if works, without your fix?</div><div><br></div><div> 'git fetch; git checkout mark/gamg-crs', </div><div><br></div><div>Mark</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 17, 2015 at 1:03 PM, Stephan Kramer <span dir="ltr"><<a href="mailto:s.kramer@imperial.ac.uk" target="_blank">s.kramer@imperial.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 17/06/15 17:37, Mark Adams wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
        Second question (less important): I didn't manage to change this<br>
        at the command line. I would have thought -mg_coarse_ksp_type<br>
        preonly should have done the trick but seemed to be ignored.<br>
        Instead I had to do it with some calls in the code:<br>
<br>
<br>
<br>
Humm, this seems to work for me (I just cut and pasted this).  Can you<br>
try using -options_left.<br>
<br>
</blockquote>
<br></span>
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:<br>
<br>
1) it sets it to KSPCHEBY on mg.c:226<br>
2) it overwrites it with KSPPREONLY on mg.c:240 - I guess this is the expected behaviour<br>
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<br>
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<br>
<br>
(all line numbers refer to petsc master)<br>
<br>
So I'm guessing it's that last one causing me trouble<br>
<br>
Cheers<span class="HOEnZb"><font color="#888888"><br>
Stephan<br>
<br>
</font></span></blockquote></div><br></div>