Boundary markers for moving mesh

Hi everyone,

suppose I have a rectangular 2d mesh created with gmsh. I marked the bottom boundary in gmsh with a 1. Can I use this marker to move only this boundary with ALE.move()?


This is what I have tried so far:

from dolfin import *
import matplotlib.pyplot as plt

mesh = UnitSquareMesh(8,8)

class Bottom(SubDomain):
   def inside(self, x, on_boundary):
       return near(x[0], 0) and on_boundary

sub_domain = MeshFunction("size_t", mesh, mesh.topology().dim()-1)
bottom = Bottom()
bottom.mark(sub_domain, 1)

boundary_mesh = BoundaryMesh(mesh, "exterior", True)
submesh_bottom = SubMesh(boundary_mesh, sub_domain, 1)


plotting the submesh_bottom gives weird results but I don’t know what I’m doing wrong.

There are many ways that this can be achieved. Please supply a minimal working coding example (use a built in mesh and a MeshFunction to emulator having boundary markers from file).

In this example, please make it clear if you will move the boundary based on geometrical information (a dolfin expression) or with information from a function.

Finally, I would just like to clarify, you want to only move the boundary of the mesh? If so, the movement has to be minimal for the mesh quality to be preserved.

Regarding your first statement:

  • I want to move the boundary as a result of the solution u at the marked boundary. For this, I want to write a function that is somehow evaluated at the boundary nodes and moves the mesh according to its solution (which I do not yet know how to do).

Regarding the second statement:

  • I think that I just want to move the boundary. I thought about using re-meshing but I’m just starting to get into this project

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)
ALE.move(mesh, u_boundary)

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

I think this is what I need. Thank you very much!

Edit: This is exactly what I needed!