<div class="gmail_quote">On Sun, May 6, 2012 at 11:47 AM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":nh"> I see. So if the Mat is not known when PCSetFromOptions() is called then PCSetFromOptions() generates a bad guess for the PC to use.<br>
<br>
Presumably this has always been true.<br></div></blockquote><div><br></div><div>Sure, but with DMMG, the top level PC was always set to PCMG and the PCSetFromOptions() on levels was not called until later:</div><div><br>
</div><div><div>#0 PCGetDefaultType_Private (pc=0xc295e0, type=0x7fffffff8c18) at /home/jed/petsc-3.2/src/ksp/pc/interface/precon.c:20</div><div>#1 0x00007ffff74d083e in PCSetFromOptions (pc=0xc295e0) at /home/jed/petsc-3.2/src/ksp/pc/interface/pcset.c:177</div>
<div>#2 0x00007ffff7554723 in KSPSetFromOptions (ksp=0xc27410) at /home/jed/petsc-3.2/src/ksp/ksp/interface/itcl.c:286</div><div>#3 0x00007ffff74a8765 in PCSetUp_MG (pc=0xaa6e20) at /home/jed/petsc-3.2/src/ksp/pc/impls/mg/mg.c:575</div>
<div>#4 0x00007ffff74c7946 in PCSetUp (pc=0xaa6e20) at /home/jed/petsc-3.2/src/ksp/pc/interface/precon.c:819</div><div>#5 0x00007ffff755a2ab in KSPSetUp (ksp=0xaa4c50) at /home/jed/petsc-3.2/src/ksp/ksp/interface/itfunc.c:260</div>
<div>#6 0x00007ffff755b549 in KSPSolve (ksp=0xaa4c50, b=0x8b1280, x=0xc86190) at /home/jed/petsc-3.2/src/ksp/ksp/interface/itfunc.c:379</div><div>#7 0x00007ffff7b7dc90 in SNES_KSPSolve (snes=0xaa2a10, ksp=0xaa4c50, b=0x8b1280, x=0xc86190) at /home/jed/petsc-3.2/src/snes/interface/snes.c:3396</div>
<div>#8 0x00007ffff7b93e23 in SNESSolve_LS (snes=0xaa2a10) at /home/jed/petsc-3.2/src/snes/impls/ls/ls.c:190</div><div>#9 0x00007ffff7b76b82 in SNESSolve (snes=0xaa2a10, b=0x0, x=0x8dce10) at /home/jed/petsc-3.2/src/snes/interface/snes.c:2676</div>
<div>#10 0x00007ffff7b56774 in DMMGSolveSNES (dmmg=0x874ff0, level=1) at /home/jed/petsc-3.2/src/snes/utils/damgsnes.c:540</div><div>#11 0x00007ffff7b4e712 in DMMGSolve (dmmg=0x874ff0) at /home/jed/petsc-3.2/src/snes/utils/damg.c:331</div>
<div>#12 0x0000000000415f06 in main (argc=14, argv=0x7fffffffd6f8) at ex48.c:1541</div></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":nh">
<br>
Presumably the PCSetFromOptions() has access to the DM? Can it inquire of the DM what PC to default to if the Mat is not available?</div></blockquote></div><br><div>Yeah, but PCGetDefaultType_Private() was trying not to switch on the matrix type, instead inquiring about functionality</div>
<div><br></div><div><div> ierr = MatGetFactorAvailable(pc->pmat,"petsc",MAT_FACTOR_ICC,&flg1);CHKERRQ(ierr);</div><div> ierr = MatGetFactorAvailable(pc->pmat,"petsc",MAT_FACTOR_ILU,&flg2);CHKERRQ(ierr);</div>
</div><div> ierr = MatIsSymmetricKnown(pc->pmat,&set,&flg3);CHKERRQ(ierr);</div><div><br></div><div>I suppose we could eagerly create pc->pmat here if a DM is available. Alternatively, we could check the refinement level of the DM and make PCMG the default, though I'm not sure we want ex5 to do MG by default.</div>