Boundary markers for moving mesh

Here is an example of what you would like to do:

from dolfin import *

mesh = UnitSquareMesh(10,10)

V = VectorFunctionSpace(mesh, "CG", 1)
x = SpatialCoordinate(mesh)
u = project(as_vector((0.05*sin(pi*x[1]), 0)), V)

class LeftOnBoundary(SubDomain):
    def inside(self, x, on_boundary):
        return x[0] < DOLFIN_EPS and on_boundary

mf = MeshFunction("size_t", mesh, 1, 0)
LeftOnBoundary().mark(mf, 1)
bc = DirichletBC(V, u, mf, 1)

u_boundary = Function(V)
bc.apply(u_boundary.vector())
print(u_boundary.vector().get_local())
ALE.move(mesh, u_boundary)

File("mesh.pvd") << mesh
1 Like