On Sun, May 6, 2012 at 11:47 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>  I see. So if the Mat is not known when PCSetFromOptions() is called then
> PCSetFromOptions() generates a bad guess for the PC to use.
>
>   Presumably this has always been true.
>

Sure, but with DMMG, the top level PC was always set to PCMG and the
PCSetFromOptions() on levels was not called until later:

#0  PCGetDefaultType_Private (pc=0xc295e0, type=0x7fffffff8c18) at
/home/jed/petsc-3.2/src/ksp/pc/interface/precon.c:20
#1  0x00007ffff74d083e in PCSetFromOptions (pc=0xc295e0) at
/home/jed/petsc-3.2/src/ksp/pc/interface/pcset.c:177
#2  0x00007ffff7554723 in KSPSetFromOptions (ksp=0xc27410) at
/home/jed/petsc-3.2/src/ksp/ksp/interface/itcl.c:286
#3  0x00007ffff74a8765 in PCSetUp_MG (pc=0xaa6e20) at
/home/jed/petsc-3.2/src/ksp/pc/impls/mg/mg.c:575
#4  0x00007ffff74c7946 in PCSetUp (pc=0xaa6e20) at
/home/jed/petsc-3.2/src/ksp/pc/interface/precon.c:819
#5  0x00007ffff755a2ab in KSPSetUp (ksp=0xaa4c50) at
/home/jed/petsc-3.2/src/ksp/ksp/interface/itfunc.c:260
#6  0x00007ffff755b549 in KSPSolve (ksp=0xaa4c50, b=0x8b1280, x=0xc86190)
at /home/jed/petsc-3.2/src/ksp/ksp/interface/itfunc.c:379
#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
#8  0x00007ffff7b93e23 in SNESSolve_LS (snes=0xaa2a10) at
/home/jed/petsc-3.2/src/snes/impls/ls/ls.c:190
#9  0x00007ffff7b76b82 in SNESSolve (snes=0xaa2a10, b=0x0, x=0x8dce10) at
/home/jed/petsc-3.2/src/snes/interface/snes.c:2676
#10 0x00007ffff7b56774 in DMMGSolveSNES (dmmg=0x874ff0, level=1) at
/home/jed/petsc-3.2/src/snes/utils/damgsnes.c:540
#11 0x00007ffff7b4e712 in DMMGSolve (dmmg=0x874ff0) at
/home/jed/petsc-3.2/src/snes/utils/damg.c:331
#12 0x0000000000415f06 in main (argc=14, argv=0x7fffffffd6f8) at ex48.c:1541


>
>   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?
>

Yeah, but PCGetDefaultType_Private() was trying not to switch on the matrix
type, instead inquiring about functionality

      ierr =
MatGetFactorAvailable(pc->pmat,"petsc",MAT_FACTOR_ICC,&flg1);CHKERRQ(ierr);
      ierr =
MatGetFactorAvailable(pc->pmat,"petsc",MAT_FACTOR_ILU,&flg2);CHKERRQ(ierr);
      ierr = MatIsSymmetricKnown(pc->pmat,&set,&flg3);CHKERRQ(ierr);

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120506/89ec94fb/attachment.html>

Reply via email to