Issue with function 'errornorm': object has no attribute 'ufl_element'

Asked by Vincent Meijer

Hello,

I was trying to run a simple tutorial script:

"""
from dolfin import *
mesh = UnitSquareMesh(32, 32)
(x, y) = SpatialCoordinate(mesh)
element = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
V = FunctionSpace(mesh, element)
u = Function(V)
v = TestFunction(V)
f = Constant(-6.0)
g = 1 + x**2 + 2*y**2
bc = DirichletBC(V, g, DomainBoundary())
F = inner(grad(u), grad(v))*dx - f*v*dx
solve(F == 0, u, bc)
print(errornorm(g,u, norm_type = "l2"))

"""
using Python 3 and Docker. However, I get the following error message:

"""
Traceback (most recent call last):
  File "01.py", line 15, in <module>
    print(errornorm(g, u, 'L2'))
  File "/usr/local/lib/python3.6/dist-packages/dolfin/fem/norms.py", line 246, in errornorm
    degree_u = u.ufl_element().degree()
AttributeError: 'Sum' object has no attribute 'ufl_element'
"""

Since I could not find anything similar online I decided to make this post. Could someone help me out?

Question information

Language:
English Edit question
Status:
Expired
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.