← Back to team overview

ffc team mailing list archive

Problems with lhs/rhs and mixed elements

 

I'm running into an error when I attempt to use lhs() and rhs() with
mixed elements. I have attached two small .ufl files, one for the
Poisson equation (which works) and the other for the Stokes equations
(which fails with the following error).

Preprocessing form file: stokes-broken.ufl --> stokes-broken.py

Wrapping non-UFL expression. This is experimental and will likely break
many algorithms!
Expecting Python scalar, not
set([BasisFunction(MixedElement(*[VectorElement('Lagrange',
Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange',
Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), -2)]).



FAILURE in reuse_if_possible:
type(o) = <class 'ufl.tensors.ListTensor'>
operands =

(Indexed(BasisFunction(MixedElement(*[VectorElement('Lagrange',
Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange',
Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), -2),
MultiIndex((FixedIndex(0),), {FixedIndex(0): 3})),
set([BasisFunction(MixedElement(*[VectorElement('Lagrange',
Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange',
Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), -2)]))

(Indexed(BasisFunction(MixedElement(*[VectorElement('Lagrange',
Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange',
Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), -2),
MultiIndex((FixedIndex(1),), {FixedIndex(1): 3})),
set([BasisFunction(MixedElement(*[VectorElement('Lagrange',
Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange',
Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), -2)]))

stack =
////////////////////////////////////////////////////////////////////////////////
Visit stack in Transformer:
<class 'ufl.algebra.Sum'> ; -1 * (sum_{i_8} ((w_0)[i_8]) * (([[
(v_{-2})[0], (v_
<class 'ufl.algebra.Product'> ; -1 * (sum_{i_8} ((w_0)[i_8]) * (([[
(v_{-2})[0],
<class 'ufl.indexsum.IndexSum'> ; sum_{i_8} ((w_0)[i_8]) * (([[
(v_{-2})[0], (v_
<class 'ufl.algebra.Product'> ; ((w_0)[i_8]) * (([[ (v_{-2})[0],
(v_{-2})[1] ]])
<class 'ufl.indexed.Indexed'> ; ([[ (v_{-2})[0], (v_{-2})[1] ]])[i_8]
<class 'ufl.tensors.ListTensor'> ; [[ (v_{-2})[0], (v_{-2})[1] ]]
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


*** FFC: Expecting Python scalar, not
set([BasisFunction(MixedElement(*[VectorElement('Lagrange',
Cell('triangle', 1, Space(2)), 2, 2), FiniteElement('Lagrange',
Cell('triangle', 1, Space(2)), 1)], **{'value_shape': (3,) }), -2)]).
*** FFC: To get more information about this error, rerun FFC with --debug.

Harish
cell = triangle
vector = VectorElement("Lagrange", cell, 2)
scalar = FiniteElement("Lagrange", cell, 1)
system = vector + scalar

v = TestFunction(vector)
u = TrialFunction(vector)

f = Function(vector)

F = (inner(grad(v), grad(u)) - inner(v, f))*dx

a = lhs(F)
L = rhs(F)

cell = triangle
vector = VectorElement("Lagrange", cell, 2)
scalar = FiniteElement("Lagrange", cell, 1)
system = vector + scalar

(v, q) = TestFunctions(system)
(u, p) = TrialFunctions(system)

f = Function(vector)

F = (inner(grad(v), grad(u)) - div(v)*p + q*div(u))*dx - inner(v, f)*dx

a = lhs(F)
L = rhs(F)


Follow ups