<div dir="ltr"><div dir="ltr">On Mon, Dec 5, 2022 at 3:08 AM 袁煕 <<a href="mailto:yuanxi@advancesoft.jp">yuanxi@advancesoft.jp</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear PETSc developers,<div><br></div><div>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: </div><div><br></div><div>1.  Add my solver name into MatSolverType.</div><div>2.  Register my solver by calling MatSolverTypeRegister</div><div><br></div><div>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</div><div><br></div><div>1. Am I doing it the right way? And if so</div><div>2. How to set such parameters as MatFactorType, lufactorsymbolic, lufactornumeric.</div></div></blockquote><div><br></div><div>This was a misunderstanding. If it is an iterative solver, you can follow the template for Jacobi:</div><div><br></div><div>  <a href="https://gitlab.com/petsc/petsc/-/blob/main/src/ksp/pc/impls/jacobi/jacobi.c">https://gitlab.com/petsc/petsc/-/blob/main/src/ksp/pc/impls/jacobi/jacobi.c</a></div><div><br></div><div>There are comments throughout this file showing you how to register your own preconditioner. You should not need to alter PETSc source.</div><div>I have done this myself with the BAMG preconditioner.</div><div><br></div><div>  Thanks,</div><div><br></div><div>      Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Many thanks,</div><div><br></div><div>Yuan</div><div>Ph.D. in Solid Mechanics</div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>