<div dir="ltr"><div dir="ltr">On Fri, Oct 15, 2021 at 7:31 AM Pierre Seize <<a href="mailto:pierre.seize@onera.fr">pierre.seize@onera.fr</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>It makes sense, thank you. In fact, both ways seems better than
my way. The first one looks the most straightforward.
Unfortunately I do not know how to implement either of them. Could
you please direct me to the corresponding PETSc functions ?<br>
</p>
<p></p></div></blockquote><div>The first way is implemented for example in DMPlexCreateBoxMesh() and DMPlexCreateCylinderMesh(). The second is not implemented since</div><div>there did not seem to be a general way to do it. I would help if you wanted to try coding it up.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><p>Pierre<br>
</p>
<br>
<div>On 15/10/21 13:25, Matthew Knepley
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">On Fri, Oct 15, 2021 at 7:08 AM Pierre Seize <<a href="mailto:pierre.seize@onera.fr" target="_blank">pierre.seize@onera.fr</a>>
wrote:<br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I'm writing a code using PETSc to solve NS equations with FV
on an <br>
unstructured mesh. Therefore I use DMPlex.<br>
<br>
Regarding periodicity, I manage to implement it this way:<br>
<br>
- for each couple of boundaries that is linked with
periodicity, I <br>
create a buffer vector with an ISLocalToGlobalMapping<br>
<br>
- then, when I need to fill the ghost cells corresponding
to the <br>
periodicity, the i "true" cell of the local vector fills the
buffer <br>
vector on location i with VecSetValuesBlockedLocal, then <br>
VecAssemblyBegin/VecAssemblyEnd ensure each value is send to
the correct <br>
location thanks to the mapping, then the i "ghost" cell of
the local <br>
vector reads the vector on location i to get it's value.<br>
<br>
<br>
It works, but it seems to me there is a better way, with
maybe PetscSF, <br>
VecScatter, or something I don't know yet. Does anyone have
any advice ?<br>
</blockquote>
<div><br>
</div>
<div>There are at least two other ways to handle this. First,
the method that is advocated in</div>
<div>Plex is to actually make a periodic geometry, meaning
connect the cells that are meant</div>
<div>to be connected. Then, if you partition with overlap = 1,
PetscGlobalToLocal() will fill in</div>
<div>these cell values automatically.</div>
<div><br>
</div>
<div>Second, you could use a non-periodic geometry, but alter
the LocalToGlobal map such</div>
<div>that the cells gets filled in anyway. Many codes use this
scheme and it is straightforward</div>
<div>with Plex just by augmenting the map it makes
automatically.</div>
<div><br>
</div>
<div>Does this make sense?</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Pierre Seize<br>
</blockquote>
</div>
-- <br>
<div dir="ltr">
<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="http://www.cse.buffalo.edu/%7Eknepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="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="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>