Hello, I have a couple of questions regarding how SNESSetFunction,SNESSetJacobian and SNESSolve work together. I am trying to solve a nonlinear system of the form A(x)x=b(x). I am using Fortran90. The way I intend to solve the above equation is as follows: Step 1: initialize x with an initial guess Step 2: Solve using SNESSolve for (x^i, i is the iteration number, i=1,2,3...) Step 3: Calculate the update and check if it is less than tolerance Step 4: If yes, end the loop. Else the jacobian matrix and function should be updated using x^(i) and go back to step 2.
The part which is a little confusing to me is in understanding how to update the jacobian matrix and the function F (= A(x)x-b(x)). 1) Should I explicitly call the subroutines Form Function and FormJacobian by using x^i as the input argument or is this automatically taken care of when I go back to step 2 and call SNESSolve? 2) If the answer to the above question is yes, I do not fully understand the role played by the functions SNESSetFunction and SNESSetJacobian. I apologize if I am not clear in my explanation. I would be glad to elaborate on any section of my question. Please let me know if you need any further information from my side. Thank you, Sincerely, Pranay. ᐧ
