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

Sun, Hui hus003 at ucsd.edu
Sat May 31 08:27:38 CDT 2014


Thank you Jed. The version I was using is 3.1, it is too old. 

________________________________________
From: Jed Brown [jed at jedbrown.org]
Sent: Saturday, May 31, 2014 1:43 AM
To: Sun, Hui; petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] Question on DMMGSetSNESLocal from snes/example/tutorials/ex19.c

"Sun, Hui" <hus003 at ucsd.edu> writes:

> 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> )

These are not the same version.  The acts.nersc.gov link is a very old
version of that example.  The source-transformation algorithmic
differentiation tool ADIC is being used to compute derivatives (the ad_*
and admf_* functions).  ADIC is not maintained, has an unfortunate
license, and was not widely used so the "automatic" support has been
removed from PETSc.  Please look at the current version, which has
neither DMMG (removed/merged into SNES some years ago) or ADIC.

> 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


More information about the petsc-users mailing list