[petsc-users] Implementing the Sherman Morisson formula (low rank update) in petsc4py and FEniCS?
Jed Brown
jed at jedbrown.org
Mon Feb 10 11:16:26 CST 2020
Olek Niewiarowski <aan2 at princeton.edu> writes:
> Barry,
> Thank you for your help and detailed suggestions. I will try to implement what you proposed and will follow-up with any questions. In the meantime, I just want to make sure I understand the use of SNESSetPicard:
> r - vector to store function value
> b - function evaluation routine - my F(u) function
> Amat - matrix with which A(x) x - b(x) is to be computed - a MatCreateLRC() -- what's the best way of passing in scalar k?
Typically via the context argument, similar to any SNES example.
> Pmat - matrix from which preconditioner is computed (usually the same as Amat) - a regular Mat()
> J - function to compute matrix value, see SNESJacobianFunction<https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESJacobianFunction.html#SNESJacobianFunction> for details on its calling sequence -- computes K + kaa'
>
> By the way, the manual page states "we do not recommend using this routine. It is far better to provide the nonlinear function F() and some approximation to the Jacobian and use an approximate Newton solver :-)"
Yep, this is mainly for when someone has legacy code to compute a matrix
as a nonlinear function of the state U, but not a matrix-free way to
compute a residual. Implementing as Newton (with inexact
matrix/preconditioner) is more flexible and often enables faster
convergence.
More information about the petsc-users
mailing list