<div dir="ltr"><div dir="ltr">On Wed, Feb 10, 2021 at 11:51 AM Matteo Semplice <<a href="mailto:matteo.semplice@uninsubria.it">matteo.semplice@uninsubria.it</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear PETSc users,<br>
     we are trying to program a preconditioner for the Schur complement <br>
of a Stokes system, but it seems that the r.h.s. for the Schur <br>
complement system differs from what we expect by a scale factor, which <br>
we don't understand.<br>
<br>
Our setup has a system matrix A divided in 2x2 blocks for velocity and <br>
pressure variables. We have programmed our preconditioner in a routine <br>
PrecondSchur and in the main program we do<br>
<br>
PC pc;<br>
KSPGetPC(kspA,&pc);<br>
PCSetFromOptions(pc);<br>
KSPSetOperators(kspA, A, A);<br>
KSPSetInitialGuessNonzero(kspA,PETSC_FALSE);<br>
KSPSetFromOptions(kspA);<br>
KSP *subksp;<br>
PetscInt nfield;<br>
PCSetUp(pc);<br>
PCFieldSplitGetSubKSP(pc, &nfield, &subksp);<br>
PC pcSchur;<br>
KSPGetPC(subksp[1],&pcSchur);<br>
PCSetType(pcSchur,PCSHELL);<br>
PCShellSetApply(pcSchur,PrecondSchur);<br>
KSPSetFromOptions(subksp[1]);<br>
<br>
and eventually<br>
<br>
KSPSolve(A,b,solution);<br>
<br>
We run the code with options<br>
<br>
  -ksp_type fgmres \<br>
  -pc_type fieldsplit -pc_fieldsplit_type schur \<br>
  -pc_fieldsplit_schur_fact_type full \<br>
<br>
and, from reading section 2.3.5 of the PETSc manual, we'd expect that <br>
the first r.h.s. passed to PrecondSchur be exactly<br>
     b_1-A_10*inv(A_00)*b_0<br>
<br>
Instead (from a monitor function attached to the subksp[1] solver), the <br>
first r.h.s. appears to be scalar multiple of the above vector; we are <br>
guessing that we should take into account this multiplicative factor in <br>
our preconditioner routine, but we cannot understand where it comes from <br>
and how its value is determined.<br>
<br>
Could you explain us what is going on in the PC_SCHUR exactly, or point <br>
us to some working code example?<br></blockquote><div><br></div><div>1) It is hard to understand solver questions without the output of -ksp_view</div><div><br></div><div>2) The RHS will depend on the kind of factorization you are using for the system</div><div><br></div><div>  <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCFieldSplitSetSchurFactType.html#PCFieldSplitSetSchurFactType">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCFieldSplitSetSchurFactType.html#PCFieldSplitSetSchurFactType</a></div><div><br></div><div>    I can see which one in the view output</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Thanks in advance!<br>
<br>
     Matteo<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>