[petsc-dev] Note about CPR preconditioner in PCFIELDSPLIT man page?

Jed Brown jed at jedbrown.org
Sun Mar 3 10:38:09 CST 2019


Matthew Knepley <knepley at gmail.com> writes:

> On Sun, Mar 3, 2019 at 12:58 AM Jed Brown via petsc-dev <
> petsc-dev at mcs.anl.gov> wrote:
>
>> My take is that someone looking for CPR is more likely to end up on the
>> PCFIELDSPLIT manual page than the PCGALERKIN page.  The solver you have
>> configured in your mail is not the CPR we have been asked about here.
>> See Barry's message and example code below.
>>
>
> Thanks for retrieving this Jed. I am sure Richard and I both have the same
> question. Perhaps I am being an idiot.
> I am supposing that R is just a restriction to some subset of dofs, so its
> just binary, so that R A P just selects that
> submatrix.

Look at the source.  These are not subsets:

 /*
     Apply the restriction operator for the Galkerin problem
 */
 PetscErrorCode ApplyR(Mat A, Vec x,Vec y)
 {
   PetscErrorCode ierr;
   PetscInt       b;
   PetscFunctionBegin;
   ierr = VecGetBlockSize(x,&b);CHKERRQ(ierr);
   ierr = VecStrideGather(x,0,y,INSERT_VALUES);CHKERRQ(ierr);
   for (PetscInt k=1;k<b;++k) {ierr = VecStrideGather(x,k,y,ADD_VALUES);CHKERRQ(ierr);}
   PetscFunctionReturn(0);
 }

 /*
     Apply the interpolation operator for the Galerkin problem
 */
 PetscErrorCode ApplyP(Mat A, Vec x,Vec y)
 {
   PetscErrorCode ierr;
   PetscInt       offset = 1;
   PetscFunctionBegin;
   ierr = VecStrideScatter(x,offset,y,INSERT_VALUES);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }


More information about the petsc-dev mailing list