[petsc-users] SNES Matrix-Free Parameters

Alfredo J Duarte Gomez aduarteg at utexas.edu
Wed Apr 6 14:13:41 CDT 2022

```Good afternoon petsc team,

I have a few questions regarding the matrixfree in the snes context.

I am currently using the matrix-free method with my own preconditioner to
solve a TS problem. I currently trigger this with the -snes_mf_operator
option.

So far the default values have been working great, but I ran into trouble
during a convergence study when I made the time step very small, which I
suspect is probably happening because it's dropping below the matrix-vector
product tolerance.

I wanted to explore the parameters of the matrix-vector product but using
the -snes_view option I notice that the following full message comes out:

-----------------------------------------------------------------------------------
SNES Object: 96 MPI processes
type: newtonls
maximum iterations=20, maximum function evaluations=10000
tolerances: relative=1e-06, absolute=1e-06, solution=1e-15
total number of linear solver iterations=14
total number of function evaluations=35
norm schedule ALWAYS
Jacobian is never rebuilt
Jacobian is applied matrix-free with differencing
Jacobian is applied matrix-free with differencing, no explict Jacobian
SNESLineSearch Object: 96 MPI processes
type: l2
maxstep=1.000000e+08, minlambda=1.000000e-12
tolerances: relative=1.000000e-08, absolute=1.000000e-15,
lambda=1.000000e-08
maximum iterations=1
KSP Object: 96 MPI processes
type: gmres
restart=100, using Classical (unmodified) Gram-Schmidt
Orthogonalization with no iterative refinement
happy breakdown tolerance 1e-30
maximum iterations=400, initial guess is zero
tolerances:  relative=0.01, absolute=1e-50, divergence=10000.
left preconditioning
using PRECONDITIONED norm type for convergence test
PC Object: 96 MPI processes
type: shell
MyPreconditioner
linear system matrix followed by preconditioner matrix:
Mat Object: 96 MPI processes
type: mffd
rows=8400000, cols=8400000
Matrix-free approximation:
err=1.49012e-08 (relative error in function evaluation)
Using wp compute h routine
Does not compute normU
Mat Object: 96 MPI processes
type: mpiaij
rows=8400000, cols=8400000, bs=4
total: nonzeros=2041029504, allocated nonzeros=2041029504
total number of mallocs used during MatSetValues calls=0
--------------------------------------------------------------------------------

I have been focusing specifically on the part:

Matrix-free approximation:
err=1.49012e-08 (relative error in function evaluation)
Using wp compute h routine
Does not compute normU

I notice that this part of the message does not change even when I specify
"-snes_mf_type default" (which is the alternative to wp), so I am a bit
confused on how I interact to the -snes_mf_type or if I am interpreting the
message wrong. Could you clarify this?

Also let me know if you have any general suggestions on tightening the
tolerance of the matricxvector products.

Thank you,

-Alfredo

--
Alfredo Duarte
The University of Texas at Austin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220406/76b8920b/attachment.html>
```