[petsc-users] syntax for routine in PCMGSetResidual

Timothée Nicolas timothee.nicolas at gmail.com
Thu Nov 12 18:47:40 CST 2015


Hi all,

In the manual and the documentation, the syntax for the routine to be given
as argument of PCMGSetResidual:

PCMGSetResidual
<http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/PC/PCMGSetResidual.html#PCMGSetResidual>(PC
pc,PetscInt <http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Sys/PetscInt.html#PetscInt>
l,PetscErrorCode
<http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode>
(*residual)(Mat
<http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Mat/Mat.html#Mat>,Vec
<http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Vec/Vec.html#Vec>,Vec
<http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Vec/Vec.html#Vec>,Vec
<http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Vec/Vec.html#Vec>),Mat
<http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Mat/Mat.html#Mat>
mat)


is not specified. I mean that the order of the vectors is not specified. I
suppose it is something like
residual(Mat,b,x,r) with r = b - Mat*x, but it could as well be any
combination like residual(Mat,r,x,b). There is no example in the
documentation of the usage so I am confused. Does it absolutely need to be
set ? I find the manual a bit confusing on this point. Is it only if
matrix-free matrices are used ?

In the present situation, I use matrix-free operators in a multigrid
preconditioner (but the interpolation and restriction are not matrix free)
and have not set this residual function yet. I get the following error:

[13]PETSC ERROR: Preconditioner number of local rows -1 does not equal
resulting vector number of rows 67584

Could this be related ? By the way, I don't understand what is meant by the
"preconditioner number of local rows". I have separately tested the
operators at each level and they are fine.

Best

Timothee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20151113/c2f1b607/attachment.html>


More information about the petsc-users mailing list