[petsc-users] Setting SNESVI

Amir mhbaghaei at mail.sjtu.edu.cn
Fri Aug 17 23:56:32 CDT 2018


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);
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/26ef4c27/attachment-0001.html>


More information about the petsc-users mailing list