<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Greetings, <div class=""><br class=""></div><div class="">This is with regards to the exchange (see below) I had pertaining to P4est and DMPlex. The problem only persists with DM of type P4est. </div><div class=""><br class=""></div><div class="">As suggested by Mark Adams, the possible source of the problem (in my case) could be in the mapping from P4est to PETSc. In an effort to understand more, I went digging and I found this file:</div><div class=""><a href="https://gitlab.com/petsc/petsc/-/blob/master/src/dm/impls/forest/p4est/dmp4est.c#L4" class="">https://gitlab.com/petsc/petsc/-/blob/master/src/dm/impls/forest/p4est/dmp4est.c#L4</a></div><div class=""><br class=""></div><div class="">In line 4, the mapping for the faces from p4est to PETSc are defined. Any explanation of the contents of the array <span class="n" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">P4estFaceToPetscFace</span><span class="p" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">[</span><span class="p" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">] can help me out a lot. </span></div><div class=""><span class="p" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br class=""></span></div><div class=""><span class="p" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">Thank you in advance. </span></div><div class=""><span class="p" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br class=""></span></div><div class=""><span class="p" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">Regards, </span></div><div class=""><span class="p" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br class=""></span></div><div class=""><span class="p" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">Mukkund  </span> </div><div class=""><br class=""></div><div class="">For Context: I am trying to expand the shallow water equation Riemann Solver provided in ./ts/tutorials/ex11.c to support bathymetry. I have successfully implemented a well-balanced Riemann Solver that works fine with PLEX DM but the behaviour changes when I use P4est DM (for adaptive mesh refinement). </div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">Begin forwarded message:</div><br class="Apple-interchange-newline"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">From: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">MUKKUND SUNJII <<a href="mailto:mukkundsunjii@gmail.com" class="">mukkundsunjii@gmail.com</a>><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Subject: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class=""><b class="">Re: [petsc-users] Regarding P4est</b><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Date: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">17 June 2020 at 21:20:29 CEST<br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">To: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Mark Adams <<a href="mailto:mfadams@lbl.gov" class="">mfadams@lbl.gov</a>><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Cc: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>>, Domenico Lahaye <<a href="mailto:D.J.P.Lahaye@tudelft.nl" class="">D.J.P.Lahaye@tudelft.nl</a>><br class=""></span></div><br class=""><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Yes, precisely! I am not sure how I can replicate using the original version of ex11.c because it does not support bathymetry. <div class=""><br class=""></div><div class="">Regardless, to demonstrate the discrepancy, I have uploaded three plots. The scenario is a lake at rest. Essentially, you have a varying bathymetry but a level water surface. If the model is well balanced, then the water surface height must not change. The description of the files are below </div><div class=""><br class=""></div><div class="">1) Bathymetry.png : It shows you the bathymetry profile (z(x)) and the water surface height (H = h+z(x)) at t = 0.</div><div class=""><img apple-inline="yes" id="B4B044BF-9005-4C27-B700-6B6BBF9D4682" class="" src="cid:9C9A2428-7F25-4C24-8F5D-F60601B64812"></div><div class=""><br class=""></div><div class="">2) Plex.png : This is the water surface height after 1 time step (<span style="color: rgb(12, 255, 0); font-family: "Andale Mono"; background-color: rgba(255, 255, 255, 0.9);" class="">0.007055 sec</span>)  and the dm type is Plex. As you can see, the water surface height is undisturbed as expected.</div><div class=""><img apple-inline="yes" id="4966DB14-E920-468E-9F7B-DF370908BF29" class="" src="cid:222ACF39-4257-4981-851C-B44A61854B37"></div><div class=""><br class=""></div><div class="">3) P4est.png : This is the result after 1 time step (same final time) if I set the dm type as p4est. The noise is in the order of 1e-3 to be a little more specific. Since its not specifically at the boundaries and more or less spread throughout, it could indeed be noise introduced. But of course I could be wrong. <span class="Apple-tab-span" style="white-space:pre">  </span><br class=""><div class=""><img apple-inline="yes" id="E5271AAD-474F-42A5-A8F1-76B1C3BEF792" class="" src="cid:758742F8-3C6C-4C8D-BBF9-E9ACF5C44715"></div><div class=""><br class=""></div><div class="">Maybe this paints a better picture. </div><div class=""><br class=""></div><div class="">Regards, </div><div class=""><br class=""></div><div class="">Mukkund </div><div class=""><br class=""></div><div class="">For your reference, the Riemann Solver is a modified version of the HLL solver: <span class=""><b class="">A simple well-balanced and positive numerical scheme for the shallow-water system by </b></span><b class="">Emmanuel Audusse, Christophe Chalons, Philippe Ung. </b></div><div class="">(<a href="https://www.intlpress.com/site/pub/files/_fulltext/journals/cms/2015/0013/0005/CMS-2015-0013-0005-a011.pdf" class="">https://www.intlpress.com/site/pub/files/_fulltext/journals/cms/2015/0013/0005/CMS-2015-0013-0005-a011.pdf</a>)</div><span class=""><br class=""><blockquote type="cite" class="">On 17 Jun 2020, at 20:47, Mark Adams <<a href="mailto:mfadams@lbl.gov" class="">mfadams@lbl.gov</a>> wrote:<br class=""><br class="">So you get this noise with a regular grid in p4est. So the same grid as will Plex, and you are not getting the same results.<br class=""><br class="">I don't know of any difference from p4est on a non-adapted grid. Can you reproduce this with ex11?<br class=""><br class="">Matt and Toby could answer this better.<br class=""><br class=""><br class="">On Wed, Jun 17, 2020 at 1:33 PM MUKKUND SUNJII <<a href="mailto:mukkundsunjii@gmail.com" class="">mukkundsunjii@gmail.com</a>> wrote:<br class="">Greetings, <br class=""><br class="">I am a master’s student working on the shallow water model of the TS example 'ex11.c' as part of my thesis. Therefore, I am working with DMForest for the implementation of adaptive grids. I have a question and an observation. <br class=""><br class="">I am trying to find relevant information about interpolation that takes place through the routine DMForestTransferVec. Perhaps it could be my inability to find it, but I am unable to locate the implementation of the routine <br class=""><br class="">(forest->transfervec)(dmIn,vecIn,dmOut,vecOut,useBCs,time). <br class=""><br class="">Any information on this particular routine is highly appreciated.<br class=""><br class="">Furthermore, I have developed a well balanced Riemann Solver that includes topography in the model. In the process of testing both the non-adaptive and adaptive version, I found that my results differed when I changed the type of DM. For instance, when I run a scenario in a fixed, non-adaptive grid  with a DM of type 'P4est', I find that the well balanced nature is lost due to small perturbations all across the domain. However, this does not occur when I use a DM of type ‘plex’. Is there a radical change in the routines between the two DM’s? This is not as much of a question as it is an observation. <br class=""><br class="">Thank you for all of your suggestions! <br class=""><br class="">Regards, <br class=""><br class="">Mukkund <br class=""> <br class=""><br class=""></blockquote></span><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>