According to my last question, I am trying to use Shell to handle the MatrixFree procedure as below:<br><br>1- Define residual as: <br>       F := M * DQ/Dt - R(Q) (R is the nonlinear residual obtained from discretization)<br>
2- MatCreateShell<br>3- MatShellSetOperation -> MATOP_MULT as follows:<br>       dF/dQ * v = M * v / Dt - ( R(Q+eps*v) - R(Q) ) / eps<br>4- Using this operation in each step of KSP (GMRES) subspace construction. <br><br>
Does the above procedure seem reasonable to use with SNES? Please help me if it needs more considerations.<br><br>Thanks,<br>BehZad<br><br><br><div class="gmail_quote">On Mon, Jun 4, 2012 at 8:33 AM, behzad baghapour <span dir="ltr"><<a href="mailto:behzad.baghapour@gmail.com" target="_blank">behzad.baghapour@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear all,<br><br>I want to compute Jacobian matrix via Matrix-Free manner in SNES procedure. I should consider the time-marching term as M*dQ/dt with is not the part of finite-differencing and should be added into diagonal blocks of the matrix. So, how should be right to calculate the Jacobian using the prepared Petsc routines?<br>

<br>Thanks a lot,<br>BehZad<br>
</blockquote></div><br>