Integrate only on material

Hey, I have a function gfu and I want to integrate it on a domain which is a subset of my mesh

When creating my geometry I did

geo.SetMaterial(2,"rectangle")

and integrating on the mesh works fine

Integrate(gfu_old, mesh)

However, when I try to integrate on my rectangle, it doesn’t work

Integrate(gfu_old, definedon=mesh.Materials(“rectangle”))
Integrate(gfu_old, mesh.Materials(“rectangle”))
Integrate(gfu_old, “rectangle”)

I checked the help for integrate and mesh and google. Do I understand correct, that definedon is for my function spaces? Thanks for the answer, I assume it is an obvious one

Hi mischl,

the correct syntax should by

Integrate(gfu_old, mesh, definedon=mesh.Materials("rectangle"))

It needs the mesh and the region as two separate arguments.

Best
Michael

with the coming nightly version also the shorter form

Integrate(gfu_old, mesh.Materials("rectangle"))

is working,

Joachim

Ah, thanks! So I didn’t understand the help regarding this

that’s so cool Joachim, thanks alot