Matt is right. I had completely forgotten about this option and gave you an 
overly complicated solution.

  Barry


> On Sep 28, 2019, at 12:11 AM, Matthew Knepley <knep...@gmail.com> wrote:
> 
> On Fri, Sep 27, 2019 at 9:19 AM Li Luo via petsc-users 
> <petsc-users@mcs.anl.gov> wrote:
> Thank you for the suggestions, I'll try it.
> 
> I think an easier way to do what you want is
> 
>   -snes_max_linear_solve_fail 10
> 
> from
> 
>   
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetMaxLinearSolveFailures.html
> 
>   Thanks,
> 
>      Matt
>  
> Best,
> Li
> 
> On Fri, Sep 27, 2019 at 5:27 AM Smith, Barry F. <bsm...@mcs.anl.gov> wrote:
> 
>   Li,
> 
>    It is possible, but as Hong said probably never appropriate. Especially if 
> KSP has iterated for 10,000 iterations. If you want SNES to "try" the 
> direction given by a failed solve you should use a much smaller maximum 
> number of iterations for KSP.
> 
>    Anways, to do what you desire 
> 
> #include <petsc/private/kspimpl.h>
> 
> call KSPSetPostSolve() and in your post solve() function simply do 
> ksp->reason = KSP_CONVERGED_ITS.
> 
>  Barry
> 
> 
> 
> 
> > On Sep 26, 2019, at 10:58 AM, Zhang, Hong via petsc-users 
> > <petsc-users@mcs.anl.gov> wrote:
> > 
> > Li :
> > You can use '-ksp_max_it 20000' to change maximum iteration count. However, 
> > it does not make sense to continue after it fails at 10000 iterations. You 
> > should figure out why linear solver diverges. Run your code with 
> > '-ksp_monitor' or '-ksp_monitor_true_residual'.
> > Hong
> > 
> > Dear developer,
> > 
> > I am using SNES for solving a nonlinear system.  For some cases, SNES 
> > diverged -3 with "DIVERGED_LINEAR_SOLVE" when the linear solver reached its 
> > maximum iteration count (i.e -ksp_max_it 10000).
> > Is that possible to let SNES continue even though the linear solver reaches 
> > the maximum number of iterations? Just take the result at 10000 for the 
> > Jacobian solution and then update the Newton step?
> > 
> > Best,
> > Li
> > 
> > 
> > 
> > This message and its contents, including attachments are intended solely 
> > for the original recipient. If you are not the intended recipient or have 
> > received this message in error, please notify me immediately and delete 
> > this message from your computer system. Any unauthorized use or 
> > distribution is prohibited. Please consider the environment before printing 
> > this email.
> 
> 
> 
> -- 
> Postdoctoral Fellow
> Extreme Computing Research Center
> King Abdullah University of Science & Technology
> https://sites.google.com/site/rolyliluo/
> 
> This message and its contents, including attachments are intended solely for 
> the original recipient. If you are not the intended recipient or have 
> received this message in error, please notify me immediately and delete this 
> message from your computer system. Any unauthorized use or distribution is 
> prohibited. Please consider the environment before printing this email.
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments 
> is infinitely more interesting than any results to which their experiments 
> lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/

Reply via email to