[petsc-users] Question on DMMGSetSNESLocal from snes/example/tutorials/ex19.c

Sun, Hui hus003 at ucsd.edu
Sat May 31 00:55:14 CDT 2014

I'm looking at snes example ex19.c, on "nonlinear driven cavity multigrid 2d. You can also access it via the website ( http://acts.nersc.gov/petsc/example3/ex19.c.html<http://www.mcs.anl.gov/petsc/petsc-3.4/src/snes/examples/tutorials/ex19.c.html> )

There are three user defined local functions ( FormFunctionLocal, FormFunctionLocali, FormFunctionLocali4 ) that serves as discretized PDE operators declared before main, and is defined right after main. In the middle of the main, there are these four lines:

1.  ierr = DMMGSetSNESLocal(dmmg,FormFunctionLocal,0,ad_FormFunctionLocal,admf_FormFunctionLocal);CHKERRQ(ierr);
2.  ierr = DMMGSetFromOptions(dmmg);CHKERRQ(ierr);
3.  ierr = DMMGSetSNESLocali(dmmg,FormFunctionLocali,0,admf_FormFunctionLocali);CHKERRQ(ierr);
4.  ierr = DMMGSetSNESLocalib(dmmg,FormFunctionLocali4,0,admfb_FormFunctionLocali4);CHKERRQ(ierr);

I have the following questions:

1. What are ad_FormFunctionLocal, admf_FormFunctionLocal from line 1? They are not defined anywhere in ex19.c. Other terms such as admf_FormFunctionLocali and admfb_FormFunctionLocali4 are also not defined anywhere in the file.

2. To me it seems like DMMGSetSNESLocal, DMMGSetSNESLocali, and DMMGSetSNESLocalib evaluates the function for all grid points, for a single grid point and for a single degree of freedom, respectively. But how does the process choose which one to use?

Thanks!           - Hui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140531/3031c167/attachment.html>

More information about the petsc-users mailing list