[petsc-users] shell preconditioner for Schur complement

Barry Smith bsmith at petsc.dev
Wed Feb 10 23:41:41 CST 2021


  Best to just look at the code to see exactly what it is doing: src/ksp/pc/impls/fieldsplit/fieldsplit.c  function PCApply_FieldSplit_Schur()

  There is no particular "scaling" applied to the vectors. It might be easiest to track through the computational process with the debugger (you can call VecView(v,0) in the debugger anytime to see the current vector) to see why the "scaling" seems to change.

  Barry



> On Feb 10, 2021, at 10:46 AM, Matteo Semplice <matteo.semplice at uninsubria.it> wrote:
> 
> Dear PETSc users,
>     we are trying to program a preconditioner for the Schur complement of a Stokes system, but it seems that the r.h.s. for the Schur complement system differs from what we expect by a scale factor, which we don't understand.
> 
> Our setup has a system matrix A divided in 2x2 blocks for velocity and pressure variables. We have programmed our preconditioner in a routine PrecondSchur and in the main program we do
> 
> PC pc;
> KSPGetPC(kspA,&pc);
> PCSetFromOptions(pc);
> KSPSetOperators(kspA, A, A);
> KSPSetInitialGuessNonzero(kspA,PETSC_FALSE);
> KSPSetFromOptions(kspA);
> KSP *subksp;
> PetscInt nfield;
> PCSetUp(pc);
> PCFieldSplitGetSubKSP(pc, &nfield, &subksp);
> PC pcSchur;
> KSPGetPC(subksp[1],&pcSchur);
> PCSetType(pcSchur,PCSHELL);
> PCShellSetApply(pcSchur,PrecondSchur);
> KSPSetFromOptions(subksp[1]);
> 
> and eventually
> 
> KSPSolve(A,b,solution);
> 
> We run the code with options
> 
>  -ksp_type fgmres \
>  -pc_type fieldsplit -pc_fieldsplit_type schur \
>  -pc_fieldsplit_schur_fact_type full \
> 
> and, from reading section 2.3.5 of the PETSc manual, we'd expect that the first r.h.s. passed to PrecondSchur be exactly
>     b_1-A_10*inv(A_00)*b_0
> 
> Instead (from a monitor function attached to the subksp[1] solver), the first r.h.s. appears to be scalar multiple of the above vector; we are guessing that we should take into account this multiplicative factor in our preconditioner routine, but we cannot understand where it comes from and how its value is determined.
> 
> Could you explain us what is going on in the PC_SCHUR exactly, or point us to some working code example?
> 
> Thanks in advance!
> 
>     Matteo
> 



More information about the petsc-users mailing list