[petsc-users] DMPlex tetrahedra facets orientation
Isaac, Tobin G
tisaac at cc.gatech.edu
Mon Mar 8 09:21:33 CST 2021
Right that is what is needed from each side, but taking area and vn and scaling them back together is just undoing a computation that happens inside of cellgeometryfvm. I'm saying that long term, in the same way that for FEM we provide different callbacks that are intended for contraction with v and with grad v, we should have callbacks that separate scalar and vector fluxes so that unit vs scaled normal is a hidden quadrature detail.
Toby Isaac, Assistant Professor, GTCSE
________________________________
From: Matthew Knepley <knepley at gmail.com>
Sent: Monday, March 8, 2021, 10:11
To: Isaac, Tobin G
Cc: Nicolas Barral; PETSc
Subject: Re: [petsc-users] DMPlex tetrahedra facets orientation
On Mon, Mar 8, 2021 at 10:08 AM Isaac, Tobin G <tisaac at cc.gatech.edu<mailto:tisaac at cc.gatech.edu>> wrote:
What Nicolas wants is pretty common in DG, and the quantity is available as just the cross product of the two vectors of the facet Jacobian. Computing it the way you suggest is kind of a backward reconstruction.
I do not quite understand. The facet Jacobian will not know what the orientation with respect to the cell should be, and that is what he wants.
Thanks,
Matt
Toby Isaac, Assistant Professor, GTCSE
________________________________
From: petsc-users <petsc-users-bounces at mcs.anl.gov<mailto:petsc-users-bounces at mcs.anl.gov>> on behalf of Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>>
Sent: Monday, March 8, 2021, 09:56
To: Nicolas Barral
Cc: PETSc
Subject: Re: [petsc-users] DMPlex tetrahedra facets orientation
On Mon, Mar 8, 2021 at 4:02 AM Nicolas Barral <nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>> wrote:
On 07/03/2021 22:56, Matthew Knepley wrote:
> On Sun, Mar 7, 2021 at 4:51 PM Nicolas Barral
> <nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>> wrote:
>
>
> On 07/03/2021 22:30, Matthew Knepley wrote:
> > On Sun, Mar 7, 2021 at 4:13 PM Nicolas Barral
> > <nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>
> > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>>> wrote:
> >
> > On 07/03/2021 16:54, Matthew Knepley wrote:
> > > On Sun, Mar 7, 2021 at 8:52 AM Nicolas Barral
> > > <nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>
> > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>>
> > > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>
> > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>>>> wrote:
> > >
> > > Matt,
> > >
> > > Thanks for your answer.
> > >
> > > However, DMPlexComputeCellGeometryFVM does not compute
> what I
> > need
> > > (normals of height 1 entities). I can't find any
> function doing
> > > that, is
> > > there one ?
> > >
> > >
> > > The normal[] in DMPlexComputeCellGeometryFVM() is exactly what
> > you want.
> > > What does not look right to you?
> >
> >
> > So it turns out it's not what I want because I need
> non-normalized
> > normals. It doesn't seem like I can easily retrieve the norm,
> can I?
> >
> >
> > You just want area-weighted normals I think, which means that you
> just
> > multiply by the area,
> > which comes back in the same function.
> >
>
> Ah by the area times 2, of course, my bad.
> Do you order height-1 elements in a certain way ? I need to access the
> facet (resp. edge) opposite to a vertex in a tet (resp. triangle).
>
>
> Yes. Now that I have pretty much settled on it, I will put it in the
> manual. It is currently here:
>
> https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/plex/plexinterpolate.c#L56<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2Fpetsc%2Fpetsc%2F-%2Fblob%2Fmain%2Fsrc%2Fdm%2Fimpls%2Fplex%2Fplexinterpolate.c%23L56&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757879503%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DKiK1w8CS%2F1YPnskkaqsDqemXI8FWmlYsXfKDt3t7HU%3D&reserved=0>
>
> All normals are outward facing, but hopefully the ordering in the sourse
> file makes sense.
Thanks Matt, but I'm not sure I understand well. What I do so far is:
ierr = DMPlexGetCone(dm, c, &cone);CHKERRQ(ierr);
for (i=0; i<dim+1; ++i) {
f = cone[i];
ierr = DMPlexComputeCellGeometryFVM(dm, f, &area, NULL,
&vn[i*dim]);CHKERRQ(ierr);
if (dim == 3) { area *= 2; }
for (j=0; j<dim; ++j) { vn[i*dim+j] *= area; }
So in 3D, it seems that:
(vn[9],vn[10],vn[11]) is the inward normal to the facet opposing vertex0
(vn[6],vn[7],vn[8]) " " 1
(vn[3],vn[4],vn[5]) " " 2
(vn[0],vn[1],vn[2]) " " 3
in 2D:
(vn[2],vn[3]) is a normal to the edge opposing vertex 0
(vn[4],vn[5]) " " 1
(vn[0],vn[1]) " " 2
Yet in 2D, whether the normals are inward or outward does not seem
consistent across elements.
What am I wrongly assuming ?
Ah, I see the problem. I probably need another function. You can tell that not many people use Plex this way yet.
The logic for what you want is embedded my traversal, but it simple:
ierr = DMPlexGetConeSize(dm, c, &coneSize);CHKERRQ(ierr);
ierr = DMPlexGetCone(dm, c, &cone);CHKERRQ(ierr);
ierr = DMPlexGetConeOrientation(dm, c, &ornt);CHKERRQ(ierr);
for (i=0; i<coneSize; ++i) {
f = cone[i];
flip = ornt[i] >= 0 ? 1 : -1;
ierr = DMPlexComputeCellGeometryFVM(dm, f, &area, NULL, &vn[i*dim]);CHKERRQ(ierr);
if (dim == 3) { area *= 2; }
for (j=0; j<dim; ++j) { vn[i*dim+j] *= area * flip; }
I could make a function that returns all normals, properly oriented. It would just do this.
Thanks,
Matt
Thanks,
--
Nicolas
>
> Thanks,
>
> Matt
>
> Thanks
>
> --
> Nicolas
>
>
> > Thanks,
> >
> > Matt
> >
> > If not, I'll fallback to computing them by hand for now. Is the
> > following assumption safe or do I have to use
> DMPlexGetOrientedFace?
> > > if I call P0P1P2P3 a tet and note x the cross product,
> > > P3P2xP3P1 is the outward normal to face P1P2P3
> > > P0P2xP0P3 " P0P2P3
> > > P3P1xP3P0 " P0P1P3
> > > P0P1xP0P2 " P0P1P2
> >
> > Thanks
> >
> > --
> > Nicolas
> > >
> > > Thanks,
> > >
> > > Matt
> > >
> > > So far I've been doing it by hand, and after a lot of
> > experimenting the
> > > past weeks, it seems that if I call P0P1P2P3 a tetrahedron
> > and note x
> > > the cross product,
> > > P3P2xP3P1 is the outward normal to face P1P2P3
> > > P0P2xP0P3 " P0P2P3
> > > P3P1xP3P0 " P0P1P3
> > > P0P1xP0P2 " P0P1P2
> > > Have I been lucky but can't expect it to be true ?
> > >
> > > (Alternatively, there is a link between the normals
> and the
> > element
> > > Jacobian, but I don't know the formula and can find them)
> > >
> > >
> > > Thanks,
> > >
> > > --
> > > Nicolas
> > >
> > > On 08/02/2021 15:19, Matthew Knepley wrote:
> > > > On Mon, Feb 8, 2021 at 6:01 AM Nicolas Barral
> > > > <nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>
> > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>>
> > > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>
> > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>>>
> > > > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>
> > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>>
> > > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>
> > <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>
> <mailto:nicolas.barral at math.u-bordeaux.fr<mailto:nicolas.barral at math.u-bordeaux.fr>>>>>> wrote:
> > > >
> > > > Hi all,
> > > >
> > > > Can I make any assumption on the orientation of
> triangular
> > > facets in a
> > > > tetrahedral plex ? I need the inward facet
> normals. Do
> > I need
> > > to use
> > > > DMPlexGetOrientedFace or can I rely on either
> the tet
> > vertices
> > > > ordering,
> > > > or the faces ordering ? Could
> > DMPlexGetRawFaces_Internal be
> > > enough ?
> > > >
> > > >
> > > > You can do it by hand, but you have to account for
> the face
> > > orientation
> > > > relative to the cell. That is what
> > > > DMPlexGetOrientedFace() does. I think it would be
> easier
> > to use the
> > > > function below.
> > > >
> > > > Alternatively, is there a function that
> computes the
> > normals
> > > - without
> > > > bringing out the big guns ?
> > > >
> > > >
> > > > This will compute the normals
> > > >
> > > >
> > >
> >
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexComputeCellGeometryFVM.html<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.mcs.anl.gov%2Fpetsc%2Fpetsc-current%2Fdocs%2Fmanualpages%2FDMPLEX%2FDMPlexComputeCellGeometryFVM.html&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757889499%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4rVG%2Bm1CaS99h4rupjL9oHsk15xAg8Or%2BYClMPyCqBg%3D&reserved=0>
> > > > Should not be too heavy weight.
> > > >
> > > > THanks,
> > > >
> > > > Matt
> > > >
> > > > Thanks
> > > >
> > > > --
> > > > Nicolas
> > > >
> > > >
> > > >
> > > > --
> > > > 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/<https://nam12.safelinks.protection.outlook.com/?url=https:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757889499%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5878nejeDkupEZ1eD7piCcBIFxC%2FG6Qp%2FFa3vFIhC2c%3D&reserved=0>
> > > <http://www.cse.buffalo.edu/~knepley/<https://nam12.safelinks.protection.outlook.com/?url=http:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757899493%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=mROjnXpduNPj7pAmTFDncuWuqM2XyfTbAfSVtVogHao%3D&reserved=0>>
> > >
> > >
> > >
> > > --
> > > 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/<https://nam12.safelinks.protection.outlook.com/?url=https:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757899493%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4lQB0CcXHxiJiyeKHOVrLrlq1UEfETGdKgpGy9ET%2BNc%3D&reserved=0>
> > <http://www.cse.buffalo.edu/~knepley/<https://nam12.safelinks.protection.outlook.com/?url=http:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757909490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=u2ikuRDA2cpWRufgL3%2BR71WsMZTw6yhQ6mhSTK1Cr9c%3D&reserved=0>>
> >
> >
> >
> > --
> > 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/<https://nam12.safelinks.protection.outlook.com/?url=https:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757909490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=XnFyaUANJ2irZpE8wsciKyrrW3Kg4KCYY7e%2FJHdcJKg%3D&reserved=0>
> <http://www.cse.buffalo.edu/~knepley/<https://nam12.safelinks.protection.outlook.com/?url=http:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757919485%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=D9P%2FJfJHvCVO0OdAC2zS%2BpfEroNRn71D6ZaLuykcwzE%3D&reserved=0>>
>
>
>
> --
> 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/<https://nam12.safelinks.protection.outlook.com/?url=https:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757929476%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ney5wRVAAaP%2Bz6dTbPjoyJjy%2BCLJG2q1K4%2Bd62VG2dQ%3D&reserved=0> <http://www.cse.buffalo.edu/~knepley/<https://nam12.safelinks.protection.outlook.com/?url=http:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757929476%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=2tuCY%2BWGmUPq3rm1hEoi9VGqEXICotvj1sZ1URUgTm0%3D&reserved=0>>
--
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/<https://nam12.safelinks.protection.outlook.com/?url=http:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757939476%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=IH94mX1hggpYxZTiLRSiz8p0%2F1CPaLEfp485ZStn1WU%3D&reserved=0>
--
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/<https://nam12.safelinks.protection.outlook.com/?url=http:%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=04%7C01%7Ctisaac%40cc.gatech.edu%7C2ac1bf606bd3461e087a08d8e2446a6b%7C482198bbae7b4b258b7a6d7f32faa083%7C0%7C0%7C637508130757939476%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=IH94mX1hggpYxZTiLRSiz8p0%2F1CPaLEfp485ZStn1WU%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210308/ea728d42/attachment-0001.html>
More information about the petsc-users
mailing list