I have a 2d gridfunction and I would like to integrate it over specific element faces and edges. I have the edges and faces as objects from mesh.faces and mesh.edges.
I am not sure how to proceed.
I have a 2d gridfunction and I would like to integrate it over specific element faces and edges. I have the edges and faces as objects from mesh.faces and mesh.edges.
I am not sure how to proceed.
Hi Alex,
if you have defined the regions as specific materials/boundaries you can integrate over them by e.g. Integrate(gfdx(“materialname”),mesh), Integrate(gfds(“boundaryname”),mesh).
Another possibility is to create an order zero L2 or FacetFESpace GridFunction and set the faces/edges of interest to 1. This GridFunction is then used as indicator function. E.g.
gfl = GridFunction(L2(mesh,order=0))
gfl.vec[…]=1
Integrate(gf*gfl, mesh)
Best,
Michael
Hi Michael,
The FacetFESpace sounds like it will work. Thank you!
Regards,
Alex