[petsc-users] Integrating SNES in FEM code
Saransh Saxena
saransh.saxena5571 at gmail.com
Thu May 6 08:18:29 CDT 2021
Hi,
I am trying to incorporate newton method in solving a nonlinear FEM
equation using SNES from PETSc. The overall equation is of the type A(x).x
= b, where b is a vector of external loads, x is the solution field (say
displacements for e.g.) and A is the combined LHS matrix derived from the
discretization of weak formulation of the governing finite element
equation.
While going through the manual and examples of snes, I found that I need to
define the function of residual using SNESSetFunction() and jacobian using
SNESSetJacobian(). In that context I had a couple of questions :-
1. In the snes tutorials I've browsed through, the functions for computing
residual passed had arguments only for x, the solution vector and f, the
residual vector. Is there a way a user can pass an additional vector (b)
and matrix (A) for computing the residual as well? as in my case, f = b -
A(x).x
2. Since computing jacobian is not that trivial, I would like to use one of
the pre-built jacobian methods. Is there any other step other than setting
the 3rd argument in SNESSetJacobian to SNESComputeJacobianDefault?
Best regards,
Saransh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210506/17f5a56a/attachment.html>
More information about the petsc-users
mailing list