← Back to team overview

ufl team mailing list archive

Re: [FFC-dev] bug with tensor fields

 

Sorry about the early posting. The bug is in compile_function in  Dolfin
(I guess). The generated  tensor is 2x2 instead of 3x3.


Kent

>
> 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")
>
>
>
> _______________________________________________
> FFC-dev mailing list
> FFC-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/ffc-dev
>




Follow ups

References