Hi I learnt how to define subdomains with classes as shown in other topics
class S0(SubDomain):
\quad def inside(self, x, on_boundary):
\quad\quad return (near_line(0,x) and not(near_line(1,x)))
class S1(SubDomain):
\quad def inside(self, x, on_boundary):
\quad\quad return (near_line(1,x) and not(near_line(2,x)))
…
and
s0 = S0()
s1 = S1()
…
This method works, but the issue is I have like 10+ subdomains so I do not want to define 10+ classes as what people tend to do in their cases (e.g. 4 classes for 4 subdomains, which is not a lot).
I wonder if it is possible to define 1 class instead. I tried
class S(SubDomain):
\quad def init(self, n):
\quad\quad self.P1 = domain_vertices[n]
\quad\quad self.P2 = domain_vertices[(n+1)%12]
…
and
s0 = S(0)
s1 = S(1)
…
However this causes dead kernel and I am not sure why. I wonder if this method is possible or I have to define 10+ classes. Thanks!