<div dir="ltr"><div dir="ltr">On Tue, Sep 1, 2020 at 7:15 AM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com">thibault.bridelbertomeu@gmail.com</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 dir="ltr"><div>Hi Matthew, <br></div><div><br></div><div>So I turned the pages of the User guide real quick and the only reference I found to Pragmatic was in DMAdaptMetric. It says it is based on a vertex-based metric, but I could not find any more information regarding the characteristics of the expected metric ... Would you by any chance have more documentation or maybe a test/tutorial/example that builds such a metric and calls DMAdaptMetric ?</div></div></blockquote><div><br></div><div>There are tests: <a href="https://gitlab.com/petsc/petsc/-/blob/master/src/dm/impls/plex/tests/ex19.c">https://gitlab.com/petsc/petsc/-/blob/master/src/dm/impls/plex/tests/ex19.c</a></div><div>but not much explanation. The input is actually the metric tensor at the vertices. You can see</div><div>me making representative things in the example.</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"><div dir="ltr"><div>Thanks,</div><div><br></div><div>Thibault<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 1 sept. 2020 à 08:24, Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank">thibault.bridelbertomeu@gmail.com</a>> a écrit :<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"><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div>Hi everyone, hi Matt,</div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 31 août 2020 à 22:03, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> a écrit :<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">On Mon, Aug 31, 2020 at 4:00 PM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank">thibault.bridelbertomeu@gmail.com</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><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 31 août 2020 à 20:35, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> a écrit :<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">On Mon, Aug 31, 2020 at 9:45 AM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank">thibault.bridelbertomeu@gmail.com</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 dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Matt, </div><div dir="ltr"><br clear="all"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div><div><div><div>OK so I tried to replicate the problem starting from one of the tests in PETSc repo.</div></div></div></div></div><div>I found <a href="https://gitlab.com/petsc/petsc/-/blob/master/src/dm/impls/plex/tests/ex20.c" target="_blank">https://gitlab.com/petsc/petsc/-/blob/master/src/dm/impls/plex/tests/ex20.c</a> that actually uses DMAdaptLabel.</div><div>Just add </div><div><br></div><div><pre width="80" style="font-family:monospace"><font style="font-family:monospace;color:rgb(0,0,0)">{<br><br> </font><a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DM.html#DM" style="font-family:monospace;color:rgb(0,0,0)" target="_blank">DM</a><font style="font-family:monospace;color:rgb(0,0,0)"> gdm;<br><br><br><br></font> <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexConstructGhostCells.html#DMPlexConstructGhostCells" style="font-family:monospace;color:rgb(0,0,0)" target="_blank">DMPlexConstructGhostCells</a><font style="font-family:monospace;color:rgb(0,0,0)">(dm, NULL, NULL, &gdm);<br><br></font><font style="font-family:monospace;color:rgb(0,0,0)"> </font><a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMDestroy.html#DMDestroy" style="font-family:monospace;color:rgb(0,0,0)" target="_blank">DMDestroy</a><font style="font-family:monospace;color:rgb(0,0,0)">(&dm);</font></pre><pre width="80" style="font-family:monospace"> dm = gdm;</pre><pre width="80" style="font-family:monospace">}</pre><pre width="80" style="font-family:monospace"><font style="font-family:Arial,Helvetica,sans-serif;color:rgb(0,0,0)" face="Arial, Helvetica, sans-serif">after line 24 where the box mesh is generated. Then compile and run with ex20 -dim 2.<br><br></font><font style="font-family:arial,sans-serif;color:rgb(0,0,0)" face="arial, sans-serif">It should tell you that Triangle 18 has an invalid vertex index.<br><br>That's the minimal example that I found that replicates the problem.</font></pre><pre width="80" style="font-family:monospace"><font style="font-family:arial,sans-serif;color:rgb(0,0,0)" face="arial, sans-serif"></font></pre></div></div></div></div></div></div></div></div></div></div></div></blockquote><div>Ah, okay. p4est knows to discard the ghost cells. I can add that to Triangle. </div></div></div></blockquote><div dir="auto"><br></div><div dir="auto">I thought it was something like that, seeing what addition of code triggers the problem. </div><div dir="auto">Thanks for adding the treatment to Triangle !</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 class="gmail_quote"><div></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"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><pre width="80" style="font-family:monospace"><font style="font-family:arial,sans-serif;color:rgb(0,0,0)" face="arial, sans-serif">Regarding the serial character of the technique, I tried with a distributed mesh and it works.</font></pre></div></div></div></div></div></div></div></div></div></div></div></blockquote><div>Hmm, it can't work. Maybe it appears to work. Triangle knows nothing about parallelism. So this must be feeding the local mesh to triangle and replacing it by</div><div>a refined mesh, but the parallel boundaries will not be correct, and might not even match up.</div><div></div></div></div></blockquote><div dir="auto"><br></div><div dir="auto">Ok, yea, it appears to work. When asked to refine from scratch, not from AdaptLabel but with a -dm_refine order, the mesh is funky as if it was entirely re-made and the previous mesh thrown away. </div><div dir="auto">Can you think of a way where each processor would be able to call on Triangle on it’s own, with its own piece of mesh and maybe the surrounding ghost cells ? I imagine it could work for parallel refining of triangular meshes, couldn’t it ?</div></div></div></blockquote><div><br></div><div>It turns out that his is a very hairy problem. That is why almost no parallel refinement packages exist. To my knowledge, this is only one: Pragmatic. We support that package, but</div><div>it is in development, and we really need to update our interface. I am working on it, but too much stuff gets in the way.</div></div></div></blockquote><div><br></div><div>Oh really, only the one ? Okay okay, I guess I was too optimistic ! I'll look into Pragmatic even though it is in dev, maybe it'll be enough for what I wanna do for now.</div><div>By the way, talking about things that get in the way, should I open an issue on the gitlab regarding Triangle not ignoring the ghost cells, would that be easier for you guys ?</div><div><br></div><div>Thanks & have a great day,</div><div><br></div><div>Thibault </div><div><br></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"><div dir="ltr"><div class="gmail_quote"><div></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"><div><div class="gmail_quote"><div dir="auto">Thanks for your replies,</div><div dir="auto">Have a great afternoon/evening !</div><div dir="auto"><br></div><div dir="auto">Thibault</div><div dir="auto"><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 class="gmail_quote"><div><br></div><div> Thanks,</div><div><br></div><div> Matt </div></div></div><div dir="ltr"><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 dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><pre width="80" style="font-family:monospace"><font style="font-family:arial,sans-serif;color:rgb(0,0,0)" face="arial, sans-serif">So do you mean that intrinsically it gathers all the cells on the master proc before proceeding to the coarsening & refinement and only then broadcast the info back to the other processors ?</font></pre><pre width="80" style="font-family:monospace"><font style="font-family:arial,sans-serif;color:rgb(0,0,0)" face="arial, sans-serif">Thanks, </font></pre><pre width="80" style="font-family:monospace"><font style="font-family:arial,sans-serif;color:rgb(0,0,0)" face="arial, sans-serif">Thibault</font></pre></div></div></div></div></div></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 31 août 2020 à 12:55, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> a écrit :<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">On Mon, Aug 31, 2020 at 5:34 AM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank">thibault.bridelbertomeu@gmail.com</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 dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Dear all, <div><br></div><div>I have recently been playing around with the AMR capabilities embedded in PETSc for quad meshes using p4est. Based on the TS tutorial ex11, I was able to incorporate the AMR into a pre-existing code with different metrics for the adaptation process.</div><div>Now I would like to do something similar using tri meshes. I read that compiling PETSc with Triangle (in 2D and Tetgen for 3D) gives access to refinement and coarsening capabilities on triangular meshes.When I try to execute the code with a triangular mesh (that i manipulate as a DMPLEX), it yields "Triangle 1700 has an invalid vertex index" when trying to adapt the mesh (the initial mesh indeed has 1700 cells). From what i could tell, it comes from the reconstruct method called by the triangulate method of triangle.c, the latter being called by either <strong style="color:rgb(0,0,0)"><font style="color:rgb(65,105,225)">DMPlexGenerate_Triangle </font></strong>or <strong style="color:rgb(0,0,0)"><font style="color:rgb(65,105,225)">DMPlexRefine_Triangle </font></strong>in PETSc, I cannot be sure. </div><div><br></div><div>In substance, the code is the same as in ex11.c and the crash occurs in the first adaptation pass, i.e. an equivalent in ex11 is that it crashes after the SetInitialCondition in the first if (useAMR) located line 1835 when it calls adaptToleranceFVM (which I copied basically so the code is the same).</div><div><br></div><div>Is the automatic mesh refinement feature on tri meshes supposed to work or am I trying something that has not been completed yet ?</div></div></div></div></div></div></blockquote><div><br></div><div>It is supposed to work, and does for some tests in the library. I stopped using it because it is inherently serial and it is isotropic. However, it should be fixed.</div><div>Is there something I can run to help me track down the problem?</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"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Thank you very much for your help, as always.</div><div><br clear="all"><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><div><div><div><div>Thibault Bridel-Bertomeu<br>—<br></div></div></div></div>Eng, MSc, PhD</div><div>Research Engineer</div><div>CEA/CESTA</div><div>33114 LE BARP</div><div>Tel.: (+33)557046924</div><div>Mob.: (+33)611025322<br></div><div>Mail: <a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank">thibault.bridelbertomeu@gmail.com</a><br></div></div></div></div></div></div></div></div></div></div></div></div></div><br><br></blockquote></div><br clear="all"><div><br></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/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div><br><br></blockquote></div></div></div></div></div><br><br></blockquote></div><br clear="all"><div><br></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/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div><br><br></blockquote></div></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><div><div><div><div>Thibault Bridel-Bertomeu<br>—<br></div></div></div></div>Eng, MSc, PhD</div><div>Research Engineer</div><div>CEA/CESTA</div><div>33114 LE BARP</div><div>Tel.: (+33)557046924</div><div>Mob.: (+33)611025322<br></div><div>Mail: <a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank">thibault.bridelbertomeu@gmail.com</a><br></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></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/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div></div>
</blockquote></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>