<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div style="line-break:after-white-space"><br>
<div><br>
<blockquote type="cite">
<div>On Nov 9, 2022, at 10:04 AM, Matthew Knepley <knepley@gmail.com> wrote:</div>
<br class="x_Apple-interchange-newline">
<div>
<div dir="ltr" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div dir="ltr">On Tue, Nov 8, 2022 at 9:14 PM Blaise Bourdin <<a href="mailto:bourdin@mcmaster.ca" target="_blank">bourdin@mcmaster.ca</a>> wrote:<br>
</div>
<div class="x_gmail_quote">
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
Hi,<br>
<br>
What reference simplex is DMPlexComputeCellGeometryAffineFEM using in 2 and 3D?<br>
I am used to computing my shape functions on the unit simplex (vertices at the origin and each e_i), but it does not look to be the reference simplex in this function:<br>
<br>
In 3D, for the unit simplex with vertices at (0,0,0) (1,0,0) (0,1,0) (0,0,1) (in this order), I get J = 1 / 2 . [[-1,-1,-1],[1,0,0],[0,0,1]] and v0 = [0,0,1]<br>
<br>
In 2D, for the unit simplex with vertices at (0,0), (1,0), and (0,1), I get J = 1 / 2. I and v0 = [0,0], which does not make any sense to me (I was assuming that the 2D reference simplex had vertices at (-1,-1), (1, -1) and (-1,1), but if this were the case,
 v0 would not be 0).<br>
<br>
I can build a simple example with meshes consisting only of the unit simplex in 2D and 3D if that would help.<br>
</blockquote>
<div><br>
</div>
<div>I need to rewrite the documentation on geometry, but I was waiting until I rewrite the geometry calculations to fit into libCEED. Toby found a nice</div>
<div>way to express them in BLAS form which I need to push through everything.</div>
<div><br>
</div>
<div>I always think of operating on the cell with the first vertex at the origin (I think it is easier), so I have a xi0 that translates the first vertex</div>
<div>of the reference to the origin, and a v0 that translates the first vertex of the real cell to the origin. You can see this here</div>
<div><br>
</div>
<div>  <a href="https://gitlab.com/petsc/petsc/-/blob/main/include/petsc/private/petscfeimpl.h#L251">https://gitlab.com/petsc/petsc/-/blob/main/include/petsc/private/petscfeimpl.h#L251</a></div>
<div><br>
</div>
<div>This explains the 2D result. I cannot understand your 3D result, unless the vertices are in another order.</div>
</div>
</div>
</div>
</blockquote>
<div><br>
</div>
That makes two of us, then… I am attaching a small example and test meshes (one cell being the unit simplex starting with the origin and numbered in direct order when looking from (1,1,1)</div>
<div>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> filename ../TestMeshes/1Tri.gen</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">Vec Object: coordinates 1 MPI process</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">  type: seq</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">1.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">1.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">v0</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:   0.0000e+00   0.0000e+00</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">J</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:   5.0000e-01   0.0000e+00</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:   0.0000e+00   5.0000e-01</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">invJ</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:   2.0000e+00  -0.0000e+00</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:  -0.0000e+00   2.0000e+00</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">detJ : 0.25</span></p>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">And </span></div>
<div><span style="font-variant-ligatures:no-common-ligatures">
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> filename ../TestMeshes/1Tet.gen</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">Vec Object: coordinates 1 MPI process</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">  type: seq</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">1.</span></p>
<p style="margin:0px; font-stretch:normal; line-height:normal"><span style="font-family:"Fira Code"; font-size:11px; font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; line-height:normal"></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">1.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">0.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">1.</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">v0</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:   1.0000e+00   0.0000e+00   0.0000e+00</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">J</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:  -5.0000e-01  -5.0000e-01  -5.0000e-01</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:   5.0000e-01   0.0000e+00   0.0000e+00</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:   0.0000e+00   0.0000e+00   5.0000e-01</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">invJ</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:   0.0000e+00   2.0000e+00   0.0000e+00</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:  -2.0000e+00  -2.0000e+00  -2.0000e+00</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures"> 0:   0.0000e+00   0.0000e+00   2.0000e+00</span></p>
<p style="margin:0px; font-stretch:normal; font-size:11px; line-height:normal; font-family:"Fira Code"">
<span style="font-variant-ligatures:no-common-ligatures">detJ : 0.125</span></p>
<div><span style="font-variant-ligatures:no-common-ligatures"><br>
</span></div>
</span></div>
</div>
<div>I don’t understand why v0=(0,0) in 2D and (1,0,0) in 3D (but don’t really care) since I only want J. J makes no sense to me in 3D. In particular, one does not seem to have X~ = invJ.X + v0 (X = J.(X~-v0) as stated in CoordinatesRefToReal (it works in 2D
 if V0 = (1,1), which is consistent with a reference simplex with vertices at (-1,-1), (1,-1) and (-1,1)).</div>
<div><br>
</div>
<div>What am I missing?</div>
<div><br>
</div>
<div>Blaise</div>
<div><br>
</div>
<div><font face="Fira Code"><span style="font-size:11px"></span></font></div>
</div>
<div style="line-break:after-white-space">
<div class="x_AppleOriginalContents"><font face="Fira Code"><span style="font-size:11px">/</span></font></div>
</div>
<div style="line-break:after-white-space">
<div class="x_AppleOriginalContents"><br>
<font face="Fira Code"><span style="font-size:11px"></span></font></div>
</div>
<div style="line-break:after-white-space">
<div><font face="Fira Code"><span style="font-size:11px"></span></font></div>
<div><br>
<blockquote type="cite">
<div>
<div dir="ltr" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div class="x_gmail_quote">
<div><br>
</div>
<div>  Thanks,</div>
<div><br>
</div>
<div>      Matt</div>
<div> </div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left-width:1px; border-left-style:solid; border-left-color:rgb(204,204,204); padding-left:1ex">
Regards,<br>
Blaise<br>
<br>
<br>
<br>
—<span class="x_Apple-converted-space"> </span><br>
Canada Research Chair in Mathematical and Computational Aspects of Solid Mechanics (Tier 1)<br>
Professor, Department of Mathematics & Statistics<br>
Hamilton Hall room 409A, McMaster University<br>
1280 Main Street West, Hamilton, Ontario L8S 4K1, Canada<span class="x_Apple-converted-space"> </span><br>
<a href="https://www.math.mcmaster.ca/bourdin" rel="noreferrer" target="_blank">https://www.math.mcmaster.ca/bourdin</a><span class="x_Apple-converted-space"> </span>| +1 (905) 525 9140 ext. 27243<br>
<br>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
--<span class="x_Apple-converted-space"> </span><br>
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener</div>
<div><br>
</div>
<div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<div>
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; word-wrap:break-word; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div dir="auto" style="color:rgb(0,0,0); letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; line-break:after-white-space">
<div>— <br>
Canada Research Chair in Mathematical and Computational Aspects of Solid Mechanics (Tier 1)</div>
<div>Professor, Department of Mathematics & Statistics<br>
Hamilton Hall room 409A, McMaster University<br>
1280 Main Street West, Hamilton, Ontario L8S 4K1, Canada <br>
https://www.math.mcmaster.ca/bourdin | +1 (905) 525 9140 ext. 27243</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</div>
</body>
</html>