<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="">Thank you for your reply. </div><div class=""><br class=""></div><div class="">You are right in your intuition about the Finite Volume Method. In the case of no bathymetry, this is not required as the fluxes stay the same on both the sides of the interface. However, with the bathymetry terms, the bed slope terms are also accounted into the Riemann Solver. However, in order to keep the model well-balanced, the left and right flux differ by the wave speeds as indicated by the equations in the diagram (see attachment). </div><div class=""><br class=""></div><div class="">Perhaps, this is more of a localised requirement for my problem but other models might feature the same formulation. </div><div class=""><br class=""></div><div class=""><img apple-inline="yes" id="35C45F2A-17D5-4818-BC7A-2F41D3A07153" width="657" height="351" src="cid:F3892D13-C67C-4B62-ACD4-D4BDA4358909" class=""></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=""><br class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 14 Jul 2020, at 12:19, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div dir="ltr" class="">On Tue, Jul 14, 2020 at 5:47 AM MUKKUND SUNJII <<a href="mailto:mukkundsunjii@gmail.com" class="">mukkundsunjii@gmail.com</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="overflow-wrap: break-word;" class=""><div class="">Greetings, </div><div class=""><br class=""></div><div class="">This message is again in relation to the previous series of exchanges I had with the PETSc development team and professors. </div><div class=""><br class=""></div><div class="">To not be repetitive I will provide a concise description for those unaware. I have built a well-balanced shallow water solver based on ts/tutorials/ex11.c. However, the Riemann Solver that I have written includes the topography terms. To be well-balanced, I have made a change in the Riemann Solver interface in fv.c: Before the change it computes only one flux vector (*flux[]). But now with my modification, it computes 2 flux terms (*fluxL[] and <span style="" class="">*fluxR[]</span>) and it is assigned to the left and right side of the interface respectively. The exact description of the problem itself is mentioned in the thread below. </div><div class=""><br class=""></div><div class="">I might have accidentally found the solution while trying to figure out the origin of the problem. </div><div class=""><br class=""></div><div class="">I noticed that the solver is no longer well-balanced (when running the adaptive mesh refinement case) when I use -dm_refine to prescribe the refinement level of the initial grid. I understand now, that the ‘noise' all across the domain is indeed caused by the wrong mapping of the left and right fluxes at the interface by my modification in fv.c. </div><div class=""><br class=""></div><div class="">However, interestingly, the solver becomes well-balanced (i.e., the mapping is correct again) when I use -dm_forest_initial_refinement instead. I have tested various cases with water completely at rest to verify the well-balancedness of the solver while using DM of type p4est. </div><div class=""><br class=""></div><div class="">I thought this observation might be interesting to you as I see some of the AMR test cases in ex11.c use -dm_refine and some others use -dm_forest_initial_refinement. My knowledge on P4est and DMPlex is lacking to explain the discrepancy between the two. Perhaps, someone else can shine light on this matter. </div><div class=""><br class=""></div><div class="">Thank you very much in advance. </div></div></blockquote><div class=""><br class=""></div><div class="">That is a very clear description. That will really help us figure out what is happening.</div><div class=""><br class=""></div><div class="">For people like me who do not really understand FV methods, can you briefly explain why we would have 2 fluxes? The simple way I think</div><div class="">about things, in FV you consider the state in 2 adjacent cells and then determine a flux between them, which can be positive or negative, but</div><div class="">it is the same flux when viewed from either side.</div><div class=""><br class=""></div><div class=""> Thanks,</div><div class=""><br class=""></div><div class=""> Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="overflow-wrap: break-word;" class=""><div class="">Regards, </div><div class=""><br class=""></div><div class="">Mukkund</div><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class="">Begin forwarded message:</div><br class=""><div style="margin: 0px;" class=""><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;" 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" target="_blank" class="">mukkundsunjii@gmail.com</a>><br class=""></span></div><div style="margin: 0px;" class=""><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;" 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: 0px;" class=""><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;" 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: 0px;" class=""><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;" 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" target="_blank" class="">mfadams@lbl.gov</a>><br class=""></span></div><div style="margin: 0px;" class=""><span style="font-family: -webkit-system-font, "Helvetica Neue", Helvetica, sans-serif;" 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" target="_blank" class="">petsc-users@mcs.anl.gov</a>>, Domenico Lahaye <<a href="mailto:D.J.P.Lahaye@tudelft.nl" target="_blank" class="">D.J.P.Lahaye@tudelft.nl</a>><br class=""></span></div><br class=""><div class=""><div style="overflow-wrap: break-word;" 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=""><span id="cid:1734cd3d31ee98675d81"><Bathymetry.png></span></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=""><span id="cid:1734cd3d31e7a8a1b8a2"><Plex.png></span></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 style="white-space: pre-wrap;" class=""> </span><br class=""><div class=""><span id="cid:1734cd3d31ea1399f7d3"><p4est.png></span></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" target="_blank" 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" target="_blank" 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" target="_blank" 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 </blockquote></span></div></div></div></blockquote></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a></div></div></div></div></div></div></div></div></div></blockquote></div><br class=""></div></body></html>