[petsc-users] Read and use boundaries from exodus in finite element context
Matthew Knepley
knepley at gmail.com
Tue Mar 1 10:09:03 CST 2016
On Tue, Mar 1, 2016 at 9:58 AM, Max Rietmann <max.rietmann at gmail.com> wrote:
> Dear all,
>
> We are building out a new finite-element code for wave propagation and I
> am currently implementing the boundary conditions. My first pass will
> simply have dirichlet boundaries, but eventually we will have more
> sophisticated options available.
>
Is this going to be a purely explicit code?
> I am creating an exodus mesh in Trelis/Cubit, in which I can create one
> (or more) "side sets", which are properly read by the exodus reader. From
> reading the petsc source (plexexodusii.c), it seems that these basically
> create a list of faces, which belong to the side set.
>
Yes.
> A call to DMPlexGetLabelValue(dm,"Face Set",face_id,&value), allows me to
> see if "face_id" is on the boundary by checking value (>=1 for boundary, or
> -1 for not in set). Additional side sets get ids = {2,3,etc}. This allows
> us to have multiple types of boundary (absorbing, reflecting, etc).
>
Yes. Note that you can also extract them all at once into a sorted array.
> However, I am unsure how to determine if an element has a particular
> face_id in order to determine if one face of the element is on a boundary
> (and which value it has {-1,1,2,3, etc}).
>
Here you can see me doing the thing you are asking for:
https://bitbucket.org/petsc/petsc/src/2d7a10a4145949cccd1c2cb7dc0d518dc12666a9/src/dm/impls/plex/plexsubmesh.c?at=master&fileviewer=file-view-default#plexsubmesh.c-106
The code is slightly overkill for what you want since it also works for
vertices. You could call
DMPlexGetSupport()
on the face rather than
DMPlexGetTransitiveClosure()
and the code would be simpler.
> The routine is listed here:
>
> PetscErrorCode DMPlexGetLabelValue(DM dm, const char name[], PetscInt
> point, PetscInt *value)
>
> How do I determine the "point" of a face, if I'm iterating through my
> elements.
>
> thanks!
>
> Max Rietmann
>
> PS I've also seen the DMPlexAddBoundary method, but I wasn't sure how to
> use it in our setting.
>
This is used to hook into the DMPlexSetBoundaryValues() interface so that
BC values are properly loaded into
local vectors before assembly operations.
Thanks,
Matt
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160301/95ca2de7/attachment.html>
More information about the petsc-users
mailing list