Rank analysis is wrong
Affects  Status  Importance  Assigned to  Milestone  

 SyFi 
Undecided

Unassigned 
Bug Description
from dolfin import *
parameters.
mesh = UnitCube(5,5,5)
VV = VectorFunctionS
u = TrialFunction(VV)
v = TestFunction(VV)
Aij = diag(Constant(
Delta = Identity( mesh.ufl_
# Works but should not work...
assemble(
Garth Wells (garthwells) wrote :  #2 
On 10 May 2012 19:34, Marie Rognes <email address hidden> wrote:
> On 05/10/2012 08:18 PM, Johan Hake wrote:
>> mesh = UnitCube(5,5,5)
>> VV = VectorFunctionS
>> u = TrialFunction(VV)
>> v = TestFunction(VV)
>> Aij = diag(Constant(
>> Delta = Identity( mesh.ufl_
>> # Does not work (but works with sfc)
>> assemble(
>> # Works
>> assemble(
>
> As far as I can see, your form has different ranks.
> The error message then seems very correct.
>
And that would then make it an SFC bug ;).
Garth
> 
>
> Marie
>
> 
> You received this bug notification because you are a member of FFC Core
> Team, which is subscribed to FFC.
> https:/
>
> Title:
> Rank analysis is wrong
>
> To manage notifications about this bug go to:
> https:/
Johan Hake (johanhake) wrote :  #3 
On 05/10/2012 08:34 PM, Marie Rognes wrote:
> On 05/10/2012 08:18 PM, Johan Hake wrote:
>> mesh = UnitCube(5,5,5)
>> VV = VectorFunctionS
>> u = TrialFunction(VV)
>> v = TestFunction(VV)
>> Aij = diag(Constant(
>> Delta = Identity( mesh.ufl_
>> # Does not work (but works with sfc)
>> assemble(
>> # Works
>> assemble(
>
> As far as I can see, your form has different ranks.
> The error message then seems very correct.
grad(u).rank() == 2
Delta.rank() == 2
Aij.rank() == 2
(grad(u)
(Aij*(grad(
Can you point our where it is wrong?
Johan
Marie Rognes (megsimula) wrote :  #4 
There is a difference between tensor rank and form rank. You are printing
the tensor ranks. The form rank would be number of Arguments.
So, in your example:
(grad(u) + Delta) * grad(v) = grad(u)*grad(v) + Delta*grad(v)
The first term on the righthand side has form rank 2 (there is a TestFunction
and a TrialFunction involved) while the other has form rank 1 (just a TestFunction).
DOLFIN can only assemble (and FFC only generate code for) forms
in which all terms have the same (form) rank.
In short, you can't add a matrix and vector together.
Garth Wells (garthwells) wrote :  #5 
On 10 May 2012 19:45, Johan Hake <email address hidden> wrote:
> On 05/10/2012 08:34 PM, Marie Rognes wrote:
>> On 05/10/2012 08:18 PM, Johan Hake wrote:
>>> mesh = UnitCube(5,5,5)
>>> VV = VectorFunctionS
>>> u = TrialFunction(VV)
>>> v = TestFunction(VV)
>>> Aij = diag(Constant(
>>> Delta = Identity( mesh.ufl_
>>> # Does not work (but works with sfc)
>>> assemble(
>>> # Works
>>> assemble(
>>
>> As far as I can see, your form has different ranks.
>> The error message then seems very correct.
>
> grad(u).rank() == 2
> Delta.rank() == 2
> Aij.rank() == 2
> (grad(u)
> (Aij*(grad(
>
> Can you point our where it is wrong?
>
The form ranks are mixed up  u is a TrialFunction and Delta is a
constant. You're mixing linear and bilinear forms.
Garth
> Johan
>
> 
> You received this bug notification because you are a member of FFC Core
> Team, which is subscribed to FFC.
> https:/
>
> Title:
> Rank analysis is wrong
>
> To manage notifications about this bug go to:
> https:/
On 05/10/2012 08:54 PM, Marie Rognes wrote:
> There is a difference between tensor rank and form rank. You are printing
> the tensor ranks. The form rank would be number of Arguments.
> So, in your example:
>
> (grad(u) + Delta) * grad(v) = grad(u)*grad(v) + Delta*grad(v)
>
> The first term on the righthand side has form rank 2 (there is a TestFunction
> and a TrialFunction involved) while the other has form rank 1 (just a TestFunction).
Tensors, smensors!!
> DOLFIN can only assemble (and FFC only generate code for) forms
> in which all terms have the same (form) rank.
> In short, you can't add a matrix and vector together.
Will target this as a bug for sfc :)
affects:  ffc → fenicssyfi 
description:  updated 
On 05/10/2012 08:18 PM, Johan Hake wrote:pace(mesh,"Lagrange",1)(1,1,1)))cell().geometric_dimension())inner(Aij*(grad(u)+Delta), grad(v))*dx)inner(Aij*grad(u), grad(v))*dx)
> mesh = UnitCube(5,5,5)
> VV = VectorFunctionS
> u = TrialFunction(VV)
> v = TestFunction(VV)
> Aij = diag(Constant(
> Delta = Identity( mesh.ufl_
> # Does not work (but works with sfc)
> assemble(
> # Works
> assemble(
As far as I can see, your form has different ranks.
The error message then seems very correct.

Marie