Extracting solution at a boundary in a DMPlex/PetscFV paradigm
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. 2/ how to project on the facets in a PetscFV paradigm ? Thank you very much in advance for any advice/pointers you could give me ! Take care and have a good day, Thibault
On Thu, Apr 22, 2021 at 8:31 AM Thibault Bridel-Bertomeu < [email protected]> 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. Thanks, Matt
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/>
Hi Matthew, Thank you for your answer. I indeed already have the boundary marked I believe through the call to PetscDSAddBoundary. I will try to add the vertices with DMPlexLabelComplete and see how it behaves, thanks ! I'll come back in a little while with a piece of code so it will become clearer hopefully. Cheers, Thibault Le jeu. 22 avr. 2021 à 14:42, Matthew Knepley <[email protected]> a écrit :
On Thu, Apr 22, 2021 at 8:31 AM Thibault Bridel-Bertomeu < [email protected]> 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.
Thanks,
Matt
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/>
participants (2)
-
Matthew Knepley -
Thibault Bridel-Bertomeu