<div dir="ltr">On Wed, Oct 9, 2013 at 3:25 PM, Mark F. Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">I see this in SNESSetUp doc:<div><br></div><div><span style="font-family:Times">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" target="_blank">SNES</a><span style="font-family:Times"> 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" target="_blank">SNESSetUp</a><span style="font-family:Times">(), 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" target="_blank">SNESSolve</a><span style="font-family:Times">(). 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" target="_blank">SNESSetUp</a><span style="font-family:Times">() 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" target="_blank">SNESCreate</a><span style="font-family:Times">() 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" target="_blank">SNESSolve</a><span style="font-family:Times">().</span><div style="font-family:Times">
<br></div><div style="font-family:Times"><br></div></div><div><span style="font-family:Times">I hit this error line in SNESSetUp:</span></div><div><span style="font-family:Times"><br></span></div><div><span style><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></span></div></div></blockquote></div><br>Your Fortran is hurting my eyes :)</div><div class="gmail_extra"><br></div><div class="gmail_extra">Is solver%rVec2 == 0?</div><div class="gmail_extra"><br></div><div class="gmail_extra">
  Matt<br clear="all"><div><br></div>-- <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
</div></div>