[petsc-users] Setting SNESVI
Amir
mhbaghaei at mail.sjtu.edu.cn
Sat Aug 18 08:54:07 CDT 2018
I just comment out the SNESVISetVariableBounds and SNESLineSearchSetVIFunctions. trying to rerun the code, SNES successfully converged, with not active constraint.
Amir
On Aug 18 2018, at 8:48 pm, Matthew Knepley <knepley at gmail.com> wrote:
>
> First dolve the unconstrained problem to make sure that works.
>
> Matt
> On Sat, Aug 18, 2018, 01:24 Amir <mhbaghaei at mail.sjtu.edu.cn (https://link.getmailspring.com/link/1534600291.local-99f6de16-0c60-v1.4.2-f587b7b7@getmailspring.com/0?redirect=mailto%3Amhbaghaei%40mail.sjtu.edu.cn&recipient=cGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%3D)> wrote:
> > I just tried. But it gives me same pattern. After One iteration, it diverges. I am now sure some thing is wrong with my setting.
> >
> > On Aug 18 2018, at 12:59 pm, Justin Chang <jychang48 at gmail.com (https://link.getmailspring.com/link/1534600291.local-99f6de16-0c60-v1.4.2-f587b7b7@getmailspring.com/1?redirect=mailto%3Ajychang48%40gmail.com&recipient=cGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%3D)> wrote:
> > >
> > > Have you tried SNESVINEWTONRSLS? In my experience, I seem to have slightly better luck with that one instead of SNESVINEWTONSSLS
> > >
> > > On Sat, Aug 18, 2018 at 12:56 AM Amir <mhbaghaei at mail.sjtu.edu.cn (https://link.getmailspring.com/link/1534600291.local-99f6de16-0c60-v1.4.2-f587b7b7@getmailspring.com/2?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1534569654.local-a0d70606-12e6-v1.4.2-f587b7b7%40getmailspring.com%2F0%3Fredirect%3Dmailto%253Amhbaghaei%2540mail.sjtu.edu.cn%26recipient%3DcGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%253D&recipient=cGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%3D)> wrote:
> > > > Hi
> > > > 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.
> > > > I think the way I set VI maybe wrong. Sorry for my simple explanation.
> > > > Very thankful for your time.
> > > > Amir
> > > > SNESCreate(PETSC_COMM_WORLD,&snes);
> > > > SNESSetApplicationContext(snes,&user);
> > > > SNESSetDM(snes,user.dm (https://link.getmailspring.com/link/1534600291.local-99f6de16-0c60-v1.4.2-f587b7b7@getmailspring.com/3?redirect=https%3A%2F%2Flink.getmailspring.com%2Flink%2F1534569654.local-a0d70606-12e6-v1.4.2-f587b7b7%40getmailspring.com%2F1%3Fredirect%3Dhttp%253A%252F%252Fuser.dm%26recipient%3DcGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%253D&recipient=cGV0c2MtdXNlcnNAbWNzLmFubC5nb3Y%3D));
> > > > SNESSetFunction(snes,NULL,FormFunction,&user);
> > > > FormInitialSolution(user.X,&user);
> > > > SNESSetSolution(snes,user.X);
> > > > SNESMonitorSet(snes,MySNESMonitor,&user,NULL);
> > > > SNESSetType(snes,SNESVINEWTONSSLS);
> > > > SNESSetNormSchedule(snes, SNES_NORM_ALWAYS);
> > > > SNESVISetVariableBounds(snes,user.XLOWER,user.XUPPER);
> > > > SNESGetLineSearch(snes,&linesearch);
> > > > SNESLineSearchSetType(linesearch,SNESLINESEARCHBT);
> > > > SNESLineSearchSetVIFunctions(linesearch, NULL, SNESNormFunction);
> > > > SNESSetFromOptions(snes);
> > > > SNESSolve(snes,NULL,user.X);
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180818/cdac82db/attachment-0001.html>
More information about the petsc-users
mailing list