<div dir="ltr"><div dir="ltr">On Tue, Oct 4, 2022 at 3:19 PM 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"><div>Hi everyone,</div><div><br></div><div>I am learning how to use the `DMAdaptLabel` for `DMPlex`, and found the example `src/dm/impls/plex/tests/ex20.c` which label one cell to refine. </div><div><br></div><div>1. This example is just a uniform refinement when using the following command. (see attached pdfs for the results).</div><div>```</div><div>[real-int32-gcc] z2yang@ws5:~/opt/firedrake/real-int32-gcc/petsc/src/dm/impls/plex/tests$ ./ex20 -dm_plex_box_faces 3,3 -dm_coord_space 0 -pre_adapt_dm_view ascii::ascii_info -post_adapt_dm_view draw:tikz:figure2.tex<br></div><div>```</div><div> Is this expected for this example?</div></div></blockquote><div><br></div><div>Hi Zongze,</div><div><br></div><div>Yes, I agree this is not easy to see. If you give -dm_plex_transform_view, you can see the kind of transform being used</div><div><br></div><div>knepley/pylith $:/PETSc3/petsc/petsc-pylith$ PETSC_ARCH=arch-pylith-opt make -j8 -f ./gmakefile test search="dm_impls_plex_tests-ex20_<br>2d" TIMEOUT=5000 EXTRA_OPTIONS="-dm_plex_transform_view"<br>Using MAKEFLAGS: --jobserver-fds=3,4 -j -- EXTRA_OPTIONS=-dm_plex_transform_view TIMEOUT=5000 search=dm_impls_plex_tests-ex20_2d<br> TEST arch-pylith-opt/tests/counts/dm_impls_plex_tests-ex20_2d.counts<br> ok dm_impls_plex_tests-ex20_2d<br>not ok diff-dm_impls_plex_tests-ex20_2d # Error code: 1<br># 11a12,14<br># > DMPlexTransform Object: 1 MPI process<br># > type: refine_regular<br># > Regular refinement DMPlexTransform_0x84000000_1<br></div><div><br></div><div>You can see that it is regular refinement, so it ignores the input and refines everything. If you change it, you can get adaptive refinement,</div><div><br></div><div>knepley/pylith $:/PETSc3/petsc/petsc-pylith$ PETSC_ARCH=arch-pylith-opt make -j8 -f ./gmakefile test search="dm_impls_plex_tests-ex20_<br>2d" TIMEOUT=5000 EXTRA_OPTIONS="-pre_adapt_dm_view draw -post_adapt_dm_view draw -draw_pause -1 -dm_plex_transform_type refine_sbr"<br></div><div><br></div><div>I attached the plot.</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>2. I found there is a function named `DMAdaptLabel_Plex`, and `DMAdaptLabel` did not call that function when the type of the dm is `DMPlex`. Is the function `DMAdaptLabel_Plex` still in use?</div></div></blockquote><div><br></div><div>No. I rewrote all the transformations last year. I think the new form is much smaller, cleaner, and more performant. I should delete this function, but I am finishing</div><div>up the review of all adaptive refinement with Joe Wallwork at Imperial.</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>3. `DMAdaptLabel` seems to lack some useful information when I use the wrong adaptor. For example, if I set `-dm_adaptor mmg`, then the process will give a segment fault because the `metric` passed to `DMAdaptMetric_Mmg_Plex` is NULL, see the output below:</div><div>```</div><div>[real-int32-gcc] z2yang@ws5:~/opt/firedrake/real-int32-gcc/petsc/src/dm/impls/plex/tests$ ./ex20 -dm_plex_box_faces 3,3 -dm_coord_space 0 -pre_adapt_dm_view draw:tikz:figure1.tex -post_adapt_dm_view draw:tikz:figure2.tex -dm_adaptor mmg<br>[0]PETSC ERROR: ------------------------------------------------------------------------<br>[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range<br>[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger<br>[0]PETSC ERROR: or see <a href="https://petsc.org/release/faq/#valgrind" target="_blank">https://petsc.org/release/faq/#valgrind</a> and <a href="https://petsc.org/release/faq/" target="_blank">https://petsc.org/release/faq/</a><br>[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run<br>[0]PETSC ERROR: to get more information on the crash.<br>[0]PETSC ERROR: Run with -malloc_debug to check if memory corruption is causing the crash.<br>Abort(59) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0<br></div><div>```</div></div></blockquote><div><br></div><div>Hmm, I at least get an error message:</div><div><br></div><div># [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br># [0]PETSC ERROR: Null argument, when expecting valid pointer<br># [0]PETSC ERROR: Null Pointer: Parameter # 1<br># [0]PETSC ERROR: WARNING! There are option(s) set that were not used! Could be the program crashed before they were used or a spelling mistake, etc!<br># [0]PETSC ERROR: Option left: name:-post_adapt_dm_view value: ascii::ascii_info<br># [0]PETSC ERROR: See <a href="https://petsc.org/release/faq/">https://petsc.org/release/faq/</a> for trouble shooting.<br># [0]PETSC ERROR: Petsc Development GIT revision: v3.17.4-1472-ga50e2f9f007 GIT Date: 2022-09-23 13:01:31 +0000<br># [0]PETSC ERROR: ../ex20 on a arch-master-debug named MacBook-Pro.local by knepley Tue Oct 4 17:29:20 2022<br># [0]PETSC ERROR: Configure options --PETSC_ARCH=arch-master-debug --download-bamg --download-bison --download-chaco --download-ctetgen --download-egads --download-eigen --download-exodusii --download-fftw --download-hpddm --download-ks --download-libceed --download-libpng --download-metis --download-ml --download-mmg --download-mumps --download-netcdf --download-opencascade --download-p4est --download-parmetis --download-parmmg --download-pnetcdf --download-pragmatic --download-ptscotch --download-scalapack --download-slepc --download-suitesparse --download-superlu_dist --download-tetgen --download-triangle --with-cmake-exec=/PETSc3/petsc/apple/bin/cmake --with-ctest-exec=/PETSc3/petsc/apple/bin/ctest --with-hdf5-dir=/PETSc3/petsc/apple --with-mpi-dir=/PETSc3/petsc/apple --with-petsc4py=1 --with-shared-libraries --with-slepc --with-zlib --download-muparser<br># [0]PETSC ERROR: #1 VecViewFromOptions() at /PETSc3/petsc/petsc-dev/src/vec/vec/interface/vector.c:627<br># [0]PETSC ERROR: #2 DMAdaptMetric_Mmg_Plex() at /PETSc3/petsc/petsc-dev/src/dm/impls/plex/adaptors/mmg/mmgadapt.c:130<br># [0]PETSC ERROR: #3 DMAdaptLabel() at /PETSc3/petsc/petsc-dev/src/dm/interface/dmgenerate.c:179<br># [0]PETSC ERROR: #4 main() at /PETSc3/petsc/petsc-dev/src/dm/impls/plex/tests/ex20.c:24<br># [0]PETSC ERROR: PETSc Option Table entries:<br># [0]PETSC ERROR: -dm_adaptor mmg<br># [0]PETSC ERROR: -dm_coord_space 0<br># [0]PETSC ERROR: -dm_plex_box_faces 3,3<br># [0]PETSC ERROR: -post_adapt_dm_view ascii::ascii_info<br># [0]PETSC ERROR: -pre_adapt_dm_view ascii::ascii_info<br># [0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------<br># application called MPI_Abort(MPI_COMM_SELF, 85) - process 0<br> ok dm_impls_plex_tests-ex20_2d # SKIP Command failed so no diff<br></div><div><br></div><div>I agree that it would be nice to segregate the adaptors into those that work with labels and those that work with metrics, but I thought we could</div><div>have an automated system to convert between metrics and labels. However, I have not implemented it yet, since I am still trying to figure out exactly</div><div>how everything should work.</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 dir="ltr"><div dir="ltr"><div dir="ltr">Thanks,</div><div dir="ltr">Zongze Yang</div></div></div></div></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>