Hello everyone,
I want to use two different energies by changing E in my geometry (created on gmsh) by creating a subdomain, but the error I mentioned below appears. I would be glad if you help. Thank you in advance.
# Subdomain
class geometry(UserExpression): # g0 is the middle rectangular, g1 is the main geometry
def set_E_values(self, g_0, g_1):
self.g_0, self.g_1 = g_0, g_1
def eval(self, value, x):
tol = 1E-14
if 5.4 <= x[1] <= 7.8 + tol and 0.3 < x[0] < 0.7:
value[0] = self.g_0
else:
value[0] = self.g_1
# UserExpression.eval(self)
def value_shape(self):
# return (1,)
return ()
E = geometry(degree=0)
# E.interpolate(UserExpression())
E.set_E_values(0.1,10.0)
Traceback (most recent call last):
File “disp.py”, line 85, in
mu, lmbda = Constant(E / (2 * (1 + nu))), Constant(E * nu / ((1 + nu) * (1 - 2 * nu)))
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/function/constant.py”, line 68, in init
floats = list(map(float, array.flat))
TypeError: Division.float returned non-float (type NotImplementedType)