I would like to have a mesh representing an elastic material to be able to “slide” or slip freely along a boundary. Eg., in this example:
from dolfin import *
class AllBoundaries(SubDomain):
def inside(self, x, on_boundary):
return on_boundary and x[0] < -49
def solve_problem(mesh, mfunc, force=[]):
V = VectorFunctionSpace(mesh, "CG", 1)
u = TrialFunction(V)
v = TestFunction(V)
displacement = Function(V)
bc = [DirichletBC(V, Constant((0, 0)), mfunc, 1)]
F = Constant(force)
E = Constant(5000)
nu = Constant(0.3)
mu = E / (2.0 * (1 + nu))
lmbda = E * nu / ((1.0 + nu) * (1 - 2 * nu))
sigma = 2.0 * mu * sym(grad(u)) + lmbda * tr(sym(grad(u))) * Identity(2)
solve(inner(sigma, grad(v)) * dx == inner(F, v) * dx, displacement, bc)
displacement.set_allow_extrapolation(True)
return displacement
#################################################################################
mesh = RectangleMesh(Point(-50.0, -50.0), Point(50.0, 50), 20, 20)
mfunc = MeshFunction("size_t", mesh, 1, mesh.domains())
mfunc.set_all(0)
allb = AllBoundaries()
allb.mark(mfunc, 1)
F = [20, 10]
displacement = solve_problem(mesh, mfunc, F)
ALE.move(mesh, displacement)
### PLOT
import vedo
varrow = vedo.Arrow2D([0, 0], F).z(1).c("red4")
vmesh = vedo.Mesh([mesh.coordinates(), mesh.cells()]).c("k4").lc("k5")
vline = vedo.Line([(-50, -50), (-50, 50)]).c("red4").linewidth(5)
vedo.show(vmesh, vline, varrow, axes=1)
I would expect to see the mesh to “slide” a bit up the red boundary line.
How can I achieve that, if that’s possible at all?
Thanks!