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.

error when using Integrate

More
3 years 4 months ago #3413 by JSR
I'm trying to integrate a function over a subset of the domain, but I keep getting the following error
Code:
File "/usr/local/ngsxfem/lib/python3/dist-packages/xfem/__init__.py", line 304, in Integrate_X_special_args heapsize=heapsize) netgen.libngpy._meshing.NgException: lsets need to be GridFunctions!


The function is called using
Code:
stopcritval = sqrt(Integrate(levelset_domain=lset_haspos, cf=f, mesh=mesh))

where f is a GridFunction, and lset_haspos is defined by:
Code:
lsetp1 = GridFunction(H1(mesh,order=1)) InterpolateToP1(lset,lsetp1) lset_haspos = { "levelset" : lsetp1, "domain_type" : HASPOS, "subdivlvl" : 0}

As far as I can tell, all arguments are of the right type, so I have no idea why I'm being told that "lsets need to be GridFunctions". Does anyone know what I'm doing wrong?

thanks,

Julien
More
3 years 4 months ago #3414 by schruste
Replied by schruste on topic error when using Integrate
Dear Julien,

HASPOS is not a DOMAIN_TYPE (but a COMBINED_DOMAIN_TYPE). This leads to the fact that the dictionary lset_haspos does not fit the interface. If you want to integrate on the part where the level set function is positive, simply use "domain_type": POS.

I have to admit that the Exception is not really helpful and rather misleading. I will have a look at that.

Best,
Christoph
More
3 years 4 months ago #3415 by JSR
Replied by JSR on topic error when using Integrate
Hi Christoph,

Switching to POS did the trick.

thanks for the fast reply,

Julien
Time to create page: 0.175 seconds