<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br><div><br><blockquote type="cite"><div>On Oct 3, 2023, at 2:44 PM, Gong Ding <gongding@cn.cogenda.com> wrote:</div><br class="Apple-interchange-newline"><div>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div><p>Any better choice if I can do right precondition?</p><p>Merge Jacobian to Function evaluation has performance lost. <br></p></div></div></blockquote><div><br></div> Why ? Should still just compute the Jacobian once, just earlier in the process.</div><div><br><blockquote type="cite"><div><div><p>
</p>
<div class="moz-cite-prefix">On 2023/10/4 02:13, Barry Smith wrote:<br>
</div>
<blockquote type="cite" cite="mid:7A43650F-8584-4E0B-8689-68F73CA35C01@petsc.dev">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div><br>
</div>
Simply evaluate the Jacobian during your SNESComputeFunction and
save it for SNESComputeJacobian.
<div><br>
</div>
<div><br>
<div><br>
<blockquote type="cite">
<div>On Oct 3, 2023, at 1:51 PM, Gong Ding
<a class="moz-txt-link-rfc2396E" href="mailto:gongding@cn.cogenda.com"><gongding@cn.cogenda.com></a> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
<div><p>Hi all,</p><p>I'd like to do a special jacobian precondition
during the snes iteration, for which jacobian matrix
and RHS vector must be modified explicitly.</p><p>In the SNESComputeJacobian, the preconditioner P is
built after assembly of jacobian matrix.</p><p>I need to multiply P to J and RHS vector explicitly
as left precondition before the solve stage of J*dx =
rhs. <br>
</p>
<pre id="codecell0"><span class="w"></span><span class="nf">However, I find that petsc evaluates function before jacobian, so P*</span>RHS vector can not be processed at SNESComputeFunction.
As a result, I must find a hook function after SNESComputeJacobian and before the solve stage.
Any suggest?
Gong Ding
<span class="nf"></span></pre>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div>
</div></blockquote></div><br></body></html>