<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 20, 2018 at 5:31 AM, Buesing, Henrik <span dir="ltr"><<a href="mailto:hbuesing@eonerc.rwth-aachen.de" target="_blank">hbuesing@eonerc.rwth-aachen.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Dear all,
<br>
<br>
I would like to use the matrix-free feature from PETSc, but I do not want to use finite differences to calculate J*u but automatic differentiation (AD). Since I do not want to live totally without preconditioning, I want to build important parts of the Jacobian
 and pass it for preconditioning. <br>
<br>
As I understand it, I would create a Shell-Matrix A and associate my UserMult function with it. This uses my AD Jacobian J and computes J*u without actually forming J. Then I will create a different matrix P, which will hold a partly assembled Jacobian for
 preconditioning. <br>
<br>
My FormJacobian function then takes this Shell-Matrix as Amat and my preconditioning matrix P as Pmat. Within FormJacobian I build the matrix Pmat, which holds parts of my Jacobian.
<br>
<br>
Does this make sense? Is this the way how I am supposed to do it? Do UserMult and FormJacobian function do the right things?<br></div></div></blockquote><div><br></div><div>Yes, this is the intended use.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
Thank you!<span class="HOEnZb"><font color="#888888"><br>
Henrik<br>
<br>
<br>
<br>
<div><br>
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px"><span style="font-family:Courier New">--
<br>
Dipl.-Math. Henrik Büsing<br>
Applied Geophysics and Geothermal Energy<br>
E.ON Energy Research Center<br>
RWTH Aachen University<br>
------------------------------<wbr>-----------------<br>
<a href="https://maps.google.com/?q=Mathieustr.+10&entry=gmail&source=g">Mathieustr. 10</a>        | Tel +49 (0)241 80 49907<br>
52074 Aachen, Germany | Fax +49 (0)241 80 49889<br>
------------------------------<wbr>-----------------<br>
<a href="http://www.eonerc.rwth-aachen.de/GGE" target="_blank">http://www.eonerc.rwth-aachen.<wbr>de/GGE</a><br>
<a href="mailto:hbuesing@eonerc.rwth-aachen.de" target="_blank">hbuesing@eonerc.rwth-aachen.de</a><br>
------------------------------<wbr>-----------------<br>
</span>
<div style="font-family:Tahoma;font-size:13px"></div>
</div>
</div>
</div>
</font></span></div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>