<div dir="ltr"><div>Perhaps this will help. The code is straight forward but prefixes are used. I've appended the code and a stack trace for the error.</div><div><br></div><div><div> ! create KSP</div><div> call KSPCreate(solver%comm,solver%ksp,ierr)</div>
<div> CHKERRQ(ierr)</div><div> if (solver%prefix.eq.2) then ! turb</div><div> call KSPSetOptionsPrefix(solver%ksp,'s2_',ierr)</div><div> if (sml_mype/sml_pe_per_plane .gt. 0) then ! not first, no monitor</div>
<div> call PetscOptionsClearValue('-s2_ksp_monitor',ierr)</div><div> call PetscOptionsClearValue('-s2_ksp_converged_reason',ierr)</div><div> endif</div><div> else ! 1 field 00 solver, no prefix</div>
<div> call PetscOptionsClearValue('-ksp_monitor',ierr)</div><div> call PetscOptionsClearValue('-ksp_converged_reason',ierr)</div><div> end if</div><div> call KSPSetFromOptions(solver%ksp,ierr)</div>
<div> CHKERRQ(ierr)</div><div><br></div><div> call KSPSetOperators(solver%ksp, solver%Amat, solver%Amat, SAME_NONZERO_PATTERN, ierr )</div><div> CHKERRQ(ierr) </div><div><br></div><div> ! setup solver now that matrix is complete</div>
<div> call KSPSetUp( solver%ksp, ierr ) !!! poisson.F90:213</div></div><div><br></div><div><br></div><div>#10 xgc1_3 () at /global/u2/m/madams/epsi/XGC1_3/main.F90:98 (at 0x00000000004b8ed6)</div><div>#9 setup (grid=..., psn=..., spall=???) at /global/u2/m/madams/epsi/XGC1_3/setup.F90:123 (at 0x00000000004dd3b0)</div>
<div>#8 init_poisson (grid=..., psn=..., iflag_dummy=3) at /global/u2/m/madams/epsi/XGC1_3/poisson.F90:36 (at 0x00000000005b06af)</div><div>#7 init_poisson_solver (grid=..., psn=..., iflag_dummy=3) at /global/u2/m/madams/epsi/XGC1_3/poisson.F90:163 (at 0x00000000005b1f17)</div>
<div>#6 init_1field_solver (grid=..., psn=..., solver=...) at /global/u2/m/madams/epsi/XGC1_3/poisson.F90:213 (at 0x00000000005b2862)</div><div>#5 kspsetup_ (ksp=0x34c7950, __ierr=0x7fffffff5290) at /global/u2/m/madams/petsc_private/src/ksp/ksp/interface/ftn-auto/itfuncf.c:215 (at 0x0000000000a47965)</div>
<div>#4 KSPSetUp (ksp=0xb4e4190) at /global/u2/m/madams/petsc_private/src/ksp/ksp/interface/itfunc.c:278 (at 0x00000000015e1c95)</div><div>#3 PCSetUp (pc=0xb4ea8d0) at /global/u2/m/madams/petsc_private/src/ksp/pc/interface/precon.c:888 (at 0x00000000015a64ec)</div>
<div>#2 PCSetUp_FieldSplit (pc=0xb4ea8d0) at /global/u2/m/madams/petsc_private/src/ksp/pc/impls/fieldsplit/fieldsplit.c:458 (at 0x0000000001b97d69)</div><div>#1 PCFieldSplitSetDefaults (pc=0xb4ea8d0) at /global/u2/m/madams/petsc_private/src/ksp/pc/impls/fieldsplit/fieldsplit.c:440 (at 0x0000000001b979bc)</div>
<div>#0 PetscError (comm=-1006632952, line=440, func=0x2ea40c6 "PCFieldSplitSetDefaults", file=0x2ea3a08 "src/ksp/pc/impls/fieldsplit/fieldsplit.c", n=77, p=PETSC_ERROR_INITIAL, mess=0x2ea4090 "Unhandled case, must have at least two fields, not %d") at /global/u2/m/madams/petsc_private/src/sys/error/err.c:353</div>
<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Nov 30, 2013 at 6:33 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@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 class="im">Mark Adams <<a href="mailto:mfadams@lbl.gov">mfadams@lbl.gov</a>> writes:<br>
<br>
> I tried putting what I thought was the problem in ex54 and you are correct<br>
> it did not cause a problem.<br>
<br>
</div>Okay.<br>
<div class="im"><br>
> I've attached a good and bad "petsc.rc" file from my app and an output file<br>
> with this error. Perhaps you can see how this broke.<br>
<br>
</div>I don't have your app so I don't know what that code looks like. The<br>
two options files are very different. Presumably you can run on one<br>
process and use a debugger to see what happens in<br>
PCFieldSplitSetDefaults. If you think PETSc is mishandling this, please<br>
add a test to PETSc (perhaps a small addition to an existing test) to<br>
demonstrate the issue.<br>
</blockquote></div><br></div>