[petsc-users] SNESSetUp

Mark F. Adams mfadams at lbl.gov
Wed Oct 9 15:25:15 CDT 2013


I see this in SNESSetUp doc:

For basic use of the SNES solvers the user need not explicitly call SNESSetUp(), since these actions will automatically occur during the call to SNESSolve(). However, if one wishes to control this phase separately,
SNESSetUp() should be called after SNESCreate() and optional routines of the form SNESSetXXX(), but before SNESSolve().


I hit this error line in SNESSetUp:

  if (snes->vec_rhs  == snes->vec_sol) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_IDN,"Solution vector cannot be right hand side vector");

I put this in a debugger and found that these are both 0 (hence equal).  It is not obvious what SNESSetXXX I might be missing.  I've appended what setxxx stuff I'm doing.

Mark

  !  Set function evaluation routine and vector
  call SNESSetFunction(solver%snes,solver%rVec2,FormFunction,solver,ierr)

  call SNESSetJacobian(solver%snes,solver%KKTmat,solver%KKTmat,FormJacobian,solver,ierr)

  ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  !  Customize nonlinear solver; set runtime options
  ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  !  Set runtime options (e.g., -snes_monitor -snes_rtol <rtol> -ksp_type <type>)
  call SNESSetFromOptions(solver%snes,ierr)

  call SNESSetUp(solver%snes,ierr) ! pre setup, same as (old) KSP

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131009/5bbeeaf1/attachment.html>


More information about the petsc-users mailing list