Adding two finite element fields of unequal order

22 views
Skip to first unread message

Corbin Foucart

unread,
Oct 16, 2022, 6:45:30 PM10/16/22
to deal.II User Group
Hello everyone,
  • I'm looking to add a finite element solution of one polynomial order to another (say, adding a p=2 field to a p=3 field, without loss of generality)
  • I can do this by hand the usual way
    • declare a nodal quadrature rule (at p=3)
    • iterate over the active cells in DoFHandler, using FEValues::get_function_values to add the results appropriately, either manually or with MeshWorker
  • However, I suspect that deal.ii must have a more idiomatic way of doing so, since this must be a common operation
Is there a library function to do operations like this? Any guidance would be appreciated.

Thank you,
Corbin

Wolfgang Bangerth

unread,
Oct 17, 2022, 12:20:57 AM10/17/22
to dea...@googlegroups.com
On 10/16/22 16:45, Corbin Foucart wrote:
> * I'm looking to add a finite element solution of one polynomial order to
> another (say, adding a p=2 field to a p=3 field, without loss of generality)
> * I can do this by hand the usual way
> o declare a nodal quadrature rule (at p=3)
> o iterate over the active cells in DoFHandler, using
> FEValues::get_function_values to add the results appropriately, either
> manually or with MeshWorker
> * However, I suspect that deal.ii must have a more idiomatic way of doing
> so, since this must be a common operation
>
> Is there a library function to do operations like this? Any guidance would be
> appreciated.

There may be a function in VectorTools that interpolates from one finite
element space (=DoFHandler) to another, I don't recall.

But if there isn't: You can do this on a single cell. All you need is the
interpolation matrix for the two finite element spaces on a single cell. Take
a look at FiniteElement::get_interpolation_matrix(). Then all you have to do is do
cell_1->get_dof_values()
for the original FE field, multiply it by that matrix to get the corresponding
values with regard to the other FE field, and then call
cell_2->set_dof_values()

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages