Hello!
I have an expression such as:
class Pcmap(Expression):
def eval(self, value, x):
value[0] = 0
# Row 1
if x[0] > 0.339 and x[0] < 0.361 and x[1] > 0.019 and x[1] < 0.031:
value[0]=1
if x[0] > 0.339 and x[0] < 0.361 and x[1] > 0.069 and x[1] < 0.081:
value[0]=1
if x[0] > 0.039 and x[0] < 0.061 and x[1] > 0.019 and x[1] < 0.031:
value[0]=1
if x[0] > 0.039 and x[0] < 0.061 and x[1] > 0.069 and x[1] < 0.081:
value[0]=1
if x[0] > 0.139 and x[0] < 0.161 and x[1] > 0.019 and x[1] < 0.031:
value[0]=1
if x[0] > 0.139 and x[0] < 0.161 and x[1] > 0.069 and x[1] < 0.081:
value[0]=1
if x[0] > 0.239 and x[0] < 0.261 and x[1] > 0.019 and x[1] < 0.031:
value[0]=1
if x[0] > 0.239 and x[0] < 0.261 and x[1] > 0.069 and x[1] < 0.081:
value[0]=1
It sets values for a domain variable ("E") according to the space coordinates. For now, I define a subspace in the same region as the areas where "E" assumes value "1". So I've got:
class Mappcmrho(SubDomain):
def inside(self, x, on_boundary):
return (x[0] > 0.339 and x[0] < 0.361 and x[1] > 0.019 and x[1] < 0.031) or (x[0] > 0.339 and x[0] < 0.361 and x[1] > 0.069 and x[1] < 0.081) or (x[0] > 0.039 and x[0] < 0.061 and x[1] > 0.019 and x[1] < 0.031) or (x[0] > 0.039 and x[0] < 0.061 and x[1] > 0.069 and x[1] < 0.081) or (x[0] > 0.139 and x[0] < 0.161 and x[1] > 0.019 and x[1] < 0.031) or (x[0] > 0.139 and x[0] < 0.161 and x[1] > 0.069 and x[1] < 0.081) or (x[0] > 0.239 and x[0] < 0.261 and x[1] > 0.019 and x[1] < 0.031) or (x[0] > 0.239 and x[0] < 0.261 and x[1] > 0.069 and x[1] < 0.081)
However, the first map will not always be created from an expression like in the example and I need a subdomain where "E" have values equals to "1".
Is it possible to create a subdomain from the "E" values?
Att.
Diego