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.

Computing integrals on a slice cutting through a domain.

More
4 years 6 months ago #1959 by anandes
Hello,

If I have a BVP defined on a 2D or 3D domain (ex.: a cube) is it possible in NGSolve to compute integrals on a given slice that cuts through the domain?

For example: in the attached toy problem, I have a function u(x,y) defined on a unit cube. How do I compute the integral of u(x,y) on a plane with z-normal, say at z=0.5?

Thank you,
Anand
More
4 years 6 months ago #1977 by mneunteufel
Hi anandes,

A similar question was asked here:
integration-over-a-cross-section
Maybe this helps.

Best,
Michael
More
4 years 5 months ago #1994 by anandes
Hi Michael,

Thanks for directing me to the relevant topic. I am currently unable to get ngsxfem working with my NGSolve installation on Ubuntu. But the other method seems to work. I have a couple of follow-up questions in this regard.

1. The boolean operation within the AddSurface functionality seems to work only on solid primitives. It throws an error if I use it on solids constructed from primitives (example: cube constructed from plane primitives; please see attached file). Is this expected?

2. Is there similar functionality for a mesh which is not associated with a geometry, for example, if I just have a mesh from another source such as Gmsh?

Thank you,
Anand
More
4 years 5 months ago #2004 by mneunteufel
Hi anandes,

can you please provide an example where the error occurs?
In your last post you did not attach one.

Best,
Michael
More
4 years 5 months ago #2010 by anandes
Hi Michael,

I thought I did, sorry about that! Please find the attachment below.

Thank you,
Anand

File Attachment:

File Name: integrate_on_slice.py
File Size:1 KB
More
4 years 5 months ago #2029 by mneunteufel
Hi Anand,

it works also for solids constructed from primitives. But you have to use it before adding it to the CSGeometry, see attached file.

To handle meshes without geometry I really would recommend xfem.
It is somehow possible to use your own integration rule, where you specify the according integration points, but the first option is easier, more robust and more flexible.

What error occurs when you try to get ngsxfem running?

Best,
Michael

File Attachment:

File Name: integrate_on_slice.py
File Size:1 KB
Time to create page: 0.137 seconds