Hi Barry, Thanks for your exlanation. I used -snes_mf -pc_type lu and now it failed with reason -3 (/* the linear solve failed */). So, something is wrong with the function.
On Thu, Dec 19, 2013 at 5:01 PM, Barry Smith <[email protected]> wrote: > > ratio is || A - Afd || /||A|| where |||| is the frobenus norm and > difference is || A - Afd ||. > > Try using -snes_mf -pc_type lu > > This can often converge even if the A you provide is wrong, so if this > convergence sine then likely the Jacobian is wrong. > > It is also possible that the function evaluation has a bug. > > http://www.mcs.anl.gov/petsc/documentation/faq.html#newton > > > Barry > > > > On Dec 19, 2013, at 4:26 PM, Que Cat <[email protected]> wrote: > > > Hello, > > > > I use SNES to solve the non linear coupled equations. I have checked the > hand-coded jacobian with -snes_type test and received the result: > > Norm of matrix ratio 1.39606e-23 difference 1.53372e-14 (user-defined > state) > > Norm of matrix ratio 3.03157e-10 difference 0.33305 (constant state -1.0) > > Norm of matrix ratio 3.03157e-10 difference 0.33305 (constant state 1.0) > > It said that " if the ratio is O(1.e-8), the hand-coded Jacobian is > probably correct." What is the second paramenter "difference 1.53372e-14 > ...."? Does it play any role in checking the accuracy of hand-coded > jacobian? > > > > The SNES solver for failed with the reason -6 "the line search failed". > I tried with all other line search method stated in the PETSC manual, but > they all failed. > > > > I tried to figure out what is wrong with my code? Could you please give > me any recommendation to direct me how to check my code? I appreciate your > help. > > > > QUe > > > >
