[petsc-dev] PCFieldSplit broken, what was intended?

Barry Smith bsmith at mcs.anl.gov
Fri May 27 11:35:44 CDT 2011


   Jed,

      I see the problem, but I don't see a clean easy fix.

       I need a way to detect if PCReset()) was called. I used the fact that if setupcalled == 0 and ilink existed as my marker of PCReset() being called. But if you set fields before got  PCFieldSplitSetDefaults() called then you also have ilink existing and pcsetupcalled, so you enter this block of code unnecessarily.

       I quick and dirty fix would be to add a reset flag into PC_Fieldsplit and then do this block of code only if that reset flag is true then turn off the reset flag. 

     BTW: once we have PetscLayout containing field information we should totally rewrite the PCFIELDSPLIT to simplify and rationalize it, it has gotten rather messy.

    Barry


On May 27, 2011, at 9:01 AM, Jed Brown wrote:

> This is broken even when PCReset() is not called:
> 
> changeset:   19062:65bdb5e3e7bc
> parent:      19059:6987fe7e0c0d
> user:        Barry Smith <bsmith at mcs.anl.gov>
> date:        Thu May 26 22:00:00 2011 -0500
> summary:     fixed PCReset_FieldSplit() to work in certain cases
> 
> I see comments indicating that you agree the code is horrible ("if I got here, it must mean I was called from X"), but I don't know what you were trying to do. In particular, neither this predicate nor its negation agree with the comment.
> 
>   } else if (!pc->setupcalled) {
>     /* PCReset() has been called on this PC ...
> 
> 
> make runex19_fieldsplit_2
> #0  PetscError (comm=0x865dc0, line=312, func=0x7ffff77e1dd0 "PCFieldSplitSetDefaults", file=0x7ffff77e0f20 "/home/jed/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c", dir=0x7ffff77e0d43 "", n=56, p=PETSC_ERROR_INITIAL, mess=0x7ffff77e1280 "Cases not yet handled when PCReset() was used") at /home/jed/petsc/src/sys/error/err.c:336
> #1  0x00007ffff749b09c in PCFieldSplitSetDefaults (pc=0x916160) at /home/jed/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c:312
> #2  0x00007ffff749b324 in PCSetUp_FieldSplit (pc=0x916160) at /home/jed/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c:333
> #3  0x00007ffff73e27a5 in PCSetUp (pc=0x916160) at /home/jed/petsc/src/ksp/pc/interface/precon.c:819
> #4  0x00007ffff74ccaf4 in KSPSetUp (ksp=0x8de370) at /home/jed/petsc/src/ksp/ksp/interface/itfunc.c:261
> #5  0x00007ffff74cde16 in KSPSolve (ksp=0x8de370, b=0x8a7d20, x=0xaa1510) at /home/jed/petsc/src/ksp/ksp/interface/itfunc.c:383
> #6  0x00007ffff7bc1f0f in SNES_KSPSolve (snes=0x8b1860, ksp=0x8de370, b=0x8a7d20, x=0xaa1510) at /home/jed/petsc/src/snes/interface/snes.c:3124
> #7  0x00007ffff7b7a50b in SNESSolve_LS (snes=0x8b1860) at /home/jed/petsc/src/snes/impls/ls/ls.c:190
> #8  0x00007ffff7bbb3ac in SNESSolve (snes=0x8b1860, b=0x0, x=0x8714e0) at /home/jed/petsc/src/snes/interface/snes.c:2424
> #9  0x00007ffff7b6a210 in DMMGSolveSNES (dmmg=0x857bd0, level=0) at /home/jed/petsc/src/snes/utils/damgsnes.c:540
> #10 0x00007ffff7b621b6 in DMMGSolve (dmmg=0x857bd0) at /home/jed/petsc/src/snes/utils/damg.c:331
> #11 0x00000000004023f7 in main (argc=17, argv=0x7fffffffd588) at ex19.c:155
> 




More information about the petsc-dev mailing list