[petsc-dev] setting field split pc correctly

Jed Brown jed at 59A2.org
Sat May 15 10:18:06 CDT 2010


On Sat, 15 May 2010 09:40:06 -0500, Chris Kees <christopher.e.kees at usace.army.mil> wrote:
> Hi,
> 
> I appear to be setting the index sets properly now through the  
> petsc4py wrappers (using the existing interface) that Lisandro and I  
> added. I can't seem to set the options on the KSP/PC for the splits  
> though. My options look like this:
> 
> -navierStokes_fieldsplit_type MULTIPLICATIVE -navierStokes_ksp_type  
> bcgsl -navierStokes_ksp_rtol 0.0 -navierStokes_ksp_atol 1.0e-10 - 
> navierStokes_ksp_monitor_true_residual -ksp_type bcgsl -ksp_rtol 0.0 - 
> ksp_atol 1.0e-10    -navierStokes_fieldsplit_0_ksp_type preonly - 
> navierStokes_fieldsplit_0_pc_type boomeramg - 
> navierStokes_fieldsplit_1_ksp_type fgmres - 
> navierStokes_fieldsplit_1_pc_type none - 
> navierStokes_fieldsplit_1_ksp_norm_type NO - 
> navierStokes_fieldsplit_1_ksp_max_it 3
> 
> In the code I call
>          self.pc.setOptionsPrefix(prefix)
>          self.ksp.setOptionsPrefix(prefix)
>          self.ksp.setFromOptions()
>          self.pc.setFromOptions()

It should be enough to just call ksp.setOptionsPrefix() and
ksp.setFromOptions() since it will set the prefix on all lower-level
objects (same for SNES and TS).

> The output of KSPView before each KSP solve is below. The split's use  
> none,bjacobi. I'm guessing I'm making some kind of rookie mistake... - 
> Chris
> 
> KSP Object:(navierStokes_)
>    type: bcgsl
>      BCGSL: Ell = 2
>      BCGSL: Delta = 0
>    maximum iterations=1000, initial guess is zero
>    tolerances:  relative=0, absolute=1e-10, divergence=10000
>    left preconditioning
>    using PRECONDITIONED norm type for convergence test
> PC Object:(navierStokes_)
>    type: fieldsplit
>      FieldSplit with MULTIPLICATIVE composition: total splits = 2,  
> blocksize = -1
>      Solver info for each split is in the following KSP objects:
>      Split number 0 Defined by IS
>      KSP Object:(fieldsplit_0_)

                   ^^^^^^^^^^^^^^

Apparently the inner KSP did not acquire the "navierStokes_" prefix.
The options you have at the top would take effect if you drop that
prefix.  BUT, it should retain the prefix from the parent, and
petsc-3.1/petsc-dev called from C certainly do.  If you have a test case
that exhibits this behavior, I'll figure out why the prefix didn't
propagate.  (Send it off-list if it's large or if you want it kept
private.)

Jed



More information about the petsc-dev mailing list