← Back to team overview

ufl team mailing list archive

[Bug 461775] Re: form errors related to zeros

 

After some more digging around it turns out that if one uses:
 forms = [L, a]

compilation fails with:
ufl.log.UFLException: Form is not multilinear in basis function arguments.

for both definitions of NS_a() i.e.,

def NS_a(u,v):
  return inner(epsilon(u),epsilon(v))

or

def NS_a(u,v):
  return inner(planarGrad(u), planarGrad(v))

I guess that stripping the form of any Zeros before checking for
validity and taking derivatives will solve the problem. Is there a
reason not to do this?

-- 
form errors related to zeros
https://bugs.launchpad.net/bugs/461775
You received this bug notification because you are subscribed to UFL.

Status in Unified Form Language: New

Bug description:
The following form crashes with

AttributeError: 'Zero' object has no attribute '_expressions'

element = VectorElement("Lagrange", triangle, 1)
v =  TestFunction(element)
du = TrialFunction(element)

U = Function(element)

def planarGrad(u):
  return as_matrix([[u[0].dx(0),      0     ,u[0].dx(1)],
                              [    0     ,          0     ,     0        ],
                              [u[1].dx(0),      0     ,u[1].dx(1)]])

def epsilon(u):
  return 0.5*(planarGrad(u)+planarGrad(u).T)

def NS_a(u,v):
  return inner(epsilon(u),epsilon(v))

L = NS_a(U,v)*dx
a = derivative(L, U, du)


References