Hi,
I want to solve an eigenvalue problem in linear elasticity which contains periodic boundary condition and complex weak formulation. I defined a mixed function space to handle the complex problem. My code is like this:
a=5.e-2; #cube size
# Sub domain for Periodic boundary condition
class PeriodicBoundary(SubDomain):
# Left boundary is "target domain" G
def inside(self, x, on_boundary):
# return True if on left or bottom boundary AND NOT on one of the two slave edges
return bool(( near(x[0], -a/2.) or near(x[1], -a/2.) or near(x[2], -a/2.)) and
(not ((near(x[0], a/2.) and near(x[2], -a/2.)) or
(near(x[0], -a/2.) and near(x[2], a/2.)) or
(near(x[1], a/2.) and near(x[2], -a/2.))or
(near(x[1], -a/2.) and near(x[2], a/2.)))) and on_boundary)
# Map right boundary (H) to left boundary (G)
def map(self, x, y):
if near(x[0], a/2.) and near(x[2], a/2.):
y[0] = x[0] - a/2
y[1] = x[1]
y[2] = x[2] - a/2
elif near(x[1], a/2.) and near(x[2], a/2.):
y[0] = x[0]
y[1] = x[1] - a/2
y[2] = x[2] - a/2
elif near(x[0], a/2):
y[0] = x[0] - a/2
y[1] = x[1]
y[2] = x[2]
elif near(x[1], a/2):
y[0] = x[0]
y[1] = x[1] - a/2
y[2] = x[2]
elif near(x[2], a/2):
y[0] = x[0]
y[1] = x[1]
y[2] = x[2] - a/2
mesh = BoxMesh(-a/2, -a/2, -a/2, a/2, a/2, a/2,36,36,36)
V = VectorFunctionSpace(mesh, "CG", 1, constrained_domain=PeriodicBoundary())
Vcomplex = V*V
uR, uI = TrialFunctions(Vcomplex)
wR, wI = TestFunctions(Vcomplex)
when I run the code, it gives the following error:
File "Alessandro.py", line 61, in <module>
Vcomplex = V*V
File "/share/apps/fenics/lib/python2.7/site-packages/dolfin/functions/functionspace.py", line 126, in __mul__
return MixedFunctionSpace((self, other))
File "/share/apps/fenics/lib/python2.7/site-packages/dolfin/functions/functionspace.py", line 505, in __init__
FunctionSpaceBase.__init__(self, spaces[0].mesh(), element, constrained_domain=spaces[0].dofmap().constrained_domain)
File "/share/apps/fenics/lib/python2.7/site-packages/dolfin/functions/functionspace.py", line 93, in __init__
dolfin_dofmap = cpp.DofMap(ufc_dofmap, mesh, constrained_domain)
File "/share/apps/fenics/lib/python2.7/site-packages/dolfin/cpp/fem.py", line 654, in __init__
_fem.DofMap_swiginit(self,_fem.new_DofMap(*args))
AttributeError: 'MixedFunctionSpace' object has no attribute 'inside'
So due to :AttributeError: 'MixedFunctionSpace' object has no attribute 'inside'
How should I define the periodic boundary condition for the mixed function space?
Thanks