On Tuesday 22 September 2009 09:49:38 [email protected] wrote:
> 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")) )
This creates a 2x2 tensor function, do you not want a 3x3 tensor?
I have plans on fixing rigorous tests for value shapes for function
expressions. Which are automatically checked with the value shape of the
FunctionSpace. This could prevent your error and some nasty segfaults...
Johan
> 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
> [email protected]
> http://www.fenics.org/mailman/listinfo/ffc-dev
>
_______________________________________________
DOLFIN-dev mailing list
[email protected]
http://www.fenics.org/mailman/listinfo/dolfin-dev