Hello, x=mesh.coordinates()
does not return a copy so any modification to x
is a modification of the coordinates of your mesh. Consider
from dolfin import *
import numpy as np
mesh = RectangleMesh(Point(-1, -1), Point(1, 1), 2, 10)
iface = FacetFunction('size_t', mesh, 0)
CompiledSubDomain('near(x[0], 0)').mark(iface, 1)
# Get unique indices of vertices on the interface
mesh.init(1, 0)
ivertex = list(set(sum((facet.entities(0).tolist()
for facet in SubsetIterator(iface, 1)), [])))
dx = np.linspace(0, 2, 10)
dx = 0.5*np.sin(2*pi*dx)
# Move
coordinates = mesh.coordinates()
for dxi in dx:
coordinates[ivertex, 0] = dxi
plot(mesh, interactive=True)