<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Nov 3, 2017 at 7:42 PM, zakaryah . <span dir="ltr"><<a href="mailto:zakaryah@gmail.com" target="_blank">zakaryah@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Hi Bikash,<div dir="auto"><br></div><div dir="auto">I agree with Barry.  If your function changes, quasi Newton methods build up the approximation to the Jacobian from sequential evaluations of the function.  If your Jacobian doesn't change too much when the boundary conditions change, just keep the last approximation and update it with the new function.  Otherwise I don't see what you want to do.</div><div dir="auto"><br></div><div dir="auto">I don't think you need to call SNESGetSolution, you should be able to just access the vector that you pass to SNESSolve.</div></div></blockquote><div><br></div><div>This is one situation where my method of enforcing Dirichlet conditions, namely to eliminate them completely from the system</div><div>being solved, is clearly superior. I would eliminate those constrained variables.</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 dir="auto"><div><div class="h5"><div class="gmail_extra" dir="auto"><div class="gmail_quote">On Nov 3, 2017 6:34 PM, "Bikash Kanungo" <<a href="mailto:bikash@umich.edu" target="_blank">bikash@umich.edu</a>> wrote:<br type="attribution"><blockquote class="m_7608804553585622998quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi Barry,<br><br></div>So for Newton solvers that would work by explicitly setting the boundary conditions in my gradient(function) and Jacobian vectors. But in quasi-Newton solvers where the Jacobian is built from a history of previous Jacobians and current gradient vector, I can't enforce a new boundary condition. I can change the current gradient vector appropriately but I don't see a way handle the the Jacobian. <br><br></div>Thanks,<br></div>Bikash<br><div><div><br><br></div></div></div><div class="m_7608804553585622998elided-text"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 3, 2017 at 6:20 PM, Smith, Barry F. <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
  You should not need to "tamper" with the solution process to achieve this.<br>
<br>
  I would just change how my FormFunction and FormJacobian behave to implement the different boundary conditions. Why would that not work?<br>
<span class="m_7608804553585622998m_-3104558939632306924HOEnZb"><font color="#888888"><br>
   Barry<br>
</font></span><div class="m_7608804553585622998m_-3104558939632306924HOEnZb"><div class="m_7608804553585622998m_-3104558939632306924h5"><br>
> On Nov 3, 2017, at 4:39 PM, Bikash Kanungo <<a href="mailto:bikash@umich.edu" target="_blank">bikash@umich.edu</a>> wrote:<br>
><br>
> Hi Matt,<br>
><br>
> I want to update the Dirichlet boundary condition on the solution vector on-the-fly. One way to do it is to destroy the current snes solver and create a new one with the new Dirichlet boundary condition (which means setting a new solution vector with a different size, size  = # of non-Dirichlet rows). But is it possible to work with the current snes and instead enforce the new Dirichlet boundary condition on the current solution vector?<br>
><br>
> Thanks,<br>
> Bikash<br>
><br>
> On Fri, Nov 3, 2017 at 5:19 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
> What do you want to do to it?<br>
><br>
>   Matt<br>
><br>
> On Fri, Nov 3, 2017 at 5:14 PM, Bikash Kanungo <<a href="mailto:bikash@umich.edu" target="_blank">bikash@umich.edu</a>> wrote:<br>
> Hi,<br>
><br>
> I'm trying to solve a nonlinear problem using BFGS Quasi-Newton solver. I would like to tamper the solution vector x on-the-fly, based on some criterion. Is there a way to do so? Will SNESGetSolution(SNES snes, Vec * x) allow me to do so for each SNES iteration?<br>
><br>
> Thanks,<br>
> Bikash<br>
><br>
> --<br>
> Bikash S. Kanungo<br>
> PhD Student<br>
> Computational Materials Physics Group<br>
> Mechanical Engineering<br>
> University of Michigan<br>
><br>
><br>
><br>
><br>
> --<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<br>
><br>
> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~k<wbr>nepley/</a><br>
><br>
><br>
><br>
> --<br>
> Bikash S. Kanungo<br>
> PhD Student<br>
> Computational Materials Physics Group<br>
> Mechanical Engineering<br>
> University of Michigan<br>
><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="m_7608804553585622998m_-3104558939632306924gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div><div><div><font color="#666666">Bikash S. Kanungo<br></font></div><font color="#666666">PhD Student<br></font></div><font color="#666666">Computational Materials Physics Group<br></font></div><font color="#666666">Mechanical Engineering <br></font></div><font color="#666666">University of Michigan<br><br></font></div></div>
</div>
</div></blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>