[petsc-users] Problem with SNESsetFunction()

baikadi pranay pranayreddy865 at gmail.com
Fri Oct 30 22:11:52 CDT 2020


Hello,
I have a couple of questions regarding SNESSetFunction usage, when
programming in Fortran90.

1) I have the following usage paradigm.
   call SNESSetFunction(snes,f_non,FormFunction,0,ierr)
   subroutine FormFunction(snes,x,r,dummy,ierr)
In the FormFunction subroutine, the function values are stored in the
vector r. I see that these values are formed correctly. But when I use
FormFunction in  SNESSetFunction(), the values are not getting populated
into f_non and all of the values in f_non are zero.
Should the name of the variable used to store the function value be same
in  SNESSetFunction and FormFunction? And should I be calling the
SNESComputeFunction() after calling SNESSetFunction()?

2) In the subroutine FormFunction, should the vector objects created be
destroyed before ending the subroutine?

Please let me know if you need any further information. Thank you in
advance.
Best regards,
Pranay.

ᐧ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20201030/8817e0e5/attachment.html>


More information about the petsc-users mailing list