Set value in different subdomains
My mesh consists of two different subdomains. I need a function k that is constant in each subdomain,
but contains different values for each subdomain. I did it as discribed in the manual:
mesh = Rectangle(
mesh.order()
class Channel(SubDomain):
def inside(
return True if x[1] > 0.5 else False
class Membrane(
def inside(
return True if x[1] <= 0.5 else False
subdomains = MeshFunction(
sub_channel = Channel()
sub_channel.
sub_membrane = Membrane()
sub_membrane.
V0 = FunctionSpace(mesh, "DG", 0)
k = Function(V0)
k_values = [1.5, 5] # values of k in the two subdomains
for cell_no in range(len(
subdomain_no = subdomains.
k.vector(
But using this syntax, I get the following error:
for cell_no in range(len(
AttributeError: 'MeshFunctionUInt' object has no attribute 'values'
Please can anybody help me how I can define the k-Function on different
subdomains. I'm using the Fenics-Version 1:1.0-beta2-2 for ubuntu.
Thanks a lot in advance!
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Praveen C
- Solved:
- Last query:
- Last reply: