[petsc-users] Regarding P4est-Petsc Mapping

Matthew Knepley knepley at gmail.com
Fri Jul 10 13:11:51 CDT 2020


On Fri, Jul 10, 2020 at 1:58 PM MUKKUND SUNJII <mukkundsunjii at gmail.com>
wrote:

> Greetings,
>
> 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.
>
> 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:
>
> https://gitlab.com/petsc/petsc/-/blob/master/src/dm/impls/forest/p4est/dmp4est.c#L4
>
> In line 4, the mapping for the faces from p4est to PETSc are defined. Any
> explanation of the contents of the array P4estFaceToPetscFace[] can help
> me out a lot.
>

I believe this is about canonical numbering. DMPlex always wants outward
normals, and so orients its quadrilateral in a loop:

  ---2---
  |        |
  3       1
  |        |
  ---0---

and we have

  PetscFaceToP4estFace[4] = {2, 1, 3, 0}

which would renumber it

  ---3---
  |        |
  0       1
  |        |
  ---2---

The other one should be the inverse permutation,

  P4estFaceToPetscFace[4] = {3, 1, 0, 2}

which it is.

  Thanks,

     Matt

Thank you in advance.
>
> Regards,
>
> Mukkund
>
> 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).
>
>
> Begin forwarded message:
>
> *From: *MUKKUND SUNJII <mukkundsunjii at gmail.com>
> *Subject: **Re: [petsc-users] Regarding P4est*
> *Date: *17 June 2020 at 21:20:29 CEST
> *To: *Mark Adams <mfadams at lbl.gov>
> *Cc: *petsc-users <petsc-users at mcs.anl.gov>, Domenico Lahaye <
> D.J.P.Lahaye at tudelft.nl>
>
> Yes, precisely! I am not sure how I can replicate using the original
> version of ex11.c because it does not support bathymetry.
>
> 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
>
> 1) Bathymetry.png : It shows you the bathymetry profile (z(x)) and the
> water surface height (H = h+z(x)) at t = 0.
>
> 2) Plex.png : This is the water surface height after 1 time step (0.007055
> sec)  and the dm type is Plex. As you can see, the water surface height
> is undisturbed as expected.
>
> 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.
>
> Maybe this paints a better picture.
>
> Regards,
>
> Mukkund
>
> For your reference, the Riemann Solver is a modified version of the HLL
> solver: *A simple well-balanced and positive numerical scheme for the
> shallow-water system by **Emmanuel Audusse, Christophe Chalons, Philippe
> Ung. *
> (
> https://www.intlpress.com/site/pub/files/_fulltext/journals/cms/2015/0013/0005/CMS-2015-0013-0005-a011.pdf
> )
>
> On 17 Jun 2020, at 20:47, Mark Adams <mfadams at lbl.gov> wrote:
>
> 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.
>
> I don't know of any difference from p4est on a non-adapted grid. Can you
> reproduce this with ex11?
>
> Matt and Toby could answer this better.
>
>
> On Wed, Jun 17, 2020 at 1:33 PM MUKKUND SUNJII <mukkundsunjii at gmail.com>
> wrote:
> Greetings,
>
> 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.
>
> 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
>
> (forest->transfervec)(dmIn,vecIn,dmOut,vecOut,useBCs,time).
>
> Any information on this particular routine is highly appreciated.
>
> 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.
>
> Thank you for all of your suggestions!
>
> Regards,
>
> Mukkund
>
>
>
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200710/bab11711/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bathymetry.png
Type: image/png
Size: 79963 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200710/bab11711/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Plex.png
Type: image/png
Size: 68539 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200710/bab11711/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p4est.png
Type: image/png
Size: 150800 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200710/bab11711/attachment-0005.png>


More information about the petsc-users mailing list