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

Reply via email to