<div><div dir="auto">Have you tried <span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">SNESVINEWTONRSLS? In my experience, I seem to have slightly better luck with that one instead of </span><span style="color:rgb(49,49,49);word-spacing:1px;background-color:rgb(255,255,255)">SNESVINEWTONSSLS</span></div></div><div><br><div class="gmail_quote"><div dir="ltr">On Sat, Aug 18, 2018 at 12:56 AM Amir <<a href="mailto:mhbaghaei@mail.sjtu.edu.cn">mhbaghaei@mail.sjtu.edu.cn</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi</div><div>I need to apply constraint to primitive variables. I am troubling to set up SNESVI. After running the code, I feel SNES is not actually solving. After one iteration of SNES, I got DIVERGED_LINESEARCH, with NO changing in function norm.</div><div>I think the way I set VI maybe wrong. Sorry for my simple explanation. </div><div>Very thankful for your time.</div><div>Amir</div><div>                                SNESCreate(PETSC_COMM_WORLD,&snes);</div><div>                               SNESSetApplicationContext(snes,&user);</div><div>                               SNESSetDM(snes,<a href="http://user.dm" target="_blank">user.dm</a>);</div><div>                            SNESSetFunction(snes,NULL,FormFunction,&user);</div><div>                               FormInitialSolution(user.X,&user);</div><div>                           SNESSetSolution(snes,user.X);</div><div>                            SNESMonitorSet(snes,MySNESMonitor,&user,NULL);</div><div>                               SNESSetType(snes,SNESVINEWTONSSLS);</div><div>                              SNESSetNormSchedule(snes, SNES_NORM_ALWAYS);</div><div>                             SNESVISetVariableBounds(snes,user.XLOWER,user.XUPPER);</div><div>                           SNESGetLineSearch(snes,&linesearch);</div><div>                         SNESLineSearchSetType(linesearch,SNESLINESEARCHBT);</div><div>                              SNESLineSearchSetVIFunctions(linesearch, NULL, SNESNormFunction);</div><div>                                SNESSetFromOptions(snes);</div><div>                                SNESSolve(snes,NULL,user.X);</div><img class="m_-1053926601320215736mailspring-open" alt="Open Tracking" width="0" height="0" style="border:0;width:0;height:0" src="https://link.getmailspring.com/open/1534566770.local-ad07529d-23c1-v1.4.2-f587b7b7@getmailspring.com?recipient=cGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%3D"></blockquote></div></div>