[petsc-users] SNESSetUpdate function

Matthew Knepley knepley at gmail.com
Fri Jan 20 09:30:12 CST 2012


On Fri, Jan 20, 2012 at 9:21 AM, Bernardo Rocha <
bernardomartinsrocha at gmail.com> wrote:

> I have a C++ class that solves a nonlinear problem using PETSC's KSP
> without using SNES.
> Now I'm trying to make use of SNES.
>
> I created some functions to form the Function and Jacobian, just like the
> example (snes/examples/tutorials/ex1.c). I'm solving a nonlinear mechanics
> problem. When I have some prescribed displacements (fixed dofs) I do not
> assemble the whole system, so when SNES starts solving the linear systems
> the solution vector *u* contains only some part of the displacement, the
> other were already imposed in my vector *x*. So I need to implement a
> different Update function that considers if a degree of freedom is fixed or
> not, in order to update *x *to continue the nonlinear iteration.
>
> That's why I think I need to do this. Is it clear?
>

I may not understand what you are doing, but it sounds to me like you are
imposing Dirichlet conditions on the displacement. You can
do this two other ways:

  a) Eliminate those degrees of freedom from the system you give PETSc

or

  b) For fixed dofs, make that row of the Jacobian the identity, and put a
zero in the residual.

    Matt


> On Fri, Jan 20, 2012 at 12:55 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
>> On Fri, Jan 20, 2012 at 08:28, Bernardo Rocha <
>> bernardomartinsrocha at gmail.com> wrote:
>>
>>> I'm using SNES but I would like to update my data after each successful
>>> step computation within the nonlinear solver using a different function. I
>>> mean, after the solution of each linear system I would like to get \Delta
>>> x_k to update x_{k+1} which is stored somewhere in my application class
>>> (C++ code).
>>
>>
>> Can you explain more about what you are trying to do? What you describe
>> does not sound algorithmically correct.
>>
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120120/db82c339/attachment.htm>


More information about the petsc-users mailing list