Hi,

I am using dolfinx 0.7.2.

How can I compute the centroids of the mesh elements? I am aware that this dolfinx version doesn’t support ufl.cell_avg. How can I compute the cell averages of a scalar field? How can I do the same thing for a vector field?

Thanks for any help,
Jorge

dokken
February 16, 2024, 6:28pm
2
Interpolate into DG-0, whose dof is at the center of the cell.

1 Like

Thanks @dokken ! Additionally, how do I get a numpy array of the coordinates of the centroid?

dokken
February 16, 2024, 9:56pm
4
Tabulate the dof coordinates of the DG-0 space.

Bas
April 5, 2024, 10:24am
5
If I have a mesh with a lot of regions, how can I get the centroids of the regions separately?

dokken
April 5, 2024, 5:45pm
6

Bas
April 8, 2024, 8:52pm
7
Thank you. how can I store the vertices of reach regions separately?

dokken
April 9, 2024, 7:17am
8
Use `dolfinx.mesh.entities_to_geometry`

and `mesh.geometry.x`

of the output of entities to geometry to get the vertex coordinates of each entity