<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 7, 2017 at 6:32 AM, 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">
<div dir="auto">
<div></div>
<div><br>
</div>
<div>On Apr 7, 2017, at 6:25 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">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></blockquote><div><br></div><div>The Plex is just a reference, but its the implementation. The DM itself is copied, so the Section is independent. That is the point.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><blockquote type="cite">
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<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->initpf<wbr>lowpsection,i,2);CHKERRQ(ierr)<wbr>;<br>
}<br>
ierr = PetscSectionSetUp(dyn->initpfl<wbr>owpsection);CHKERRQ(ierr);<br>
<br>
/* Get the plex dm */<br>
ierr = DMNetworkGetPlex(networkdm,&pl<wbr>exdm);CHKERRQ(ierr);<br>
<br>
/* Get default sections associated with this plex set for time-stepping<br>
*/<br>
ierr = DMGetDefaultSection(plexdm,&dy<wbr>n->defaultsection);CHKERRQ(ier<wbr>r);<br>
ierr =<br>
DMGetDefaultGlobalSection(plex<wbr>dm,&dyn->defaultglobalsection)<wbr>;CHKERRQ(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((PetscObj<wbr>ect)dyn->defaultsection);<wbr>CHKERRQ(ierr);<br>
ierr =<br>
PetscObjectReference((PetscObj<wbr>ect)dyn->defaultglobalsection)<wbr>;CHKERRQ(ierr);<br>
<br>
<br>
/* Set the new section created for initial conditions */<br>
ierr = DMSetDefaultSection(plexdm,dyn<wbr>->initpflowpsection);CHKERRQ(<wbr>ierr);<br>
ierr =<br>
DMGetDefaultGlobalSection(plex<wbr>dm,&dyn->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"><span class="HOEnZb"><font color="#888888">
<div><br>
</div>
-- <br>
<div class="m_-4372520334553155166gmail_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>
</font></span></div>
</div>
</div>
</blockquote>
</div>
</div>
</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>