Try to simulate a surface flow by solving an evolution equation. It works well when IC is constant volume, (so no BCs applied, or BCs=0), but if use a Periodic BC like below, the solution is shifted up in y direction. There got to be something wrong with the periodic BC, because there is no driving term in y direction in PDE, and it works well with no BC.
# Sub domain for Periodic boundary condition
class PeriodicBoundary(SubDomain):
# Left 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 right boundary (H) to left boundary (G)
def map(self, x, y):
y[0] = x[0]
y[1] = x[1]-8.0
# Create periodic boundary condition
pbc = PeriodicBoundary()
And using a rectangle domain
# Define function spaces
mesh = RectangleMesh(0,0,12,8,240,160)
V = FunctionSpace(mesh, "Lagrange", 1, constrained_domain=pbc)
ME = V*V
Please help check if there is anything wrong with the periodic BC. Thanks.