<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body dir="auto">
<div></div>
<div><br>
</div>
<div>On Apr 7, 2017, at 6:25 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Thu, Apr 6, 2017 at 1:04 PM, Abhyankar, Shrirang G. <span dir="ltr">
<<a href="mailto:abhyshr@anl.gov" target="_blank">abhyshr@anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am solving a time-dependent problem using DMNetwork (uses DMPlex<br>
internally) to manage the network. To find the initial conditions, I need<br>
to solve a nonlinear problem on the same network but with different number<br>
of dofs on the nodes and edges.<br>
<br>
Question: Can I reuse the same DMNetwork (DMPlex) for solving the two<br>
problems. The way I am trying to approach this currently is by creating<br>
two PetscSections to be used with Plex. The first one is used for the<br>
initial conditions and the second one is for the time-stepping. Herešs the<br>
code I have<br>
</blockquote>
<div><br>
</div>
<div>This is the right way to do it, but its easier if you call DMClone() first to get a new</div>
<div>DM with the same Plex, and then change its default Section and solve your problem</div>
<div>with it.</div>
</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
Thanks Matt. Doesn't DMClone() make a shallow copy for Plex? So any section set for the cloned Plex will also be set for the original one?
<div><br>
</div>
<div>
<blockquote type="cite">
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<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">
<br>
  for(i=vStart; i < vEnd; i++) {<br>
    /* Two variables at each vertex for the initial condition problem */<br>
    ierr = PetscSectionSetDof(dyn-><wbr>initpflowpsection,i,2);<wbr>CHKERRQ(ierr);<br>
  }<br>
  ierr = PetscSectionSetUp(dyn-><wbr>initpflowpsection);CHKERRQ(<wbr>ierr);<br>
<br>
  /* Get the plex dm */<br>
  ierr = DMNetworkGetPlex(networkdm,&<wbr>plexdm);CHKERRQ(ierr);<br>
<br>
  /* Get default sections associated with this plex set for time-stepping<br>
*/<br>
  ierr = DMGetDefaultSection(plexdm,&<wbr>dyn->defaultsection);CHKERRQ(<wbr>ierr);<br>
ierr =<br>
DMGetDefaultGlobalSection(<wbr>plexdm,&dyn-><wbr>defaultglobalsection);CHKERRQ(<wbr>ierr);<br>
<br>
/* Increase the reference count so that the section does not get destroyed<br>
when a new one is set with DMSetDefaultSection */<br>
ierr =<br>
PetscObjectReference((<wbr>PetscObject)dyn-><wbr>defaultsection);CHKERRQ(ierr);<br>
ierr =<br>
PetscObjectReference((<wbr>PetscObject)dyn-><wbr>defaultglobalsection);CHKERRQ(<wbr>ierr);<br>
<br>
<br>
  /* Set the new section created for initial conditions */<br>
  ierr = DMSetDefaultSection(plexdm,<wbr>dyn->initpflowpsection);<wbr>CHKERRQ(ierr);<br>
  ierr =<br>
DMGetDefaultGlobalSection(<wbr>plexdm,&dyn-><wbr>initpflowpglobsection);<wbr>CHKERRQ(ierr)<br>
;<br>
<br>
<br>
<br>
Would this work or should I rather use DMPlexCreateSection to create the<br>
PetscSection used for initial conditions (dyn->initpflowpsection)? Any<br>
other problems that I should be aware of? Has anyone else attempted using<br>
the same plex for solving two different problems?<br>
<br>
Thanks,<br>
Shri<br>
<br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature" data-smartmail="gmail_signature">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>
</div>
</div>
</blockquote>
</div>
</body>
</html>