← Back to team overview

ffc team mailing list archive

Re: FFC

 

You were right, there was a (serious) bug in FFC for handling constant
indices. Thanks for pointing this out.

It has been fixed in the latest CVS version of FFC. However, the new
version of FFC uses FIAT directly to generate vector-valued elements
(previously handled in FFC), and FIAT assumes that a vector-valued
Lagrange element on a triangle has two components. I think Rob will
fix this shortly. Until then, try the following forms and see that you
get the expected results:

element = FiniteElement("Vector Lagrange", "triangle", 1)

v  = BasisFunction(element)
u1 = BasisFunction(element)

# Form 1
#a = v[1] *(u1[0].dx(0) + u1[1].dx(1)) * dx

#Form 2
#a = v[1] *(u1[0] + u1[1]) * dx

#Form 3
a = v[1] *(u1[0].dx(0) + u1[1].dx(1)) * dx

#Form 4
#a = v[1] *(u1[i].dx(i) ) * dx

/Anders

On Mon, May 02, 2005 at 05:19:37PM +0200, Garth N. Wells wrote:
> Dear Anders,
> 
> I've been trying to use FFC for some forms which cannot be written using
> summation convention, so I've been writing out the forms explicitly.
> However, I have a problem with terms that involve a derivative, e.g.
> u1[0].dx(0). Terms like u1[i].dx(i) (using indices) work fine.
> 
> Below is the code from an FFC file. What I've labelled Form 1 is basically the
> continuity equation for 2D Navier-Stokes. Form 1 and Form 2 produce erroneously
> exactly the same header file. In the case of Form 1, the resulting header file
> does not involve any terms from the Jacobian (g00, g10, etc.) which it should
> do. I would expect Form 3 and Form 4 to produce the same result. However, Form 4
> produces the expected result, and Form 3 does not. Is there something wrong with
> the synatax that I'm using? Notably, terms like u1[0].dx() do produce the
> expected result (no index between the round brackets).
> 
> We're having some trouble with our mail server here, so I'd be grateful if you
> could send a cc of any response to gnwells@xxxxxxxxxxx.
> 
> Regards,
> Garth
> 
> name = "Test"
> vector = FiniteElement("Lagrange", "triangle", 1, 3)
> 
> v    = BasisFunction(vector)
> u1   = BasisFunction(vector)
> 
> # Form 1
> a = v[2] *(u1[0].dx(0) + u1[1].dx(1)) * dx
> 
> #Form 2
> #a = v[2] *(u1[0] + u1[1]) * dx
> 
> #Form 3
> #a = v[2] *(u1[0].dx(0) + u1[1].dx(1) + u1[2].dx(2)) * dx
> 
> #Form 4
> #a = v[2] *(u1[i].dx(i) ) * dx
> 
> 

-- 
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/



Follow ups