How to find the vertex index and its coordinate by using locla or global dof index within one element

63 views
Skip to first unread message

yijun chen

unread,
Nov 17, 2024, 1:04:11 PM11/17/24
to deal.II User Group
Hello team,

may I know how to find the vertex index and its coordinate with the information of its local or global Dofs index within one element?

I have the local/global dofs index , I need to determine if this dof stays at the prescribed boundary.

Thanks in advance!
Best regards
Yijun Chen

Wolfgang Bangerth

unread,
Nov 18, 2024, 3:51:22 PM11/18/24
to dea...@googlegroups.com

On 11/17/24 08:56, yijun chen wrote:
>
> may I know how to find the vertex index and its coordinate with the
> information of its local or global Dofs index within one element?
>
> I have the local/global dofs index , I need to determine if this dof
> stays at the prescribed boundary.

Yijun:
a key issue is that, in general, not ever DoF is associated with a
vertex. For example, with Q2 elements, there are also nodes at mid-edge
and cell-center positions. And that even if each DoF is associated with
a vertex, it may not be the only DoF. For example, a Q_1^2 element (two
vector components) has two DoFs per vertex. As a consequence, there is
no single function in deal.II that provides the mapping you seek.

But, you can get it if you happen to have an element for which every DoF
is on a vertex. For example, DoFTools::map_dofs_to_support_points()
returns for each DoF its physical location. And if you happen know for
sure that you are using a Q1 element with just one vector component, on
every cell you can use
cell->vertex(i)
or
cell->vertex_index(i)
and know that that is the location and vertex index of the i'th DoF on
the current cell (where i=0...3 in 2d, and i=0...7 in 3d).

I hope this helps!
Best
W.

yijun chen

unread,
Nov 19, 2024, 2:18:02 AM11/19/24
to deal.II User Group
Hello Prof. Wolfgang,

Thank you very much for your response. They are very helpful.

Best regards,
Yijun Chen
Reply all
Reply to author
Forward
0 new messages