FE_Q<dim>(p) with p>1: Global coordinates of midnodes

39 views
Skip to first unread message

Simon

unread,
Apr 19, 2021, 6:14:38 AM4/19/21
to deal.II User Group
Dear All,

I am implementing a local postprocessing SPR-Approach for a mechanical problem, in which I sloppy speaking need the global coordinates of all nodes.

I use Elements of type FE_Q<dim>(p).
For p=1 there is no problem: I can simply loop over all cells and vertices and use cell->vertex(...) in order to get the global coordinates of vertex(...).
Being p=2 for instance, this approach does not work anymore. In this case is there an easy way to figure out the coordinates of midnodes as well?

Thanks for help!

Best
Simon

Paras Kumar

unread,
Apr 19, 2021, 6:28:37 AM4/19/21
to dea...@googlegroups.com
Hi Simon,


Here's a code snippet for Option-1, which I usually use.

const auto &               feSystem       = dofHandler.get_fe();
dealii::MappingQ<dim, dim> cellMapping(feSystem.degree);
const auto & referenceCellSupportPoints = feSystem.get_unit_support_points();
std::vector<dealii::Point<dim>> realCellSupportPoints(referenceCellSupportPoints.size());
unsigned int supportPointCtr = 0;
for (const auto &supportPoint : referenceCellSupportPoints)
{
realCellSupportPoints[supportPointCtr] =
cellMapping.transform_unit_to_real_cell(cellIter, supportPoint);
++supportPointCtr;
}


Best regards,
Paras

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/3d87b2c4-61a4-4125-982d-f7341f44492an%40googlegroups.com.

Simon

unread,
Apr 19, 2021, 7:17:27 AM4/19/21
to deal.II User Group
Hi Paras,

everything worked fine, thanks a lot!

Best
Simon

Wolfgang Bangerth

unread,
Apr 19, 2021, 11:08:35 AM4/19/21
to dea...@googlegroups.com
On 4/19/21 4:14 AM, Simon wrote:
>
> I use Elements of type FE_Q<dim>(p).
> For p=1 there is no problem: I can simply loop over all cells and vertices and
> use cell->vertex(...) in order to get the global coordinates of vertex(...).
> Being p=2 for instance, this approach does not work anymore. In this case is
> there an easy way to figure out the coordinates of midnodes as well?

In addition to Paras' approach, you can also take a look at
DoFTools::map_dofs_to_support_points().

Best
W.

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

Reply all
Reply to author
Forward
0 new messages