UFL expand_derivatives/indices fail with conditional in FEniCS dev
Issue #82
resolved
The below example fails with "ufl.log.UFLException: Component size mismatch." in FEniCS dev. Does not fail with 1.6
from dolfin import *
from ufl.algorithms import expand_derivatives, expand_indices
mesh = UnitSquareMesh(2, 2)
V = VectorFunctionSpace(mesh, "CG", 1, dim=5)
v = Function(V)
V = v[0]
a = grad(conditional(lt(V, -40), exp(-V), 0))[0]*dx
print a
expand_indices(expand_derivatives(a))
Comments (5)
-
reporter -
reporter The (temporary) solution is of course:
import ufl ufl.algorithms.apply_derivatives.CONDITIONAL_WORKAROUND = True
cf
commit ae59864654596d2e3aa4c7c5067bdd57e8b62a4e Author: Martin Sandve Alnæs <martinal@simula.no> Date: Thu Mar 3 08:15:01 2016 +0100 Make the bugfix in conditional derivatives to avoid inf/nan values in generated code default behaviour. This bugfix may break ffc if uflacs representation is not used, and if you hit this issue the old workaround in ufl can be enabled by setting ufl.algorithms.apply_derivatives.CONDITIONAL_WORKAROUND = True at the top of your fenics program.
-
reporter - changed milestone to 1.8
- edited description
-
- changed status to resolved
-
- removed milestone
Removing milestone: 1.8 (automated comment)
- Log in to comment
UFL only example for easier debugging