<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;"><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 <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>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></body></html>