On Fri, Apr 4, 2014 at 5:15 PM, Xiangdong <epsco...@gmail.com> wrote:
> > > > On Fri, Apr 4, 2014 at 5:02 PM, Peter Brune <br...@mcs.anl.gov> wrote: > >> >> >> >> On Fri, Apr 4, 2014 at 3:57 PM, Xiangdong <epsco...@gmail.com> wrote: >> >>> Hello everyone, >>> >>> If we use -snes_fd or -snes_fd_color, can we still pass a preconditioner >>> to snes/ksp? >>> >>> In snes/ex1.c, when I use -snes_fd, the program never calls the >>> FormJacobian1 to get the preconditioner. >>> >> >> FormJacobian1 forms... wait for it... the Jacobian! Not the >> preconditioner. -snes_fd and -snes_fd_color replace the Jacobian-forming >> routine. >> > > It looks like the FormJacobian1 forms both Jacobian J and preconditioner > B. My observations are > > 1) Without any options, FormJacobian1 can provide both Jacobian J and > preconditioner B. > 2) With -snes_fd, the program does not call the FormJacobian1 function at > all, even if we have SNESSetJacobian in the codes. > > If it does not call the FormJacobian1 and SNESSetJacobian is ignored with > -snes_fd, how can I provide the preconditioner to snes? > > Thank you. > > Xiangdong > > > >> >> >>> >>> Any suggestions about providing preconditioner to snes_fd or >>> snes_fd_color? >>> >>> >> Both of these explicitly create the approximate Jacobian matrix by using >> finite differences, so they may be used with any preconditioner. -snes_mf >> is a different beast entirely and merely approximates the action of the >> matrix without forming it, which is where the preconditioner issues come in. >> > Given that -snes_fd is explicitly formed, so -pc_type gamg or ilu will work. What happens if I want to provide my own preconditioner? Thank you. Xiangdong > >> - Peter >> >> >>> Thanks. >>> >>> Xiangdong >>> >> >> >