Moving a SubMesh and saving to xdmf

Hi,

related to the old discussion in
[https://fenicsproject.org/qa/10397/how-can-i-visualize-a-mesh-in-pieces-in-paraview/]

when I try to move a SubMesh (using v. 2017.2.0) I get the error

‘SubMesh’ object has no attribute ‘move’

Here is a minimal code, taken from the link above

from dolfin import *

mesh = RectangleMesh(Point(0,0), Point(1,2), 1,2)

sd = CompiledSubDomain("x[1] <= 1.0")
mf = MeshFunction("size_t", mesh, 2)
mf.set_all(0)
sd.mark(mf, 1)

top = SubMesh(mesh, mf, 0)
bottom = SubMesh(mesh, mf, 1)
down = Expression(["0.0", "-1.0"], degree=1)

submesh.move(down)
bottomfile = XDMFFile("bottom.xdmf")
topfile = XDMFFile("top.xdmf")

bottomfile.write(bottom)
topfile.write(top)

Is there an equivalent alternative in more recent versions of FEniCS?

Thank you!

As far as I know, there is a while since Mesh.move was deprecated. You should use ALE.move(mesh, displacement).

1 Like

Great! Thank you very much…