I am facing an issue with the update from the version 2017.2 to 2018.1 when using UserExpression in the definition of the variational formulation. Indeed, defining an expression through the following class
def __init__(self, F,element, **kwargs): self.F = F self._ufl_element = element super().__init__(**kwargs) def eval(self, value, x): value = self.F(x) def value_shape(self): return (1,)
and defining the formulation L such that
V = FunctionSpace(mesh,'P',order) u = TrialFunction(V) v = TestFunction(V) a = dot(grad(u), grad(v))*dx L = DefineExpression(function,element=V.ufl_element())*v*dx
the following error is triggered.
ufl.log.UFLException: Can only integrate scalar expressions. The integrand is a tensor expression with value shape (1,) and free indices with labels ().
A similar issue has been reported in
but i have problem to figure out the workaround.
Would you know if there is a new syntax or a fix/workaround possible?