[petsc-users] Questions about DMComposite & DMRedundant

Barry Smith bsmith at mcs.anl.gov
Tue Apr 5 13:24:00 CDT 2016


   Brian,

    Take a look at src/snes/examples/tutorials/ex21.c and ex22.c  I think it should answer your questions.

   Barry



> On Apr 5, 2016, at 3:38 AM, Brian Skjerven <brian.skjerven at gmail.com> wrote:
> 
> Hi,
> 
> I'm working on implementing pseudo arc-length continuation using PETSc to do the Newton solves.  Right now I'm just working with simple structured meshes, so I'm using 1- & 2-D DMDAs, and I'm trying to make use of DMComposite to handle both the PDE and the pseudo arc-length constraint. I found a similar thread from a while back (https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2011-October/010373.html) but some of the suggestions appear to be outdated (e.g. DMCompositeAddArray has been removed).  So, I guess my questions are:
> 
> - DMRedundant seems to be the preferred way to do this.  Is there any documentation available?  I've looked over the DMRedundantCreate man page (http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMRedundantCreate.html) and the 2 examples, but am still unclear how this works.  
> 
> - Adding arrays to the DMComposite.  So my system involves a bordered, banded matrix; the whole matrix is n+1 x n+1 in size, with the inner n x n being the diagonal matrix resulting from finite differences, the n + 1 column coming from the parameter (e.g. lambda in a Bratu problem), and the n + 1 row coming from the pseudo arc-length constraint.  Conceptually, I see it as just "sticking" an extra row and column onto my existing DMDA, but I'm not sure how to do that with a combination of DMRedundant and DMComposite.  For example, how do I tell PETSc which dimension to use (i.e. adding a row vs adding a column).  
> 
> - I'm providing routines to evaluate the function and the Jacobian.  Do I need to do separate functions for each DM in my composite DM?  That is, a function and Jacobian for the PDE portion and a separate set of functions for the arc-length constraint?  Or do I just need to provide one and SNES is smart to figure things out for the composite DM?  I guess I'm unclear how the coupling is handled.
> 
> Thanks for your help.
> 
> Brian Skjerven



More information about the petsc-users mailing list