Always run sequentially when debugging convergence issues etc (unless it converges fine sequentially and only has trouble in parallel).
Was this with -snes_mf_operator ? I would recommend simplifying your “function” and “jacobian” by removing all the complicating terms until you get good convergence, and then start putting them back until you find the one causing the difficulties. Trying to directly bug a complicated function and jacobian is generally a nightmare. Barry On Dec 20, 2013, at 8:40 AM, Que Cat <[email protected]> wrote: > Barry, > > It said that "No support for this operation for this object type! Matrix > format mpiaij does not have a built-in PETSc LU!". > > I run it with option "-snes_monitor -ksp_monitor_true_residual > -snes_converged_reason -ksp_converged_reason." and received : > 0 SNES Function norm 1.414213647226e-01 > 0 KSP preconditioned resid norm 8.424084241999e+08 true resid norm > 1.414213647226e-01 ||r(i)||/||b|| 1.000000000000e+00 > 1 KSP preconditioned resid norm 1.354908290122e-02 true resid norm > 1.424694873074e-01 ||r(i)||/||b|| 1.007411345428e+00 > Nonlinear solve did not converge due to DIVERGED_LINE_SEARCH iterations 0 > > It looks like that the preconditioned residual converges, but the true > residual does not. > > > On Fri, Dec 20, 2013 at 8:30 AM, Barry Smith <[email protected]> wrote: > > Run with > > -snes_mf_operator -pc_type lu > > I’m sorry I sent the wrong instructions before. > > Barry > > On Dec 20, 2013, at 7:54 AM, Que Cat <[email protected]> wrote: > > > 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 > > > > > > > > >
