[petsc-users] SNESSetUp

Matthew Knepley knepley at gmail.com
Wed Oct 9 15:33:02 CDT 2013


On Wed, Oct 9, 2013 at 3:25 PM, Mark F. Adams <mfadams at lbl.gov> wrote:

> I see this in SNESSetUp doc:
>
> For basic use of the SNES<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNES.html#SNES> solvers
> the user need not explicitly call SNESSetUp<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetUp.html#SNESSetUp>(),
> since these actions will automatically occur during the call to SNESSolve<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSolve.html#SNESSolve>().
> However, if one wishes to control this phase separately,
> SNESSetUp<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetUp.html#SNESSetUp>()
> should be called after SNESCreate<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESCreate.html#SNESCreate>()
> and optional routines of the form SNESSetXXX(), but before SNESSolve<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSolve.html#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
>

Your Fortran is hurting my eyes :)

Is solver%rVec2 == 0?

  Matt

-- 
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/20131009/8d43e4c0/attachment.html>


More information about the petsc-users mailing list