Centroids of a distributed triangulation

32 views
Skip to first unread message

vachanpo...@gmail.com

unread,
Nov 2, 2021, 5:16:30 AM11/2/21
to deal.II User Group
Dear all,

Is there a built-in function to calculate centroid of the area spanned by all the owned cells? I couldn't find any related function in GridTools. Using a bounding box will not work in all cases for my problem.

Thanking in anticipation
Vachan

Daniel Arndt

unread,
Nov 2, 2021, 9:52:36 AM11/2/21
to dea...@googlegroups.com
Vachan,

There is TriaAccessor::barycenter(https://www.dealii.org/current/doxygen/deal.II/classTriaAccessor.html#a56cc737f4b28f8d28a576d2e3d32ef9f) and TriaAccessor::measure(https://www.dealii.org/current/doxygen/deal.II/classTriaAccessor.html#a9cecb2b7c9a1644fb5fd44bbba40ab0c) for a single cell but I don't think such a function exists for the whole triangulation.
On the other hand, it should not be too difficult to implement that yourself if you use the former functions. You only need to integrate x over the whole domain and divide by the area of the whole domain which you can do by taking the sum of the barycenter of each cell mutlplied by its measure and divide by the sum of the measures. Alternatively, integrate x over the whale domain and divide by the integral of 1 over the whole domain.

Best,
Daniel

Best,
Daniel

--
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/9e76890d-412e-44f8-a3a7-70b55a566a29n%40googlegroups.com.

Wolfgang Bangerth

unread,
Nov 2, 2021, 11:30:36 AM11/2/21
to dea...@googlegroups.com
On 11/2/21 7:52 AM, Daniel Arndt wrote:
> On the other hand, it should not be too difficult to implement that
> yourself if you use the former functions. You only need to integrate x
> over the whole domain and divide by the area of the whole domain which
> you can do by taking the sum of the barycenter of each cell mutlplied by
> its measure and divide by the sum of the measures. Alternatively,
> integrate x over the whale domain and divide by the integral of 1 over
> the whole domain.

Yes, this would work. A better starting point would be
GridTools::volume() which computes an integral that, with minor
modifications of the integrand would also yield the barycenter and, with
another small modification, the barycenter of a subdomain.

Vachan: If you'd like to implement such a function, it would be great to
have that integrated into namespace GridTools!

Best
W.

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

vachanpo...@gmail.com

unread,
Nov 3, 2021, 2:03:04 AM11/3/21
to deal.II User Group
Thank you for the responses, Drs. Arndt and Bangerth. It greatly helps that a related function is available for a cell.

Vachan: If you'd like to implement such a function, it would be great to
have that integrated into namespace GridTools!
I am not entirely sure that these would be required, since I have now run into some other major issue related to solution transfer. I would inform here if I end up doing and using these barycenter calculations.
Reply all
Reply to author
Forward
0 new messages