Integration over a cross section

Dear All,

I need your help. My sample is a 3D cuboid. I want to take a 2D integration over a cross section parallel to the x-y plane and cuts the z-axis at z = z0. I only know Integrate(function, mesh) for an integration over the whole sample.
How can I do the cross section integration with NGSolve?

Any help is much appreciated.

Best regards,
Vu

Dear vuong,

If the plane z=z0 is part of the mesh as a boundary you can integrate on the boundary using a proper region flag: defined=mesh.Boundaries("myplane").
Otherwise there is no core functionality in NGSolve. However, you can use ngs-xfem, which is a small add-on module for things like that ( see ngsxfemhttps://github.com/ngsxfem/ngsxfem ). There you have to provide a level set function where the zero level corresponds to your plane, i.e. this would look like

Integrate(levelset_domain = { "levelset" : z, "domain_type" : IF }, cf = your_integrand).

Best,
Christoph

Dear Schruste,

Thank you very much for the information.

Best,
Vu

Hi Vu,

now we have also another possibility for this purpose:

You define a second, independent (surface) mesh for the integration, e.g. your cut surface.

You can integrate the solution GridFunction from the original mesh over the second mesh, using interpolation in the integration points.

The attached example gives this result:
integral = 0.0249999999999999

You need the coming nightly release for this to work.

Best, Joachim

Attachment: integrate_plane.py