← Back to team overview

dolfin team mailing list archive

bug with tensor fields

 

The following variational forms should produce the same matrices,

Ai = Function(T, ( ("1.0", "0.0"), ("0.0", "1.0")) )
a1 = dot(dot(Ai, curl(v)), curl(u))*dx
a2 = dot(curl(v), curl(u))*dx

But it doesn't.

I am not sure whether the bug is in Dolfin, FFC or UFL.

The following test script can be used to test the problem.

from dolfin import *

N = 2
mesh = UnitCube(N,N,N)
V = FunctionSpace(mesh, "N1curl", 1)
T = TensorFunctionSpace(mesh, "CG", 1)

u = TrialFunction(V)
v = TestFunction(V)

Ai = Function(T, ( ("1.0", "0.0"), ("0.0", "1.0")) )
a1 = dot(dot(Ai, curl(v)), curl(u))*dx
a2 = dot(curl(v), curl(u))*dx

A1 = assemble(a1)
A2 = assemble(a2)


file = File("A1.m")
file <<A1
file = File("A2.m")
file <<A2

file_str = """
A1;
A1 = A;
clear A;
A2;
A2 = A;
clear A;

max(max(A1-A2))
"""

f = open("test_tensor.m", 'w')
f.write(file_str)
f.close()

import os
os.system("octave test_tensor.m")





Follow ups