← Back to team overview

ffc team mailing list archive

Re: Getting NoneType from dot

 

2007/10/12, Anders Logg <logg@xxxxxxxxx>:
> Martin Sandve Alnæs wrote:
> > 2007/10/12, Martin Sandve Alnæs <martinal@xxxxxxxxx>:
> >> 1) What is wrong with this form?
>
> You take a dot product of a scalar with a vector (or a vector with a
> matrix in the vector case).

While I agree of course that the scalar case is wrong, I'd expect dot
to handle vector times matrix, the convection term is usually written
"u dot grad u".

> >> 2) If it's a user mistake and not an ffc bug, ffc should raise an
> >> exception and not return None
>
> Yes. Looking at operators.py, the "else" clause seems to be missing for
> the dot function.
>
> /Anders
>
>
> >>
> >> from ffc import *
> >>
> >> fe = FiniteElement("Lagrange", "triangle", 1)
> >
> > This should be:
> > fe = VectorElement("Lagrange", "triangle", 1)
> > but it doesn't change the None returned from dot.
> >
> >> v  = TestFunction(fe)
> >> u  = TrialFunction(fe)
> >> w  = Function(fe)
> >>
> >> Dw = grad(w)
> >> Du = grad(u)
> >>
> >> uDw = dot(u, Dw)
> >>
> >> print u
> >> print Dw
> >> print uDw # None!
> >
> > Output:
> >
> > vi-1
> > [[w0_a9(dXa11/dx0) | ((d/dXa11)va9[0]), w0_a12(dXa14/dx1) |
> > ((d/dXa14)va12[0])], [w0_a15(dXa17/dx0) | ((d/dXa17)va15[1]),
> > w0_a18(dXa20/dx1) | ((d/dXa20)va18[1])]]
> > None
> >
> >
> >> wDu = dot(w, Du)
> >>
> >> a = dot(v, uDw+wDu) * dx
> >>
> >>
> >>
> >> --
> >> Martin
> >>
> >
> >
>


-- 
Martin


Follow ups

References