Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Integrating over specific faces and edges

More
2 years 1 month ago - 2 years 1 month 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 1 month ago by alex.v.
More
2 years 1 month ago - 2 years 1 month 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 1 month ago by mneunteufel.
More
2 years 1 month ago #4270 by alex.v
Hi Michael,

The FacetFESpace sounds like it will work. Thank you!

Regards,
Alex
Time to create page: 0.117 seconds