← Back to team overview

ufl team mailing list archive

form algebra

 

Hi,

do we expect UFL to reduce the forms:

a = 0.5*v*u*dx - 0.5*v*u*dx = 0      (currently: 0.5*v*u*dx + -1*0.5*v*u*dx)
a = 0.5*v*u*dx + 0.5*v*u*dx = v*u*dx (currently: 2*(0.5*v*u*dx))

or should that be taken care of by the form compilers?

Also, is it possible to get all terms as a Sum of Products (expanded)?
As I see it the form compilers currently receive an arbitrarily nested
expression (Integrand).
Consider:

element = FiniteElement("Lagrange", triangle, 1)
element1 = FiniteElement("Lagrange", "triangle", 5)

v = TestFunction(element)
u = TrialFunction(element)

f = Function(element)
g = Function(element1)

a = (g + f)*v*u*dx

which I would like to have expanded into

a = g*v*u*dx + f*v*u*dx

because each Product will need a different number of quadrature points for exact
integration.
Or does the design allow for a better approach that I currently miss?

Kristian


Follow ups