[petsc-users] Extracting solution at a boundary in a DMPlex/PetscFV paradigm

Matthew Knepley knepley at gmail.com
Thu Apr 22 07:41:49 CDT 2021

On Thu, Apr 22, 2021 at 8:31 AM Thibault Bridel-Bertomeu <
thibault.bridelbertomeu at gmail.com> wrote:

> Dear all,
> I am working with multi-D DMPlex's coupled with PetscFV and a TS to solve
> hyperbolic systems of equations. To add boundaries, I use the
> PetscDSAddBoundary as shown in some examples throughout the documentation.
> I do CFD, meaning I often have an object around which I want to simulate
> the flow. And I would like to know how some variables (pressure for
> instance) behave at the wall (literally _at_ the wall, and not only in the
> first fluid cell above the wall).
> After going through the documentation and the PETSc source code, I think
> the way to go is to use something like what ex23.c (of plex/tests) does :
> mark boundary faces that match the _wall_ boundary condition, create a
> submesh with them and somehow project the PetscFV/TS solution onto those
> facets based on the order of the spatial discretization (like if it's order
> 1 then just use the value in the first fluid cell above the boundary
> condition, if it's order 2 use the gradient and the value to get something
> at the facet, etc...).
> But I cannot figure out two things :
> 1/ how to mark the right boundary faces ? I tried using the
> DMPlexMarkBoundaryFaces with (what I thought was) the ID of the wall
> boundary condition (I mean, I DMView'd the DMPlex and I picked the right id
> in the Face Sets group), but then when I use the label thus created with
> DMPlexCreateSubmesh, it just returns ... nothing. The "submesh" is empty
> when I DMView it.

I need to understand the question better. It seems like you already have
the boundary marked. You just use that FaceSets label. If you want the
submesh, you really need
to mark vertices in addition to faces. To do this, you make a copy of the
label you want, and then call DMPlexLabelComplete() on it. Then you can use
it to create a submesh.

> 2/ how to project on the facets in a PetscFV paradigm ?

I believe that DMPlexProject() will work right now for order 1 projection.
For order 2 with FV, we will have to write some new code.



> Thank you very much in advance for any advice/pointers you could give me !
> Take care and have a good day,
> Thibault

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/20210422/32d53534/attachment.html>

More information about the petsc-users mailing list