Hi, I’m trying to implement periodic boundary conditions on a 2D square mesh. I implement the example in the doc, like this:
# Sub domain for Periodic boundary condition
class PeriodicBoundary(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]
But, I need to multiply a boundary by a constant (m):
w(0,y) = -m*(w(1,y))
I’m trying the next code, but m multiplies the coordinate but not the value of the node:
# Sub domain for Periodic boundary condition
class PeriodicBoundary(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] = -m*(x[0] - 1.0)
y[1] = x[1]
How do I apply the periodic boundary conditions multiplied by a constant?
Thank you.