Dear all,
I was trying to implement periodic boundary conditions on both the sides of a UnitSquareMesh. This is my code:
# Sub domain for Periodic boundary condition
class PeriodicBoundaryLR(SubDomain):
# Left boundary is "target domain" G
def inside(self, x, on_boundary):
return bool(x[0] < DOLFIN_EPS and x[0] > -DOLFIN_EPS and on_boundary)
# Map right boundary (H) to left boundary (G)
def map(self, x, y):
y[0] = x[0] - 1.0
y[1] = x[1]
# Sub domain for Periodic boundary condition
class PeriodicBoundaryBT(SubDomain):
# Bottom boundary is "target domain" G
def inside(self, x, on_boundary):
return bool(x[1] < DOLFIN_EPS and x[1] > -DOLFIN_EPS and on_boundary)
# Map bottom boundary (H) to top boundary (G)
def map(self, x, y):
y[0] = x[0]
y[1] = x[1] - 1.0
As you see, I replicated the demo of the Poisson problem. However, I have the following error:
*** Error: Unable to create function space.
*** Reason: Illegal argument, not a subdomain: [<__main__.PeriodicBoundaryLR; proxy of ...
Any advice would be really appreciated :)
Thanks,
Pietro