Run in a debugger with -fp_trap to see where the bad value is generated.<div><br></div><div>Use SNESSetFunctionDomainError() if appropriate.<br><br><div class="gmail_quote">On Tue, Jun 12, 2012 at 11:32 PM, 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">Thanks. I did above procedure to my ComputeJacobian (only set values for precondition matrix B and assemble both A and B). This tackles the problem but the linear solver did not converged and bring the below error:<br>
<br>
0:   CFL = 100, Nonlinear = 0.0626958, Linear = (0,0,1e-05) 3.63577<br>-----------------------------------------------------------------------------<br>  Linear solve did not converge due to DIVERGED_ITS iterations 30<br>

1:   CFL = 100, Nonlinear = 0.108225, Linear = (30,0.047985,0.3) 0.0569319<br>-----------------------------------------------------------------------------<div class="im"><br>[0]PETSC ERROR: --------------------- Error Message ------------------------------------<br>
</div>
[0]PETSC ERROR: Floating point exception!<br>[0]PETSC ERROR: Infinite or not-a-number generated in norm!<div class="im"><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>
</div>
[0]PETSC ERROR: ./code on a linux-gnu named baghapour by baghapour Wed Jun 13 08:54:57 2012<br>[0]PETSC ERROR: Libraries linked from /home/baghapour/softs/petsc/linux-gnu-cxx-debug/lib<br>[0]PETSC ERROR: Configure run at Wed Nov  9 19:16:47 2011<br>

[0]PETSC ERROR: Configure options --with-cc=gcc --with-fc=gfortran --with-cxx=g++ --download-f2cblaslapack=1 --download-mpich=1 --with-clanguage=cxx --with-debugging=no --download-parms --download-hypre<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>

[0]PETSC ERROR: VecNorm() line 167 in src/vec/vec/interface/rvector.c<br>[0]PETSC ERROR: MatMFFDCompute_WP() line 75 in src/mat/impls/mffd/wp.c<br>[0]PETSC ERROR: MatMult_MFFD() line 351 in src/mat/impls/mffd/mffd.c<br>[0]PETSC ERROR: MatMult() line 2177 in src/mat/interface/matrix.c<br>

[0]PETSC ERROR: PCApplyBAorAB() line 610 in src/ksp/pc/interface/precon.c<br>[0]PETSC ERROR: GMREScycle() line 156 in src/ksp/ksp/impls/gmres/gmres.c<br>[0]PETSC ERROR: KSPSolve_GMRES() line 231 in src/ksp/ksp/impls/gmres/gmres.c<br>

[0]PETSC ERROR: KSPSolve() line 423 in src/ksp/ksp/interface/itfunc.c<br>[0]PETSC ERROR: SNES_KSPSolve() line 3396 in src/snes/interface/snes.c<br>[0]PETSC ERROR: SNESSolve_LS() line 190 in src/snes/impls/ls/ls.c<br>[0]PETSC ERROR: SNESSolve() line 2676 in src/snes/interface/snes.c<br>

[0]PETSC ERROR: _petsc_NewtonTimeAdvance() line 141 in Newton.cpp<br><br>Does it need to set specific options for linear solver (KSP) dealing with MF?<div class="HOEnZb"><div class="h5"><br><br><br><br><br><br><br><br><div class="gmail_quote">
On Wed, Jun 13, 2012 at 1:09 AM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@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"><br>
   Like in your ComputeJacobian(     Mat *J,Mat *B, ...)<br>
<br>
    you are calling MatZeroEntries(*J....) and then MatSetValues(*J,....)<br>
<br>
    you should not do that. You should call the zero entries and set values on B only. Then call MatAssemblyBegin/End() separately on BOTH matrices.<br>
<br>
    Also if you checked the error code from MatZeroEntries() with a CHKERRQ(ierr) instead of ignoring it you would likely not get the crash below but would get stack frames instead.<br>
<span><font color="#888888"><br>
   Barry<br>
</font></span><div><div><br>
On Jun 12, 2012, at 12:54 PM, Matthew Knepley wrote:<br>
<br>
> On Wed, Jun 13, 2012 at 1:46 AM, behzad baghapour <<a href="mailto:behzad.baghapour@gmail.com" target="_blank">behzad.baghapour@gmail.com</a>> wrote:<br>
> 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>
> Right, you only want to assemble the preconditioning matrix if you use MF.<br>
><br>
>    Matt<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" target="_blank">http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#valgrind[0]PETSC</a> ERROR: or try <a href="http://valgrind.org" target="_blank">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>
> On Tue, Jun 12, 2012 at 8:47 PM, Jed Brown <<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>> wrote:<br>
> On Tue, Jun 12, 2012 at 11:12 AM, behzad baghapour <<a href="mailto:behzad.baghapour@gmail.com" target="_blank">behzad.baghapour@gmail.com</a>> wrote:<br>
> Thank you. Now, I received the error which I should change Mat into mffd.<br>
><br>
> Always include the entire error message!<br>
><br>
> You have to assemble a matrix to use most preconditioners.<br>
><br>
><br>
><br>
><br>
> --<br>
> 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<br>
<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div>