<div dir="ltr"><div dir="ltr">On Mon, Feb 27, 2023 at 9:45 AM Zongze Yang <<a href="mailto:yangzongze@gmail.com">yangzongze@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">Hi, Matt<div><br></div><div>Thanks for your clarification. Can I change the type of DMPlex to DMForest?</div></div></blockquote><div><br></div><div>You can, however DMForest is for structured adaptive meshes using quadtrees, and I do not believe</div><div>Firedrake works with that.</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><div><div dir="ltr"><div dir="ltr">Best wishes,<div>Zongze</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 27 Feb 2023 at 20:18, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@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"><div dir="ltr">On Sat, Feb 18, 2023 at 2:25 AM Zongze Yang <<a href="mailto:yangzongze@gmail.com" target="_blank">yangzongze@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>Dear PETSc Group,</div><div><br></div><div>I am writing to inquire about the function DMAdaptLabel in PETSc. </div><div>I am trying to use it coarse a mesh, but the resulting mesh is refined.</div><div><br></div><div>In the following code, all of the `adpat` label values were set to 2 (DM_ADAPT_COARSEN).</div><div>There must be something wrong. Could you give some suggestions?</div></div></blockquote><div><br></div><div>Sorry for the late reply. You are right, I need to put in error messages for this. Here is what is happening.</div><div>PETSc tries to fallback if you do not have certain packages. In this case, you are not using DMForest,</div><div>which responds to both coarsen and refine, so the mesh generator interprets all markers as refine (they</div><div>cannot coarsen). I will add a check that fails on the coarsen marker.</div><div><br></div><div>Coarsening is much more difficult in the presence of boundaries, which is why it is not implemented in</div><div>most packages. For unstructured coarsening, I do not think there is any choice but MMG.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div><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>```python</div><div>from firedrake import *<br>from firedrake.petsc import PETSc<br><br>def mark_all_cells(mesh):<br> plex = mesh.topology_dm<br> with PETSc.Log.Event("ADD_ADAPT_LABEL"):<br> plex.createLabel('adapt')<br> cs, ce = plex.getHeightStratum(0)<br> for i in range(cs, ce):<br> plex.setLabelValue('adapt', i, 2)<br> <br> return plex<br><br>mesh = RectangleMesh(10, 10, 1, 1)<br><br>x = SpatialCoordinate(mesh)<br>V = FunctionSpace(mesh, 'CG', 1)<br>f = Function(V).interpolate(10 + 10*sin(x[0]))<br>triplot(mesh)<br><br>plex = mark_all_cells(mesh)<br>new_plex = plex.adaptLabel('adapt')<br>mesh = Mesh(new_plex)<br>triplot(mesh)<br></div><div>```</div><div><br>Thank you very much for your time.<br></div><br>Best wishes,<br><div><div dir="ltr"><div dir="ltr"><div>Zongze</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>
</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>