← Back to team overview

ffc team mailing list archive

Re: mixed element issue?

 

Robert Kirby wrote:

It seems that if you put a vector element into a mixed element and then take it back out, you can no longer index it.

On the other hand, if I do:
# start new .form file here
vel_element = VectorElement("Lagrange","triangle",2)
pre_element = FiniteElement("Lagrange","triangle",1)
element = vel_element + pre_element
(u,p) = TrialFunctions( element )
(v,q) = TestFunctions( element )
u0 = Function( vel_element )

a = D(v[i],j)*D(u[i],j)*dx + v[i]*u0[j]*D(u[i],j)*dx
# end new .form file


What happens is that TestFunction (and TrialFunction) returns an object (BasisFunction) that has a well-defined operator for taking components with arbitrary indices.

TestFunctions (and TrialFunctions), however, returns "all the components" structured as a tuple of lists. Taking "an arbitrary index" of a python list doesn't work that well.

Will think some more about whether this is trivial/easy/difficult/impossible to change.

PS: If you want something like this to work *right* now try iterating over i and j manually ;) Simplify will contract it back for you.

--
Marie E. Rognes
Ph.D Fellow, Centre of Mathematics for Applications, University of Oslo
http://folk.uio.no/meg



Follow ups

References