[petsc-users] SNES update solution vector

Bikash Kanungo bikash at umich.edu
Mon Nov 6 13:01:52 CST 2017


Thank you Barry. I will see if I can make the changes to the incorporate
re-building the Jacobian(s).



On Sun, Nov 5, 2017 at 2:30 PM, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:

>
>
> > On Nov 3, 2017, at 3:34 PM, Bikash Kanungo <bikash at umich.edu> wrote:
> >
> > Hi Barry,
> >
> > 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.
>
>    There is no way to handle the "Jacobian" because it comes from the
> history which presumably includes different boundary conditions. So if you
> are changing the boundary conditions in your form function within the same
> nonlinear solve the only thing I can see that you could do is each time you
> change the boundary conditions you tell the quasi-Newton method to remove
> any current approximation to the Jacobian and start building it again. Of
> course this assumes you only change the boundary conditions after a bunch
> of function evaluations and that the Quasi-Newton implementation has
> support for removing the current approximation (you may need to add this
> option to the implementation and make a pull request).
>
>   Barry
>
> >
> > Thanks,
> > Bikash
> >
> >
> >
> > On Fri, Nov 3, 2017 at 6:20 PM, Smith, Barry F. <bsmith at mcs.anl.gov>
> wrote:
> >
> >
> >   You should not need to "tamper" with the solution process to achieve
> this.
> >
> >   I would just change how my FormFunction and FormJacobian behave to
> implement the different boundary conditions. Why would that not work?
> >
> >    Barry
> >
> > > On Nov 3, 2017, at 4:39 PM, Bikash Kanungo <bikash at umich.edu> wrote:
> > >
> > > Hi Matt,
> > >
> > > 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?
> > >
> > > Thanks,
> > > Bikash
> > >
> > > On Fri, Nov 3, 2017 at 5:19 PM, Matthew Knepley <knepley at gmail.com>
> wrote:
> > > What do you want to do to it?
> > >
> > >   Matt
> > >
> > > On Fri, Nov 3, 2017 at 5:14 PM, Bikash Kanungo <bikash at umich.edu>
> wrote:
> > > Hi,
> > >
> > > 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?
> > >
> > > Thanks,
> > > Bikash
> > >
> > > --
> > > Bikash S. Kanungo
> > > PhD Student
> > > Computational Materials Physics Group
> > > Mechanical Engineering
> > > University of Michigan
> > >
> > >
> > >
> > >
> > > --
> > > 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
> > >
> > > https://www.cse.buffalo.edu/~knepley/
> > >
> > >
> > >
> > > --
> > > Bikash S. Kanungo
> > > PhD Student
> > > Computational Materials Physics Group
> > > Mechanical Engineering
> > > University of Michigan
> > >
> >
> >
> >
> >
> > --
> > Bikash S. Kanungo
> > PhD Student
> > Computational Materials Physics Group
> > Mechanical Engineering
> > University of Michigan
> >
>
>


-- 
Bikash S. Kanungo
PhD Student
Computational Materials Physics Group
Mechanical Engineering
University of Michigan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20171106/15f6e673/attachment.html>


More information about the petsc-users mailing list