<div dir="ltr"><div><div><div><div><div><div><div>Hi all,<br><br></div>In the manual and the documentation, the syntax for the routine to be given as argument of PCMGSetResidual:<br><br><pre><a href="http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/PC/PCMGSetResidual.html#PCMGSetResidual">PCMGSetResidual</a>(PC pc,<a href="http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Sys/PetscInt.html#PetscInt">PetscInt</a> l,<a href="http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Sys/PetscErrorCode.html#PetscErrorCode">PetscErrorCode</a> (*residual)(<a href="http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Mat/Mat.html#Mat">Mat</a>,<a href="http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Vec/Vec.html#Vec">Vec</a>,<a href="http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Vec/Vec.html#Vec">Vec</a>,<a href="http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Vec/Vec.html#Vec">Vec</a>),<a href="http://www.mcs.anl.gov/petsc/petsc-3.6/docs/manualpages/Mat/Mat.html#Mat">Mat</a> mat)</pre><br></div>is not specified. I mean that the order of the vectors is not specified. I suppose it is something like<br></div>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 ?<br><br></div>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:<br><br>[13]PETSC ERROR: Preconditioner number of local rows -1 does not equal resulting vector number of rows 67584<br><br></div>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.<br><br></div>Best<br><br></div>Timothee<br></div>