[petsc-users] Some questions about modifying the linear system in SNES
Mark Adams
mfadams at lbl.gov
Thu Jan 8 13:00:52 CST 2026
You don't want to scale the matrix manually. -pc_jacobi_type rowl1
do what you want. And Jacobi is a more common choice.
Mark
On Thu, Jan 8, 2026 at 1:02 PM 陈培群 <logic_imagination at 163.com> wrote:
> $\quad$ Hello, I use `SNESComputeJacobianDefault` to build a
> preconditioning matrix for JFNK and use `MatGetRowSumAbs` to obtain the
> vector for scaling. When I modify the preconditioning matrix in formJacobian
> [`SNESSetJacobian`] and modify rhs and the solution variables in preSolve[
> `KSPSetPreSolve`] and postSolve[`KSPSetPostSolve`] as scaling, I
> encounter the following questions.
> 1. If I need to scale the solution variables, do I need to call `
> SNESGetSolutionUpdate` to scale the increment vector instead of the
> solution vector in `postSolve(KSP /*ksp*/, Vec rhs, Vec x, void * ctx)`?
>
> 2. Whether this can achieve the same scaling effect as `-pc_jacobi_type
> rowl1`, so that the built-in preconditioner scheme of petsc can be
> applied on the basis of the above modified linear system? Or whether this
> will affect the residual used to construct the matrix through the finite
> difference and then lead to the wrong scaling effect?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20260108/68b333c8/attachment.html>
More information about the petsc-users
mailing list