<div dir="ltr"><font size="4">Thanks a lot. Pierre.</font><div><font size="4">Do you have any suggestions to build a real serial DM from this gatherDM? </font></div><div><font size="4">I tried several ways, which don't work.</font></div><div><font size="4">DMClone? </font></div><div><font size="4"><br></font></div><div><font size="4">Thanks,</font></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 23, 2025 at 11:39 AM Pierre Jolivet <<a href="mailto:pierre@joliv.et" target="_blank">pierre@joliv.et</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br id="m_9066577954782136701m_-8954130641156169468lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On 23 Apr 2025, at 5:31 PM, neil liu <<a href="mailto:liufield@gmail.com" target="_blank">liufield@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font size="4">Thanks a lot, Stefano. </font><div><font size="4">I tried DMPlexGetGatherDM and DMPlexDistributeField. It can give what we expected. </font></div><div><font size="4">The final gatherDM is listed as follows, rank 0 has all information (which is right) while rank 1 has nothing. </font></div><div><font size="4">Then I tried to feed this gatherDM  into adaptMMG on rank 0 only (it seems MMG works better than ParMMG, that is why I want MMG to be tried first). But it was stuck at collective petsc functions in DMAdaptMetric_Mmg_Plex(). By the way, the present work can work well with 1 rank.</font></div><div><font size="4"><br></font></div><div><font size="4">Do you have any suggestions ?  B</font><span style="font-size:large">uild a real serial DM? </span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>Yes, you need to change the underlying MPI_Comm as well, but I’m not sure if there is any user-facing API for doing this with a one-liner.</div><div><br></div><div>Thanks,</div><div>Pierre</div><br><blockquote type="cite"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><span style="font-size:large">Thanks a lot.</span></div><div><span style="font-size:large">Xiaodong </span></div><div><font size="4"><br></font></div><div><div>DM Object: Parallel Mesh 2 MPI processes</div><div>  type: plex</div><div>Parallel Mesh in 3 dimensions:</div><div>  Number of 0-cells per rank: 56 0</div><div>  Number of 1-cells per rank: 289 0</div><div>  Number of 2-cells per rank: 452 0</div><div>  Number of 3-cells per rank: 216 0</div><div>Labels:</div><div>  depth: 4 strata with value/size (0 (56), 1 (289), 2 (452), 3 (216))</div><div>  celltype: 4 strata with value/size (0 (56), 1 (289), 3 (452), 6 (216))</div><div>  Cell Sets: 2 strata with value/size (29 (152), 30 (64))</div><div>  Face Sets: 3 strata with value/size (27 (8), 28 (40), 101 (20))</div><div>  Edge Sets: 1 strata with value/size (10 (10))</div><div>  Vertex Sets: 5 strata with value/size (27 (2), 28 (6), 29 (2), 101 (4), 106 (4))</div><div>Field Field_0:</div><div>  adjacency FEM</div></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 18, 2025 at 10:09 AM Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">If you have a vector distributed on the original mesh, then you can use the SF returned by DMPlexGetGatherDM and use that in a call to DMPlexDistributeField</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno ven 18 apr 2025 alle ore 17:02 neil liu <<a href="mailto:liufield@gmail.com" target="_blank">liufield@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><p>Dear PETSc developers and users,</p><p>I am currently exploring the integration of MMG3D with PETSc. Since MMG3D supports only serial execution, I am planning to combine parallel and serial computing in my workflow. Specifically, after solving the linear systems in parallel using PETSc:</p>
<ol>
<li><p>I intend to use <code>DMPlexGetGatherDM</code> to collect the entire mesh on the root process for input to MMG3D.</p>
</li>
<li><p>Additionally, I plan to gather the error field onto the root process using <code>VecScatter</code>.</p>
</li>
</ol><p>However, I am concerned that the nth value in the gathered error vector (step 2) may not correspond to the nth element in the gathered mesh (step 1). Is this a valid concern?</p><p>Do you have any suggestions or recommended practices for ensuring correct correspondence between the solution fields and the mesh when switching from parallel to serial mode?</p><div><br></div><div>Thanks, </div><div><br></div><div>Xiaodong </div></div></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Stefano</div>
</blockquote></div>
</div></blockquote></div><br></div></blockquote></div>