[petsc-dev] One DM two SNES

Matthew Knepley knepley at gmail.com
Wed Nov 1 18:58:38 CDT 2017


On Wed, Nov 1, 2017 at 6:50 PM, Blaise A Bourdin <bourdin at lsu.edu> wrote:

> Hi,
>
> I have just spent 2h helping a student debugging a code, and I think that
> the problem is not ours…
> See the attached example: 1 create 1 DM and 2 SNES.
> If I assign the same DM to both SNES, the function and Jacobean of the
> second are ignored, and the first one is used.
> Replace the block l 138 - l. 149 with the one commented above, and the
> result is even weirder.
>
> Is this the intended behavior? If so, should there be a note of this
> behavior in the SNESSetDM man page?
>

I am not sure I understand everything this is doing, but I want to make an
upfront point:

  SNESSetFunction() is intended for use without a DM

When the solver has a DM, we intend you to use

  DMSNESSetFunctionLocal() and DMSNESSetJacobianLocal()

However, now I think I see what is happening. The DMSNES is a structure
that is intended to mediate between the solver
and mesh. When you do SNESSetDM(), it copies over the DMSNES context. This
context is already holding the formfunction
and formjacobian pointers. Yes, this is confusing.

Jed, how should this be documented?

   Matt


>
> Blaise
>
>
>
> --
> Department of Mathematics and Center for Computation & Technology
> Louisiana State University, Baton Rouge, LA 70803, USA
> Tel. +1 (225) 578 1612 <(225)%20578-1612>, Fax  +1 (225) 578 4276
> <(225)%20578-4276> http://www.math.lsu.edu/~bourdin
>
>
>
>
>
>
>
>


-- 
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/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20171101/fbe393ca/attachment.html>


More information about the petsc-dev mailing list