On Wed, Feb 10, 2021 at 11:51 AM Matteo Semplice < matteo.sempl...@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? > 1) It is hard to understand solver questions without the output of -ksp_view 2) The RHS will depend on the kind of factorization you are using for the system https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCFieldSplitSetSchurFactType.html#PCFieldSplitSetSchurFactType I can see which one in the view output Thanks, Matt > Thanks in advance! > > Matteo > > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>