Integrating over specific faces and edges

More
2 years 9 months ago - 2 years 9 months ago #4237 by alex.v
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.
Last edit: 2 years 9 months ago by alex.v.
More
2 years 9 months ago - 2 years 9 months ago #4267 by mneunteufel
Hi Alex, 

if you have defined the regions as specific materials/boundaries you can integrate over them by e.g. Integrate(gf*dx(“materialname”),mesh), Integrate(gf*ds(“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
Last edit: 2 years 9 months ago by mneunteufel.
More
2 years 9 months ago #4270 by alex.v
Hi Michael,

The FacetFESpace sounds like it will work. Thank you!

Regards,
Alex
Time to create page: 0.096 seconds