[petsc-users] preconditioning with Matrix-Free SNES

behzad baghapour behzad.baghapour at gmail.com
Tue Jun 12 23:32:03 CDT 2012


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:

0:   CFL = 100, Nonlinear = 0.0626958, Linear = (0,0,1e-05) 3.63577
-----------------------------------------------------------------------------
  Linear solve did not converge due to DIVERGED_ITS iterations 30
1:   CFL = 100, Nonlinear = 0.108225, Linear = (30,0.047985,0.3) 0.0569319
-----------------------------------------------------------------------------
[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Floating point exception!
[0]PETSC ERROR: Infinite or not-a-number generated in norm!
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 3.2.0, Patch 3, Fri Sep 30 10:28:33
CDT 2011
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: ./code on a linux-gnu named baghapour by baghapour Wed Jun
13 08:54:57 2012
[0]PETSC ERROR: Libraries linked from
/home/baghapour/softs/petsc/linux-gnu-cxx-debug/lib
[0]PETSC ERROR: Configure run at Wed Nov  9 19:16:47 2011
[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
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: VecNorm() line 167 in src/vec/vec/interface/rvector.c
[0]PETSC ERROR: MatMFFDCompute_WP() line 75 in src/mat/impls/mffd/wp.c
[0]PETSC ERROR: MatMult_MFFD() line 351 in src/mat/impls/mffd/mffd.c
[0]PETSC ERROR: MatMult() line 2177 in src/mat/interface/matrix.c
[0]PETSC ERROR: PCApplyBAorAB() line 610 in src/ksp/pc/interface/precon.c
[0]PETSC ERROR: GMREScycle() line 156 in src/ksp/ksp/impls/gmres/gmres.c
[0]PETSC ERROR: KSPSolve_GMRES() line 231 in src/ksp/ksp/impls/gmres/gmres.c
[0]PETSC ERROR: KSPSolve() line 423 in src/ksp/ksp/interface/itfunc.c
[0]PETSC ERROR: SNES_KSPSolve() line 3396 in src/snes/interface/snes.c
[0]PETSC ERROR: SNESSolve_LS() line 190 in src/snes/impls/ls/ls.c
[0]PETSC ERROR: SNESSolve() line 2676 in src/snes/interface/snes.c
[0]PETSC ERROR: _petsc_NewtonTimeAdvance() line 141 in Newton.cpp

Does it need to set specific options for linear solver (KSP) dealing with
MF?







On Wed, Jun 13, 2012 at 1:09 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>   Like in your ComputeJacobian(     Mat *J,Mat *B, ...)
>
>    you are calling MatZeroEntries(*J....) and then MatSetValues(*J,....)
>
>    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.
>
>    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.
>
>   Barry
>
> On Jun 12, 2012, at 12:54 PM, Matthew Knepley wrote:
>
> > On Wed, Jun 13, 2012 at 1:46 AM, behzad baghapour <
> behzad.baghapour at gmail.com> wrote:
> > 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:
> >
> > Right, you only want to assemble the preconditioning matrix if you use
> MF.
> >
> >    Matt
> >
> > [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> > [0]PETSC ERROR: No support for this operation for this object type!
> > [0]PETSC ERROR: Mat type mffd!
> > [0]PETSC ERROR:
> ------------------------------------------------------------------------
> > [0]PETSC ERROR: Petsc Release Version 3.2.0, Patch 3, Fri Sep 30
> 10:28:33 CDT 2011
> > [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> > [0]PETSC ERROR: See docs/index.html for manual pages.
> > [0]PETSC ERROR:
> ------------------------------------------------------------------------
> > [0]PETSC ERROR: ./code on a linux-gnu named behzad-desktop by behzad Tue
> Jun 12 22:01:48 2012
> > [0]PETSC ERROR: Libraries linked from
> /home/behzad/softs/petsc/linux-gnu-cxx-debug/lib
> > [0]PETSC ERROR: Configure run at Sat Dec 17 10:21:01 2011
> > [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
> > [0]PETSC ERROR:
> ------------------------------------------------------------------------
> > [0]PETSC ERROR: MatZeroEntries() line 5186 in src/mat/interface/matrix.c
> > [0]PETSC ERROR:
> ------------------------------------------------------------------------
> > [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
> probably memory access out of range
> > [0]PETSC ERROR: Try option -start_in_debugger or
> -on_error_attach_debugger
> > [0]PETSC ERROR: or see
> http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#valgrind[0]PETSCERROR: or try
> http://valgrind.org on GNU/linux and Apple Mac OS X to find memory
> corruption errors
> > [0]PETSC ERROR: configure using --with-debugging=yes, recompile, link,
> and run
> > [0]PETSC ERROR: to get more information on the crash.
> > [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> > [0]PETSC ERROR: Signal received!
> > [0]PETSC ERROR:
> ------------------------------------------------------------------------
> > [0]PETSC ERROR: Petsc Release Version 3.2.0, Patch 3, Fri Sep 30
> 10:28:33 CDT 2011
> > [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> > [0]PETSC ERROR: See docs/index.html for manual pages.
> > [0]PETSC ERROR:
> ------------------------------------------------------------------------
> > [0]PETSC ERROR: ./code on a linux-gnu named behzad-desktop by behzad Tue
> Jun 12 22:01:48 2012
> > [0]PETSC ERROR: Libraries linked from
> /home/behzad/softs/petsc/linux-gnu-cxx-debug/lib
> > [0]PETSC ERROR: Configure run at Sat Dec 17 10:21:01 2011
> > [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
> > [0]PETSC ERROR:
> ------------------------------------------------------------------------
> > [0]PETSC ERROR: User provided function() line 0 in unknown directory
> unknown file
> > application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
> > [cli_0]: aborting job:
> > application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
> > make: [run] Error 59 (ignored)
> >
> >
> >
> > On Tue, Jun 12, 2012 at 8:47 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> > On Tue, Jun 12, 2012 at 11:12 AM, behzad baghapour <
> behzad.baghapour at gmail.com> wrote:
> > Thank you. Now, I received the error which I should change Mat into mffd.
> >
> > Always include the entire error message!
> >
> > You have to assemble a matrix to use most preconditioners.
> >
> >
> >
> >
> > --
> > What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> > -- Norbert Wiener
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120613/81df3d6b/attachment.html>


More information about the petsc-users mailing list