<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I tried again today and have (re?)discovered this example <a href="https://urldefense.us/v3/__https://petsc.org/release/src/dm/impls/plex/tutorials/ex14.c.html__;!!G_uCfscf7eWS!fJpyioZNC3oN15Qm8-PTF_nxD_NYc-Ou_-moVFROjwZyZREL7e0PwP-rDwjCcynulDAeLGL1WqkN7tyuZepLZ0L7BfI88y7favtI0g$" id="LPlnk382398" class="OWAAutoLink">
https://petsc.org/release/src/dm/impls/plex/tutorials/ex14.c.html</a>, but I cannot understand if in my case I should call
<a href="https://urldefense.us/v3/__https://petsc.org/release/manualpages/PetscSF/PetscSFCreateSectionSF/__;!!G_uCfscf7eWS!fJpyioZNC3oN15Qm8-PTF_nxD_NYc-Ou_-moVFROjwZyZREL7e0PwP-rDwjCcynulDAeLGL1WqkN7tyuZepLZ0L7BfI88y41h-wz6w$" id="OWA7823b4db-9caf-edfa-8c7d-7a06e4a231c3" class="OWAAutoLink">
PetscSFCreateSectionSF</a> and, if so, how should I then activate the returned SF.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Matteo</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Da:</b> Semplice Matteo<br>
<b>Inviato:</b> martedì 22 ottobre 2024 00:24<br>
<b>A:</b> Matthew Knepley <knepley@gmail.com><br>
<b>Cc:</b> PETSc <petsc-users@mcs.anl.gov><br>
<b>Oggetto:</b> Re: [petsc-users] local/global DMPlex Vec output</font>
<div> </div>
</div>
<div>
<p>Dear Matt,</p>
<p> I guess you're right: thresholding by rank==0 and rank==1 in paraview reveals that it is indeed the overlap cells that are appear twice in the output.<br>
</p>
<p>The attached file is not exactly minimal but hopefully short enough. If I run it in serial, all is ok, but with</p>
<p> mpirun -np 2 ./saveDemo</p>
<p>it creates a 10x10 grid, but I get "output.vtu" with a total of 120 cells. However the pointSF of the DMPlex seems correct.</p>
<p>Thanks</p>
<p> Matteo<br>
</p>
<div class="x_moz-cite-prefix">Il 21/10/24 19:15, Matthew Knepley ha scritto:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">On Mon, Oct 21, 2024 at 12:22 PM Matteo Semplice via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" class="x_moz-txt-link-freetext">petsc-users@mcs.anl.gov</a>> wrote:<br>
</div>
<div class="x_gmail_quote">
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div>
<p>Dear petsc-users,<br>
</p>
<p> I am having issues with output of parallel data attached to a DMPlex (or maybe more fundamental ones about DMPlex...).</p>
<p>So I currently</p>
<ol>
<li>create a DMPlex (DMPlexCreateGmshFromFile or DMPlexCreateBoxMesh)</li><li>partition it</li><li>and create a section for my data layout with DMPlexCreateSection(ctx.dmMesh, NULL, numComp, numDof, numBC, NULL, NULL, NULL, NULL, &sUavg)</li><li>DMSetLocalSection(ctx.dmMesh, sUavg)</li><li>create solLoc and solGlob vectors with DMCreateGlobalVector and DMCreateLocalVector</li><li>solve ....</li><li>VecView(ctx.solGlob, vtkViewer) on a .vtu file<br>
</li></ol>
<p>but when I load data in ParaView I get more cells than expected and it is as if the cells in the halo are put twice in output. (I could create a MWE if the above is not clear)<br>
</p>
</div>
</blockquote>
<div>I think we need an MWE here, because from the explanation above, it should work.</div>
<div><br>
</div>
<div>However, I can try to guess the problem. When you partition the mesh, I am guessing that you have cells in the overlap. These cells</div>
<div>must be in the point SF in order for the global section to give them a unique owner. Perhaps something has gone wrong here.</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt </div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div>
<p>I guess that the culprit is point (4), but if I replace it with DMSetGlobalSection then I cannot create the local vector at point (5).<br>
</p>
<p>How should I handle this properly? In my code I need to create both local and global vectors, to perform at least GlobalToLocal and to save the global data.<br>
</p>
<p>(On a side note, I tried also HDF5 but then it complains about the DM not having a DS...; really, any working solution that allows data to be explored with Paraview is fine)<br>
</p>
<p>Thanks for any advice!<br>
</p>
<p>Matteo Semplice</p>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
<span class="x_gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="x_gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>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><br>
</div>
<div><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!fJpyioZNC3oN15Qm8-PTF_nxD_NYc-Ou_-moVFROjwZyZREL7e0PwP-rDwjCcynulDAeLGL1WqkN7tyuZepLZ0L7BfI88y4eE76fNw$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<pre class="x_moz-signature" cols="72">--
---
Professore Associato in Analisi Numerica
Dipartimento di Scienza e Alta Tecnologia
Università degli Studi dell'Insubria
Via Valleggio, 11 - Como</pre>
</div>
</body>
</html>