On Mon, Dec 5, 2022 at 3:08 AM 袁煕 <[email protected]> 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/>
