Hello,
I have carried out a linear elastic simulation in 2D and calculated the stresses. Now I want to average the stresses over the area according to this rule:
With:
A_i : Area of element i
Sigma_x,i : Stress xx at the middel of element i
A_total: total Area of the domain
I created the mesh in Gmsh, wrote an msh file, which I then imported with meshio to create an xdmf file. Here is the code:
with XDMFFile(MPI.COMM_WORLD, "/home/fenics/shared/my_mesh.xdmf", "r") as xdmf:
domain = xdmf.read_mesh(name="Grid")
ct = xdmf.read_meshtags(domain, name="Grid")
domain.topology.create_connectivity(domain.topology.dim, domain.topology.dim - 1)
with XDMFFile(MPI.COMM_WORLD, "/home/fenics/shared/my_mesh.xdmf", "r") as xdmf:
ft = xdmf.read_meshtags(domain, name="Grid")
As you can see the mesh is very irregular in shape and size of the elements:
I suspected that there was something like a cell index that could be used to directly access the area of the element and the global coordinates of the center point, but I couldn’t find anything.
I would be very grateful for any help