<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I see this in SNESSetUp doc:<div><br></div><div><span style="font-family: Times; background-color: rgb(255, 255, 255); ">For basic use of the </span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNES.html#SNES" style="font-family: Times; background-color: rgb(255, 255, 255); ">SNES</a><span style="font-family: Times; background-color: rgb(255, 255, 255); "> solvers the user need not explicitly call </span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetUp.html#SNESSetUp" style="font-family: Times; background-color: rgb(255, 255, 255); ">SNESSetUp</a><span style="font-family: Times; background-color: rgb(255, 255, 255); ">(), since these actions will automatically occur during the call to </span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSolve.html#SNESSolve" style="font-family: Times; background-color: rgb(255, 255, 255); ">SNESSolve</a><span style="font-family: Times; background-color: rgb(255, 255, 255); ">(). However, if one wishes to control this phase separately,</span></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetUp.html#SNESSetUp" style="font-family: Times; background-color: rgb(255, 255, 255); ">SNESSetUp</a><span style="font-family: Times; background-color: rgb(255, 255, 255); ">() should be called after </span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESCreate.html#SNESCreate" style="font-family: Times; background-color: rgb(255, 255, 255); ">SNESCreate</a><span style="font-family: Times; background-color: rgb(255, 255, 255); ">() and optional routines of the form SNESSetXXX(), but before </span><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSolve.html#SNESSolve" style="font-family: Times; background-color: rgb(255, 255, 255); ">SNESSolve</a><span style="font-family: Times; background-color: rgb(255, 255, 255); ">().</span><div style="font-family: Times; background-color: rgb(255, 255, 255); "><br class="webkit-block-placeholder"></div><div style="font-family: Times; background-color: rgb(255, 255, 255); position: static; z-index: auto; "><br class="webkit-block-placeholder"></div></div><div><span style="font-family: Times; background-color: rgb(255, 255, 255); ">I hit this error line in SNESSetUp:</span></div><div><span style="font-family: Times; background-color: rgb(255, 255, 255); "><br></span></div><div><span style="background-color: rgb(255, 255, 255); "><div style="font-family: Times; ">  if (snes->vec_rhs  == snes->vec_sol) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_IDN,"Solution vector cannot be right hand side vector");</div><div style="font-family: Times; "><br></div><div style="font-family: Times; ">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.</div><div style="font-family: Times; "><br></div><div style="font-family: Times; ">Mark</div><div><div><font face="Times"><br></font></div><div><font face="Times">  !  Set function evaluation routine and vector</font></div><div><font face="Times">  call SNESSetFunction(solver%snes,solver%rVec2,FormFunction,solver,ierr)</font></div><div><font face="Times"><br></font></div><div><font face="Times">  call SNESSetJacobian(solver%snes,solver%KKTmat,solver%KKTmat,FormJacobian,solver,ierr)</font></div><div><font face="Times"><br></font></div><div><font face="Times">  ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</font></div><div><font face="Times">  !  Customize nonlinear solver; set runtime options</font></div><div><font face="Times">  ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</font></div><div><font face="Times">  !  Set runtime options (e.g., -snes_monitor -snes_rtol <rtol> -ksp_type <type>)</font></div><div><font face="Times">  call SNESSetFromOptions(solver%snes,ierr)</font></div><div><font face="Times"><br></font></div><div><font face="Times">  call SNESSetUp(solver%snes,ierr) ! pre setup, same as (old) KSP</font></div></div><div style="font-family: Times; "><br></div></span></div></body></html>