Subject: [Ffc] All components of a list tensor most provide same arguments?

From: Patrick Riesen <[email-masked]>
Date: Wed, 17 Nov 2010 14:36:54 +0100

hello,
i'm trying to update my code for the most recent fenics development 
versions.

compiling+demos for ffc/ufl/dolfin etc. is all ok.

now my code has a problem, i have the following in the ufl-file:

****
e = as_matrix([[0.5*u.dx(0)**2, 0.5*u.dx(0)],
                [0.5*u.dx(0)   ,        0.0]])

e_dev = e - 0.5*tr(e)*Identity(2)

Ie = 0.5*tr(e_dev*e_dev)
beta = K*exp(-c*Ie)

****

note:
the variable u is a coefficient from a mixed element as
uw = Coefficient(ME)
u, w = split(uw)

compiling with ffc now terminates after the compiler stage 1 and gives:

All components of a list tensor most provide same arguments

*** FFC: All components of a list tensor most provide same arguments
*** FFC: To get more information about this error, rerun FFC with --verbose.

what does this mean? how do i need to fix my syntax above?

regards,
patrick

---

From: Anders Logg <[email-masked]>
Date: Wed, 17 Nov 2010 14:43:58 +0100

I don't know what that means, but I assume the 0.0 is the problem.

Does it work if you write Zero()?

--
Anders

On Wed, Nov 17, 2010 at 02:36:54PM +0100, Patrick Riesen wrote:
> _______________________________________________
> Mailing list: https://launchpad.net/~ffc
> Post to     : [email-masked]
> Unsubscribe : https://launchpad.net/~ffc
> More help   : https://help.launchpad.net/ListHelp

---

From: Marie Rognes <[email-masked]>
Date: Wed, 17 Nov 2010 14:53:26 +0100

> what does this mean? how do i need to fix my syntax above?

When compiling a given form 'a', FFC now checks that the form has a
single rank; that is, that all terms in the form has the same rank. FFC
does this (more or less) by extracting the ranks of all the terms
appearing in the form and checking that there is only one rank.

Problems can arise with list tensors (such as as_matrix(...)) where the
components have different ranks. It is odd however, that the above
example gives problems since if u is a coefficient, then 0.5*u.dx(0) and
0.0 should have the same rank.

Could you provide a minimal runnable example that reproduces the error?

--
Marie

---

From: Patrick Riesen <[email-masked]>
Date: Wed, 17 Nov 2010 16:15:17 +0100

Nope, won't do differnt with Zero().
Here is a simple complete program:
-----------------------------------------------------------------
cell = interval
FE = FiniteElement("CG", cell, 2)

v = TestFunction(FE)
U = TrialFunction(FE)

u = Coefficient(FE)

K = Constant(cell)
c = Constant(cell)

                [0.5*u.dx(0)   ,     Zero()]])

Ie = 0.5*tr(e_dev*e_dev)
beta = K*exp(-c*Ie)

L = v.dx(0)*beta*0.5*u.dx(0)*dx    # ok
a = derivative(L, u, U)            # it fails here
-----------------------------------------------------------------

regards,
patrick

---

From: Marie Rognes <[email-masked]>
Date: Wed, 17 Nov 2010 17:28:03 +0100

> Here is a simple complete program:

Thanks. I see what is going on, but do not quite know how to fix it
immediately.
Please add a bug report (for UFL, which is where the problem is), and
I'll think about how to fix it.

Here is a simpler example btw:

from ufl.algorithms import compute_form_arities

cell = interval

e = as_matrix([[u, 0.0],
               [0.0, 0.0]])
L = tr(e)*dx

U = TrialFunction(FE)
a = derivative(L, u, U)         
compute_form_arities(a)

--
Marie

regards,

---

From: Patrick Riesen <[email-masked]>
Date: Wed, 17 Nov 2010 17:50:42 +0100

Ok, i wanted to file a bug report just now, but i got two

'time out errors' from launchpad services. i'll try again later.

btw. launchpad told me about a related (fixed) bug:
  	
#601965 compute_form_arities crashes in ListTensor

anyway, many thanks and best regards,
patrick

---

From: Marie Rognes <[email-masked]>
Date: Wed, 17 Nov 2010 17:53:43 +0100

> #601965 compute_form_arities crashes in ListTensor

That bug was related to the same functionality, but a different problem
(which is fixed).
So, feel free to open a new one.

--
Marie