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

Mills, Richard Tran rtmills at anl.gov
Sun Mar 3 22:17:47 CST 2019

```Alright, I see the source of my confusion: I've now seen three different that are all called a "Constrained Pressure Residual" preconditioner. What I have generally seen is exactly what Matt describes: R is just a restriction to a subset of DoFs (pressure, and sometimes saturation), and P is just R' (using Matlab notation here). A CPR preconditioner in which P differs from R' is not something I've seen until now.

I'll see if I can think of a succinct change to the documentation for PCFIELDSPLIT to describe the two cases and submit a pull request.

--Richard

On 3/3/19 8:38 AM, Jed Brown wrote:

Matthew Knepley <knepley at gmail.com><mailto: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<mailto: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
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);
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190304/89740347/attachment-0001.html>
```