<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div class="" style=""><span class="" style="">1. About using </span><span style="font-size: 12pt;" class="">PCCOMPOSITE: I didn't state correctly in my first email. Actually, the rank of first preconditioner matrix is, say, half of the rank of the full matrix (the latter is used as the second preconditioner matrix), and the first preconditioner solves half of the unknowns (say, unknowns with odd index), how can I let PETSc know this info, so that the solution of the first preconditioner can be applied to the full matrix and update the full residual before applying the second preconditioner?</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 12pt; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent;
 font-style: normal;"><span style="font-size: 12pt;" class=""><br class="" style=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="font-size: 12pt;" class="">In other words, does </span><span style="font-size: 12pt;" class="">PCCOMPOSITE require that the ranks of all preconditioner matrices be the same as the full matrix?</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 12pt; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="font-size: 12pt;" class=""><br class="" style=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;
 background-color: transparent; font-style: normal;"><span style="font-size: 12pt;" class="">2. If I use </span><span style="font-size: 12pt;" class="">PCFIELDSPLIT, does it also need </span><span style="font-size: 12pt;" class="">PCCOMPOSITE to define multiple preconditioners?</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 12pt; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="font-size: 12pt;" class=""><br></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="font-size: 12pt;" class="">Thanks  a lot,</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 12pt; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
 Grande', sans-serif; background-color: transparent; font-style: normal;"><span style="font-size: 12pt;" class="">Qin</span></div><div class="" style=""><br class="" style=""></div>  <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;" class=""> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;" class=""> <div dir="ltr" class="" style=""> <hr size="1" class="" style="">  <font size="2" face="Arial" class="" style=""> <b class="" style=""><span style="font-weight:bold;" class="">From:</span></b> Barry Smith <bsmith@mcs.anl.gov><br class="" style=""> <b class="" style=""><span style="font-weight: bold;" class="">To:</span></b> Qin Lu <lu_qin_2000@yahoo.com> <br class="" style=""><b class="" style=""><span style="font-weight: bold;" class="">Cc:</span></b> petsc-users <petsc-users@mcs.anl.gov> <br class=""
 style=""> <b class="" style=""><span style="font-weight: bold;" class="">Sent:</span></b> Friday, June 27, 2014 11:41 PM<br class="" style=""> <b class="" style=""><span style="font-weight: bold;" class="">Subject:</span></b> Re: [petsc-users] Combining preconditioners<br class="" style=""> </font> </div> <div class="" style=""><br class="" style=""><br clear="none" class="" style="">On Jun 27, 2014, at 11:22 PM, Qin Lu <<a shape="rect" ymailto="mailto:lu_qin_2000@yahoo.com" href="mailto:lu_qin_2000@yahoo.com" class="" style="">lu_qin_2000@yahoo.com</a>> wrote:<br clear="none" class="" style=""><br clear="none" class="" style="">> Hello,<br clear="none" class="" style="">> <br clear="none" class="" style="">> I would like to combine two preconditioners in PETSc linear solver. The first preconditioner is user defined, the second one is just PETSc ILU, and the residual is updated after application of each preconditioner (the multiplicative
 form). There are two questions:<br clear="none" class="" style="">> <br clear="none" class="" style="">> 1. Shall I use PCShellSetApply to set the user defined preconditioner, and then use PCCompositeAddPC to combine the 2 preconditioners?<br clear="none" class="" style=""><br clear="none" class="" style="">   Yes<br clear="none" class="" style=""><br clear="none" class="" style="">> 2. The user defined preconditioner only applies to part of the components of the unknowns, in other words, the rank of the first preconditioner matrix is less than the rank of the full matrix. How can I let PETSc know how to update the residual after the application of the first preconditioner? Can I define a routine of residual updating for PETSc?<br clear="none" class="" style=""><br clear="none" class="" style="">   At first just use PCCOMPOSITE and let PETSc compute the residual by doing the usual complete matrix-vector product. Usually the cost of
 the matrix vector product is much less then a preconditioner so it is not worth optimizing.<br clear="none" class="" style=""><br clear="none" class="" style="">   If the composed preconditioner works very well and the shell PC affects only a small percentage of the components of the problem then you can switch to PCFIELDSPLIT which does support only updating a portion of the residual.<br clear="none" class="" style=""><br clear="none" class="" style="">   Barry<div class="" id="yqtfd12184" style=""><br clear="none" class="" style=""><br clear="none" class="" style="">> <br clear="none" class="" style="">> Many thanks for your help.<br clear="none" class="" style="">> <br clear="none" class="" style="">> Best Regards,<br clear="none" class="" style="">> Qin<br clear="none" class="" style=""></div><br class="" style=""><br class="" style=""></div> </div> </div>  </div></body></html>