Hello
I am trying to define a SubDomain with some variables. So I tried to write a constructor
class OutFlow(SubDomain):
def __init__(self,y1,y2):
self.y1 = y1
self.y2 = y2
def inside(self, x, on_boundary):
return (near(x[0],0.0) and
between(x[1], (self.y1, self.y2)) and
on_boundary)
I tried to use it like this
mesh = UnitSquareMesh(n,n)
# Create mesh functions over the cell facets
sub_domains = FacetFunction("size_t", mesh)
# Mark all facets as sub domain 4, includes interior edges
sub_domains.set_all(4)
# Mark outflow
outflow = OutFlow(0.1, 0.4)
outflow.mark(sub_domains, 1)
but this gives an error
Traceback (most recent call last):
File "grid.py", line 60, in <module>
outflow.mark(sub_domains, 1)
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin/cpp/mesh.py", line 4426, in mark
self._mark(*args)
TypeError: in method 'SubDomain__mark', argument 1 of type 'dolfin::SubDomain const *'