<div dir="ltr">On Thu, Oct 10, 2013 at 12:28 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"><div><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
It seems like first, the (snes->vec_rhs  == snes->vec_sol) test should be moved to SNESSolve where these are apparently set.<br></blockquote><div><br></div><div>This is not good enough since the next lines will fail if snes->vec_sol is NULL. </div>
</div></div></div></blockquote><div><br></div><div>That's what I suggested below.  I can test this now if you like.</div></div></div></blockquote><div><br></div><div>Excellent. I just pushed to next.</div><div><br></div>
<div>  Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div>Mark</div><br><blockquote type="cite"><div dir="ltr">
<div class="gmail_extra"><div class="gmail_quote"><div>I think we do not to substitute vec_func for vec_sol, but</div>
<div>we also need to move creation of the update vector since it must be the size of the solution. Will do it now.</div><div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Second can we use snes->vec_func instead of snes->vec_sol here?  This would remove all dependance on vec_rhs and vec_sol in SNESSetup.<br>
<br>
Mark<br>
<br>
  !  Extract global and local vectors from DM; then duplicate for remaining<br>
  !     vectors that are the same types<br>
  call MatGetVecs(solver%KKTmat,solver%xVec2,solver%bVec2,ierr)<br>
  call VecDuplicate(solver%bVec2,solver%rVec2,ierr)<br>
<br>
  call SNESSetDM(solver%snes,solver%da,ierr)<br>
<br>
  ! call SNESSetApplicationContext(solver%snes,solver,ierr)<br>
  ! call SNESSetApplicationContext(solver%snes,grid,ierr)<br>
<br>
  !  Set function evaluation routine and vector<br>
  call SNESSetFunction(solver%snes,solver%rVec2,FormFunction,solver,ierr)<br>
<br>
  call SNESSetJacobian(solver%snes,solver%KKTmat,solver%KKTmat,FormJacobian,solver,ierr)<br>
<br>
  ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>
  !  Customize nonlinear solver; set runtime options<br>
  ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<br>
  !  Set runtime options (e.g., -snes_monitor -snes_rtol <rtol> -ksp_type <type>)<br>
  call SNESSetFromOptions(solver%snes,ierr)<br>
<br>
  call SNESSetUp(solver%snes,ierr) ! pre setup, same as (old) KSP<br>
<br>
<br>
</blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><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
</font></span></div></div>
</blockquote></div><br></div></blockquote></div><br><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>