<div dir="ltr"><div dir="ltr">On Mon, Apr 24, 2023 at 4:00 PM neil liu <<a href="mailto:liufield@gmail.com">liufield@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"></div>I try to find the source code, that transforms the scalar basis <1 x y> to <div><div> a vectors basis </div><div><br></div><div> / 1 \ / 0 \ / x \ / 0 \ / y \ / 0 \</div><div> \ 0 / \ 1 / \ 0 / \ x / \ 0 / \ y /</div><div><br></div><div>It seems it is processed by line 856</div><div><a href="https://gitlab.com/petsc/petsc/-/blob/main/include/petsc/private/petscimpl.h" target="_blank">https://gitlab.com/petsc/petsc/-/blob/main/include/petsc/private/petscimpl.h</a><br></div><div><br></div><div>Could you please direct me to the exact location where the source code has been defined to do the transformation? </div></div></div></blockquote><div><br></div><div>We do not represent those functions explicitly. The only action of a PetscSpace object is to evaluate the basis functions</div><div>at a set of points. For polynomial spaces, we do not use monomials, like 1, x, y, but Legendre polynomials. For multiple</div><div>components, we use the tensor product of the scalar basis, so we replicate evaluations in the right places. This code is</div><div>all in the PetscSpaceEvaluate() function:</div><div><br></div><div> <a href="https://petsc.org/main/manualpages/SPACE/PetscSpaceEvaluate/">https://petsc.org/main/manualpages/SPACE/PetscSpaceEvaluate/</a></div><div><br></div><div>You can see pointers to the implementations at the bottom of that page.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 21, 2023 at 12:37 PM neil liu <<a href="mailto:liufield@gmail.com" target="_blank">liufield@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks a lot. Very helpful.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 21, 2023 at 10:57 AM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Fri, Apr 21, 2023 at 10:36 AM neil liu <<a href="mailto:liufield@gmail.com" target="_blank">liufield@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>When you say "For multicomponent spaces, we currently do not represent it as a tensor product over the scalar space, so we see 6 basis vectors."</div><div>Here, muticomponent = two dimensional ? </div></div></blockquote><div><br></div><div>If you have a vector in a two-dimensional space, it has 2 components, like our coordinate vector.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I am a little confused about the dimensions of the basis functions here. From <a href="https://petsc.org/release//src/dm/dt/fe/impls/basic/febasic.c.html#PETSCFEBASIC" target="_blank">https://petsc.org/release//src/dm/dt/fe/impls/basic/febasic.c.html#PETSCFEBASIC</a></div><div><pre width="80" style="color:rgb(0,0,0)"><a name="m_-3662013382564539535_m_-1363811817823825940_m_-2552316977841895914_m_-2345740824204651528_m_-5516434620370843559_line144">144: </a> <font color="#B22222">/* B[npoints, nodes, Nc] = tmpB[npoints, prime, Nc] * invV[prime, nodes] */</font>
</pre><pre width="80"><font color="#b22222">How do you define tmpB here (npoints =3, prime =6, Nc =2)? I can get tmpB from </font></pre><pre width="80">PetscSpaceEvaluate_Polynomial, where, tmpB (1x9) is (the prime polynomial is defined by 1 x y))</pre><pre width="80">[ 1 -0.6667 -0.6667 1 -0.6667 0.3333 1 0.3333 -0.6666]. How do you transform from this 1x9 to 3x6x2 there. </pre></div></div></blockquote><div><br></div><div>npoints is the number of quadrature points at which to evaluate</div><div><br></div><div>nodes (pdim) is the number of functions in the space</div><div><br></div><div>Nc is the number of components for each function.</div><div><br></div><div>So a P1 basis for vectors looks like</div><div><br></div><div> / 1 \ / 0 \ / x \ / 0 \ / y \ / 0 \</div><div> \ 0 / \ 1 / \ 0 / \ x / \ 0 / \ y /</div><div><br></div><div>six vectors with 2 components each.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><pre width="80">Thanks, </pre><pre width="80">Xiaodong </pre></div><div><br></div><div><br></div><div><br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 21, 2023 at 10:05 AM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Fri, Apr 21, 2023 at 10:02 AM neil liu <<a href="mailto:liufield@gmail.com" target="_blank">liufield@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Hello, Petsc group,<br></div><div dir="ltr"><div><br></div><div>I am learning the FE structure in Petsc by running case </div><div><a href="https://petsc.org/main/src/snes/tutorials/ex12.c.html" target="_blank">https://petsc.org/main/src/snes/tutorials/ex12.c.html</a> with <span style="color:rgb(178,34,34)">-run_type test -bc_type dirichlet -dm_plex_interpolate 0 -petscspace_degree 1 -show_initial -dm_plex_print_fem 1</span></div></div></div></div></blockquote><div><br></div><div>-dm_plex_print_fem 5 will print much more</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div>When I check the subroutine<span style="color:rgb(178,34,34)"> </span>PetscFECreateTabulation_Basic, I can not understand some parameters there. </div><div><br></div><div>For the following lines in the file (<a href="https://petsc.org/release//src/dm/dt/fe/impls/basic/febasic.c.html#PETSCFEBASIC" target="_blank">https://petsc.org/release//src/dm/dt/fe/impls/basic/febasic.c.html#PETSCFEBASIC</a>)</div><div><pre width="80" style="color:rgb(0,0,0)"><a name="m_-3662013382564539535_m_-1363811817823825940_m_-2552316977841895914_m_-2345740824204651528_m_-5516434620370843559_m_3592559787075324266_m_2405164071719226631_m_-7005950170468391748_line135">135: </a> <a href="https://petsc.org/release//manualpages/Sys/PetscCall/" target="_blank">PetscCall</a>(<a href="https://petsc.org/release//manualpages/DUALSPACE/PetscDualSpaceGetDimension/" target="_blank">PetscDualSpaceGetDimension</a>(fem->dualSpace, &pdim));
<a name="m_-3662013382564539535_m_-1363811817823825940_m_-2552316977841895914_m_-2345740824204651528_m_-5516434620370843559_m_3592559787075324266_m_2405164071719226631_m_-7005950170468391748_line136">136: </a> <a href="https://petsc.org/release//manualpages/Sys/PetscCall/" target="_blank">PetscCall</a>(<a href="https://petsc.org/release//manualpages/FE/PetscFEGetNumComponents/" target="_blank">PetscFEGetNumComponents</a>(fem, &Nc));</pre><pre width="80" style="color:rgb(0,0,0)">Here, Nc = 2, pdim =6. I am running a scalar case with degree of 1, </pre><pre width="80" style="color:rgb(0,0,0)">I expect Nc = 1 and pdim =3. Could you please explain this? In addition,</pre></div></div></div></div></blockquote><div>Sure. I am guessing that you are looking at the tabulation for the coordinate space. Here you are in 2 dimensions, so the</div><div>coordinate space has Nc = 2. For multicomponent spaces, we currently do not represent it as a tensor product over the</div><div>scalar space, so we see 6 basis vectors.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div><pre width="80" style="color:rgb(0,0,0)">Thanks, </pre><pre width="80" style="color:rgb(0,0,0)">Xiaodong</pre><pre width="80" style="color:rgb(0,0,0)"><br></pre></div><div><span style="color:rgb(178,34,34)"><br></span></div></div>
</div></div>
</blockquote></div><br clear="all"><div><br></div><span>-- </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><br></div></div></div></div></div></div></div></div>
</blockquote></div></div>
</blockquote></div><br clear="all"><div><br></div><span>-- </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><br></div></div></div></div></div></div></div></div>
</blockquote></div>
</blockquote></div></div></div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><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><br></div></div></div></div></div></div></div></div>