[petsc-users] How to introduce external iterative solver into PETSc
袁煕
yuanxi at advancesoft.jp
Mon Dec 5 19:55:22 CST 2022
Dear Matt
It seems that I am in the wrong way! I will retry following your example.
Thanks a lot!
Yuan
2022年12月5日(月) 22:11 Matthew Knepley <knepley at gmail.com>:
> On Mon, Dec 5, 2022 at 3:08 AM 袁煕 <yuanxi at advancesoft.jp> wrote:
>
>> Dear PETSc developers,
>>
>> I have my own linear solver and am trying to put it into PETSc as an
>> external solver. Following the implementation of mumps, mkl_cpardiso,
>> supelu etc, I think I should do the follow:
>>
>> 1. Add my solver name into MatSolverType.
>> 2. Register my solver by calling MatSolverTypeRegister
>>
>> to let petsc record the existence of a new solver. The problem is that
>> the above external solvers are all direct solvers, and a MatFactorType
>> parameter should be set to indicate its factorization type, such as LU, QR,
>> or Cholesky. But my solver is an iterative one, that means I cannot specify
>> its MatFactorType. I wish to understand
>>
>> 1. Am I doing it the right way? And if so
>> 2. How to set such parameters as MatFactorType,
>> lufactorsymbolic, lufactornumeric.
>>
>
> This was a misunderstanding. If it is an iterative solver, you can follow
> the template for Jacobi:
>
>
> https://gitlab.com/petsc/petsc/-/blob/main/src/ksp/pc/impls/jacobi/jacobi.c
>
> There are comments throughout this file showing you how to register your
> own preconditioner. You should not need to alter PETSc source.
> I have done this myself with the BAMG preconditioner.
>
> Thanks,
>
> Matt
>
>
>> Many thanks,
>>
>> Yuan
>> Ph.D. in Solid Mechanics
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221206/40d06143/attachment.html>
More information about the petsc-users
mailing list