ALE.move not working on IntervalMesh

Hello,

I have DOLFIN version: 2019.2.0.dev0 and I’m trying to change the size of my 1d mesh at each time step. I have gotten ALE.move to work on a 2D mesh, but when I try to adapt the code to a 1D mesh it gives me a runtime error. There appears to be an issue with interpolating the expression onto the function, but I am not sure. This is a minimal code to reproduce the error:

import dolfin

mesh = dolfin.UnitIntervalMesh(4)

u = dolfin.Function(dolfin.VectorFunctionSpace(mesh, "CG", 1))
u.interpolate(dolfin.Expression("2*x[0]", degree=1))
dolfin.ALE.move(mesh, u)

gives me this error:

Untitled-1 in <module>
      <a href='untitled:Untitled-1?line=6'>7</a> 
      <a href='untitled:Untitled-1?line=7'>8</a> u = dolfin.Function(dolfin.VectorFunctionSpace(mesh, "CG", 1))
----> <a href='untitled:Untitled-1?line=8'>9</a> u.interpolate(dolfin.Expression("2*x[0]", degree=1))
      <a href='untitled:Untitled-1?line=9'>10</a> dolfin.ALE.move(mesh, u)
     <a href='untitled:Untitled-1?line=10'>11</a> dolfin.plot(mesh)

/usr/lib/petsc/lib/python3/dist-packages/dolfin/function/function.py in interpolate(self, u)
    379     def interpolate(self, u):
    380         if isinstance(u, ufl.Coefficient):
--> 381             self._cpp_object.interpolate(u._cpp_object)
    382         else:
    383             self._cpp_object.interpolate(u)

RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
...
*** 
*** DOLFIN version: 2019.2.0.dev0
*** Git changeset:  unknown
*** -------------------------------------------------------------------------

You need to provide a tuple of scalar Expressions to interpolate into a VectorFunctionSpace, even in 1D. The following modification works:

#u.interpolate(dolfin.Expression("2*x[0]", degree=1))
u.interpolate(dolfin.Expression(("2*x[0]",), degree=1))
1 Like