<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 4, 2014 at 5:02 PM, Peter Brune <span dir="ltr"><<a href="mailto:brune@mcs.anl.gov" target="_blank">brune@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="">On Fri, Apr 4, 2014 at 3:57 PM, Xiangdong <span dir="ltr"><<a href="mailto:epscodes@gmail.com" target="_blank">epscodes@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello everyone,<div><br></div><div>If we use -snes_fd or -snes_fd_color, can we still pass a preconditioner to snes/ksp?</div>

<div><br></div><div>In snes/ex1.c, when I use -snes_fd, the program never calls the FormJacobian1 to get the preconditioner.</div></div></blockquote><div><br></div></div><div>FormJacobian1 forms... wait for it... the Jacobian!  Not the preconditioner.  -snes_fd and -snes_fd_color replace the Jacobian-forming routine.</div>
</div></div></div></blockquote><div><br></div><div>It looks like the FormJacobian1 forms both Jacobian J and preconditioner B. My observations are</div><div><br></div><div>1) Without any options, FormJacobian1 can provide both Jacobian J and preconditioner B.</div>
<div>2) With -snes_fd, the program does not call the FormJacobian1 function at all, even if we have SNESSetJacobian in the codes.</div><div><br></div><div>If it does not call the FormJacobian1 and SNESSetJacobian is ignored with -snes_fd, how can I provide the preconditioner to snes?</div>
<div><br></div><div>Thank you.</div><div><br></div><div>Xiangdong</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">
<div class="gmail_quote"><div class="">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<div><br></div><div>Any suggestions about providing preconditioner to snes_fd or snes_fd_color?</div><div><br></div></div></blockquote><div><br></div></div><div>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.</div>

<div><br></div><div>- Peter</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div>Thanks.</div><span><font color="#888888"><div>

<br></div><div>Xiangdong</div></font></span></div>
</blockquote></div><br></div></div>
</blockquote></div><br></div></div>