Suppose fes and mesh are defined.

I want to define a GridFuntion which has only values in a specfic materials.

I am expecting something like below.

A = GridFunction(fes)

A.Set(sin(x) (mesh.Materials(‘mat1’))

Or do I have to define a dictionary-based CofficientFuntion and multiply it to ?

I found mesh.MatrialCF and it seems to be this is what I have expected, however,

in the following script, the result is not dependent on “defalut value”.

```
from netgen.occ import *
from numpy import *
from ngsolve import *
wp = WorkPlane()
wp.MoveTo(0, 0).Circle(1)
geo = wp.Face()
geo.name = 'Circle'
geo.maxh = 0.02
wp = WorkPlane()
wp.MoveTo(0, 0).RectangleC(3,3)
geo = Glue([geo, wp.Face()])
mesh = Mesh(OCCGeometry(geo, dim=2).GenerateMesh(meshsize.very_fine)).Curve(3)
fes = Discontinuous(H1(mesh, order=4))
domain_value = { "Circle" : 1}
J = GridFunction(fes)
J.Set(sqrt(x**2+y**2)*mesh.MaterialCF(domain_value, default=0))
print(f'{Integrate(J*dx(mesh.Materials("Circle")), mesh):20.16f}::Discontinuous H1 integral')
J = GridFunction(fes)
J.Set(sqrt(x**2+y**2)*mesh.MaterialCF(domain_value, default=10))
print(f'{Integrate(J*dx(mesh.Materials("Circle")), mesh):20.16f}::Discontinuous H1 integral')
print(f"{2*pi/3:20.16f}::Analytical integral")
```

you use `dx(mesh.Materials('Circle'))`

, so you integrate only over circle, and the default value is never evaluated

Joachim