Circular Subdomain

Hello everyone!

I want to define a discontinuous function kappa which can be defined inside the subdomains of a circle.
My code is as follows:

def Omega_0(x):
return (x[0]*x[0] + x[1]*x[1] <= 0.6 * 0.6).all()

def Omega_1(x):
return (not x[0]*x[0] + x[1]*x[1] <= 0.6 * 0.6, x[0]*x[0] + x[1]*x[1] <= 0.8 * 0.8).all()

def Omega_2(x):
return (not x[0]*x[0] + x[1]*x[1] <= 0.8 * 0.8).all()

kappa = Function(Q)
cells_0 = cpp.mesh.locate_entities(domain, domain.topology.dim, Omega_0)
cells_1 = cpp.mesh.locate_entities(domain, domain.topology.dim, Omega_1)
cells_2 = cpp.mesh.locate_entities(domain, domain.topology.dim, Omega_2)
kappa.x.array[cells_0] = np.full_like(cells_0, 1, dtype=ScalarType)
kappa.x.array[cells_1] = np.full_like(cells_1, 1/50, dtype=ScalarType)
kappa.x.array[cells_2] = np.full_like(cells_2, 1, dtype=ScalarType)

But I am getting an error as

RuntimeError Traceback (most recent call last)
Input In [67], in <cell line: 2>()
1 kappa = Function(Q)
----> 2 cells_0 = cpp.mesh.locate_entities(domain, domain.topology.dim, Omega_0)
3 cells_1 = cpp.mesh.locate_entities(domain, domain.topology.dim, Omega_1)
4 cells_2 = cpp.mesh.locate_entities(domain, domain.topology.dim, Omega_2)

RuntimeError: Length of array of markers is wrong.

Kindly let me know what is wrong with this code.
Thank you in advance.

Please format your code using markdown syntax, i.e.

```python
def f(x):
    return x[0]
```

Additionally, make sure that you create a minimal working example that reproduces your error. With the current code, several core definitions are missing.

Finally, I’m not sure why you have added the .all() on

I think you want to remove those.