[petsc-users] Inquiry about the preconditioner setup of KSP.

Xiaodong Liu xliu29 at ncsu.edu
Tue Mar 3 22:00:43 CST 2020


I am trying to use Julia to call Petsc.
1) First, I run the built-in example ex2.c
https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/pc/examples/tutorials/ex2.c.html

For this case,  I tried KSPGMRES , initial zero solution and different PC
(LU, ILU, ICC, JACOBI). And they work as expected.

 75: KSPSetType(ksp,KSPGMRES);
 76: KSPSetInitialGuessNonzero(ksp,PETSC_FALSE);
 87: KSPGetPC(ksp,&pc);
 88: PCSetType(pc,PCICC);

2) Second, I tried to call KSP from Julia using the same matrix and right
hand side as ex2.c . A wrapper has been written to call Petsc code from
Julia. After I transfer matrix to from Julia to Petsc, I checked the matrix
and preconditioner matrix in the context of Petsc. These two matrices are
right. For no preconditioner,Jacobi precontioner and LU, the residual for
Julia version is same as that of original Petsc one for every iteration.
However, for ILU preconditioner, the residual for Julia is alwaysthe same
as the LU one. This is not expected. For both Julia and original Petsc
version, I checked the PC type inside the subroutine PCSetType and the
types are correct, namely ilu.I am trying to dig into the source code to
check how the preconditioner is interacting with GMRES.

Where is the subroutine for the GMRES solver, namely,
 ierr=(*KSP->ops->solve)(ksp);

Or do you have any suggestions?

Thanks,

Xiaodong Liu, PhD
X: Computational Physics Division
Los Alamos National Laboratory
P.O. Box 1663,
Los Alamos, NM 87544
505-709-0534
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200303/13fecb96/attachment.html>


More information about the petsc-users mailing list