[petsc-users] Understanding 'snes' object
Jed Brown
jed at jedbrown.org
Fri Aug 22 16:31:14 CDT 2025
"Zou, Ling via petsc-users" <petsc-users at mcs.anl.gov> writes:
> Hi all,
>
> Can someone please help me understand the output of the following two outputs using ‘-snes_view’?
>
> Option 1:
>
> SNES Object: 1 MPI process
>
> type: newtonls
>
> maximum iterations=15, maximum function evaluations=10000
>
> tolerances: relative=1e-08, absolute=1e-50, solution=1e-08
>
> total number of linear solver iterations=5
>
> total number of function evaluations=14
>
> norm schedule ALWAYS
>
> Jacobian is built using finite differences with coloring
>
> Option 2:
>
> SNES Object: 1 MPI process
>
> type: newtonls
>
> maximum iterations=50, maximum function evaluations=10000
>
> tolerances: relative=1e-08, absolute=1e-50, solution=1e-08
>
> total number of linear solver iterations=8
>
> total number of function evaluations=17
>
> norm schedule ALWAYS
>
> Jacobian is applied matrix-free with differencing
>
> Preconditioning Jacobian is built using finite differences with coloring
>
>
> Does it mean that
>
> * Option 1 uses Newton’s method, such that J du = b is solved with J being explicitly constructed?
> * Option 2 uses matrix free method, such that J du = b is solved with J v ~ (F(u + dv) – F(u)) / h when needed, e.g., in a Krylov method.
Roughly, yes. J is assembled (using FD with coloring in both cases). That sparse matrix representation of J is used for preconditioning in both cases. (Your output is truncated, but if you scroll down it'll show the Krylov solver (KSP) configuration and the preconditioner.) When the Krylov solver needs to just apply the operator, it's as you say (Option 1 uses matrix-free differencing while Option 2 uses the assembled matrix J).
More information about the petsc-users
mailing list