You are right! I do calculate the Jacobian and Preconditioning matrice in FormJacobian function with Mat context. When I used "-snes_mf_operator" I received the error:<br><br><br>[0]PETSC ERROR: --------------------- Error Message ------------------------------------<br>
[0]PETSC ERROR: No support for this operation for this object type!<br>[0]PETSC ERROR: Mat type mffd!<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>[0]PETSC ERROR: Petsc Release Version 3.2.0, Patch 3, Fri Sep 30 10:28:33 CDT 2011 <br>
[0]PETSC ERROR: See docs/changes/index.html for recent updates.<br>[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>[0]PETSC ERROR: See docs/index.html for manual pages.<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>
[0]PETSC ERROR: ./code on a linux-gnu named behzad-desktop by behzad Tue Jun 12 22:01:48 2012<br>[0]PETSC ERROR: Libraries linked from /home/behzad/softs/petsc/linux-gnu-cxx-debug/lib<br>[0]PETSC ERROR: Configure run at Sat Dec 17 10:21:01 2011<br>
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --download-f2cblaslapack=1 --download-mpich=1 --download-hypre --download-parms --with-clanguage=cxx -with-debugging=no<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>
[0]PETSC ERROR: MatZeroEntries() line 5186 in src/mat/interface/matrix.c<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range<br>
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger<br>[0]PETSC ERROR: or see <a href="http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#valgrind[0]PETSC">http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#valgrind[0]PETSC</a> ERROR: or try <a href="http://valgrind.org">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to find memory corruption errors<br>
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run <br>[0]PETSC ERROR: to get more information on the crash.<br>[0]PETSC ERROR: --------------------- Error Message ------------------------------------<br>
[0]PETSC ERROR: Signal received!<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>[0]PETSC ERROR: Petsc Release Version 3.2.0, Patch 3, Fri Sep 30 10:28:33 CDT 2011 <br>[0]PETSC ERROR: See docs/changes/index.html for recent updates.<br>
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.<br>[0]PETSC ERROR: See docs/index.html for manual pages.<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>[0]PETSC ERROR: ./code on a linux-gnu named behzad-desktop by behzad Tue Jun 12 22:01:48 2012<br>
[0]PETSC ERROR: Libraries linked from /home/behzad/softs/petsc/linux-gnu-cxx-debug/lib<br>[0]PETSC ERROR: Configure run at Sat Dec 17 10:21:01 2011<br>[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --download-f2cblaslapack=1 --download-mpich=1 --download-hypre --download-parms --with-clanguage=cxx -with-debugging=no<br>
[0]PETSC ERROR: ------------------------------------------------------------------------<br>[0]PETSC ERROR: User provided function() line 0 in unknown directory unknown file<br>application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0<br>
[cli_0]: aborting job:<br>application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0<br>make: [run] Error 59 (ignored)<br><br><br><br><div class="gmail_quote">On Tue, Jun 12, 2012 at 8:47 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@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 class="im"><div class="gmail_quote">On Tue, Jun 12, 2012 at 11:12 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">
Thank you. Now, I received the error which I should change Mat into mffd.</blockquote></div><br></div><div><font color="#ff0000" size="4"><b>Always</b> include the entire error message!</font></div><div><font color="#ff0000" size="4"><br>

</font></div><div>You have to assemble a matrix to use most preconditioners.</div>
</blockquote></div><br>