[petsc-users] Fwd: Inquiry about the dual space (PetscFECreateTabulation_Basic)
Matthew Knepley
knepley at gmail.com
Mon Apr 24 19:12:06 CDT 2023
On Mon, Apr 24, 2023 at 4:00 PM neil liu <liufield at gmail.com> wrote:
> I try to find the source code, that transforms the scalar basis <1 x y> to
> a vectors basis
>
> / 1 \ / 0 \ / x \ / 0 \ / y \ / 0 \
> \ 0 / \ 1 / \ 0 / \ x / \ 0 / \ y /
>
> It seems it is processed by line 856
>
> https://gitlab.com/petsc/petsc/-/blob/main/include/petsc/private/petscimpl.h
>
> Could you please direct me to the exact location where the source code has
> been defined to do the transformation?
>
We do not represent those functions explicitly. The only action of a
PetscSpace object is to evaluate the basis functions
at a set of points. For polynomial spaces, we do not use monomials, like 1,
x, y, but Legendre polynomials. For multiple
components, we use the tensor product of the scalar basis, so we replicate
evaluations in the right places. This code is
all in the PetscSpaceEvaluate() function:
https://petsc.org/main/manualpages/SPACE/PetscSpaceEvaluate/
You can see pointers to the implementations at the bottom of that page.
Thanks,
Matt
> On Fri, Apr 21, 2023 at 12:37 PM neil liu <liufield at gmail.com> wrote:
>
>> Thanks a lot. Very helpful.
>>
>> On Fri, Apr 21, 2023 at 10:57 AM Matthew Knepley <knepley at gmail.com>
>> wrote:
>>
>>> On Fri, Apr 21, 2023 at 10:36 AM neil liu <liufield at gmail.com> wrote:
>>>
>>>> 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."
>>>> Here, muticomponent = two dimensional ?
>>>>
>>>
>>> If you have a vector in a two-dimensional space, it has 2 components,
>>> like our coordinate vector.
>>>
>>>
>>>> I am a little confused about the dimensions of the basis functions
>>>> here. From
>>>> https://petsc.org/release//src/dm/dt/fe/impls/basic/febasic.c.html#PETSCFEBASIC
>>>>
>>>> 144: /* B[npoints, nodes, Nc] = tmpB[npoints, prime, Nc] * invV[prime, nodes] */
>>>>
>>>> How do you define tmpB here (npoints =3, prime =6, Nc =2)? I can get tmpB from
>>>>
>>>> PetscSpaceEvaluate_Polynomial, where, tmpB (1x9) is (the prime polynomial is defined by 1 x y))
>>>>
>>>> [ 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.
>>>>
>>>>
>>> npoints is the number of quadrature points at which to evaluate
>>>
>>> nodes (pdim) is the number of functions in the space
>>>
>>> Nc is the number of components for each function.
>>>
>>> So a P1 basis for vectors looks like
>>>
>>> / 1 \ / 0 \ / x \ / 0 \ / y \ / 0 \
>>> \ 0 / \ 1 / \ 0 / \ x / \ 0 / \ y /
>>>
>>> six vectors with 2 components each.
>>>
>>> Thanks,
>>>
>>> Matt
>>>
>>>> Thanks,
>>>>
>>>> Xiaodong
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Apr 21, 2023 at 10:05 AM Matthew Knepley <knepley at gmail.com>
>>>> wrote:
>>>>
>>>>> On Fri, Apr 21, 2023 at 10:02 AM neil liu <liufield at gmail.com> wrote:
>>>>>
>>>>>> Hello, Petsc group,
>>>>>>
>>>>>> I am learning the FE structure in Petsc by running case
>>>>>> https://petsc.org/main/src/snes/tutorials/ex12.c.html with -run_type
>>>>>> test -bc_type dirichlet -dm_plex_interpolate 0 -petscspace_degree 1
>>>>>> -show_initial -dm_plex_print_fem 1
>>>>>>
>>>>>
>>>>> -dm_plex_print_fem 5 will print much more
>>>>>
>>>>>
>>>>>> When I check the subroutine PetscFECreateTabulation_Basic, I can not
>>>>>> understand some parameters there.
>>>>>>
>>>>>> For the following lines in the file (
>>>>>> https://petsc.org/release//src/dm/dt/fe/impls/basic/febasic.c.html#PETSCFEBASIC
>>>>>> )
>>>>>>
>>>>>> 135: PetscCall <https://petsc.org/release//manualpages/Sys/PetscCall/>(PetscDualSpaceGetDimension <https://petsc.org/release//manualpages/DUALSPACE/PetscDualSpaceGetDimension/>(fem->dualSpace, &pdim));136: PetscCall <https://petsc.org/release//manualpages/Sys/PetscCall/>(PetscFEGetNumComponents <https://petsc.org/release//manualpages/FE/PetscFEGetNumComponents/>(fem, &Nc));
>>>>>>
>>>>>> Here, Nc = 2, pdim =6. I am running a scalar case with degree of 1,
>>>>>>
>>>>>> I expect Nc = 1 and pdim =3. Could you please explain this? In addition,
>>>>>>
>>>>>> Sure. I am guessing that you are looking at the tabulation for the
>>>>> coordinate space. Here you are in 2 dimensions, so the
>>>>> coordinate space has Nc = 2. For multicomponent spaces, we currently
>>>>> do not represent it as a tensor product over the
>>>>> scalar space, so we see 6 basis vectors.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Matt
>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Xiaodong
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> 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/>
>>>>>
>>>>
>>>
>>> --
>>> 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/>
>>>
>>
--
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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230424/b878af4d/attachment-0001.html>
More information about the petsc-users
mailing list