preconditioner for matrix-free linear system

Yongcheng Zhou yongcheng.zhou at
Tue Apr 14 13:50:01 CDT 2009

Thanks Matt, Satish and Barry. I think I have to convert my matrix into a PETSc
matrix in block AIJ type. I wan reluctant to do this since I might need to solve
linear system many times and I had preferred to use matrix free approach.

Another question. In calling PETSc for solving the linear system for the
second time, I got this:

  You can not initialize PETSc a second time!

But I did destroy and finalized last PETSc structure, via


Any suggestion is greatly welcome!


On Tue, Apr 14, 2009 at 12:28 PM, Barry Smith <bsmith at> wrote:
> "PETSc's powerful preconditioners" are constructed from knowledge about the
> matrix entries; if you do not provide any information about the matrix
> entries it cannot
> construct any preconditioners. You need to provide the matrix as a PETSc
>  AIJ or BAIJ Mat
> in order to use those preconditioners.
>  Barry
> On Apr 14, 2009, at 1:04 PM, Yongcheng Zhou wrote:
>> hi there,
>> I want to link my own package with PETSc in order to make use of its
>> various preconditioners.  I am using
>> matrix free method, so that I can directly refer the large matrix
>> saved in my own format. The connection
>> works OK without preconditioners, but runs into trouble when most of
>> the preconditioners is called.
>> For example, I got this message when using PCICC preconditionder:
>> Matrix format shell does not have a built-in PETSc direct solver!
>> So my question is how to utilize PETSc's powerful preconditioners for
>> my matrix-free application.
>> Thanks,
>> Rocky

More information about the petsc-users mailing list