← Back to team overview

ffc team mailing list archive

Re: Re: FFC

 

On Wed, May 04, 2005 at 12:19:01PM +0200, Garth N. Wells wrote:
> Anders,
> 
> It runs with Python 2.4. The test bilinear forms with constant
> indices seem to give the correct result now.

Good to know.

> An idea for FFC might be to allow Matlab/Fortran95 style syntax for
> summation.  For example, u[1] + u[2] could be expressed as u[1:2].

I'll think about it, but I want to keep the syntax minimal and only
allow a very limited set of operations. There are also plans to add a
layer on top of FFC and then the syntax of FFC won't really matter.
(Matt Knepley at Argonne has a parser that we might want to hook up
with FFC.)

/Anders

> 
> 
> Quoting Anders Logg <logg@xxxxxxxxx>:
> 
> > On Tue, May 03, 2005 at 11:57:10PM +0200, Garth N. Wells wrote:
> > > I'll look into Python 2.4.
> > > 
> > > I don't however have access to the CVS version of FFC.
> > 
> > Oops. It should be in the download section on fenics.org but it's not.
> > It's been fixed now:
> > 
> >     http://www.fenics.org/pub/software/ffc/cvs/
> > 
> > Grab the file ffc-cvs-current.tar.gz.
> > 
> > It's automatically updated from CVS each hour.
> > 
> > /Anders
> > 
> > > 
> > > Quoting Anders Logg <logg@xxxxxxxxx>:
> > > 
> > > > I think this is a Python 2.3 problem. Can you update to Python 2.4?
> > > > 
> > > > The built-in data type set was added in Python 2.4. If you are unable
> > > > to upgrade to Python 2.4, I can change to use the class Set from the
> > > > module sets which should work with both 2.3 and 2.4.
> > > > 
> > > > Also note that you need the latest CVS version of FFC to run the test
> > > > problems (0.1.7 was released before the bug fix).
> > > > 
> > > > /Anders
> > > > 
> > > > 	On Tue, May 03, 2005 at 11:35:35PM +0200, Garth N. Wells wrote:
> > > > > Anders,
> > > > > 
> > > > > I can't try the forms that you gave, because I can't get FFC 0.1.7 +
> > FIAT
> > > > 0.2.1
> > > > > to run. The output from 'ffc Poisson.form' (using the Poisson.form demo
> > in
> > > > > ffc-0.1.7/src/demo) is 
> > > > > 
> > > > > mech136/<4>ffc-0.1.7/src/demo>ffc Poisson.form
> > > > > This is FFC, the FEniCS Form Compiler, version 0.1.7.
> > > > > For further information, go to http://www/fenics.org/ffc/.
> > > > > 
> > > > > Parsing Poisson.form
> > > > > Output written to Poisson.py
> > > > > 
> > > > > Compiling form: (dXa0/dxb0)(dXa1/dxb0) |
> > ((d/dXa0)vi1)*((d/dXa1)vi0)*dX
> > > > > Finite element of test space:  Lagrange finite element of degree 1 on
> > a
> > > > Triangle
> > > > > Finite element of trial space: Lagrange finite element of degree 1 on
> > a
> > > > Triangle
> > > > > Computing 36 integrals, this may take some time
> > > > >
> > > >
> > ...............................................................................
> > > > > Traceback (most recent call last):
> > > > >   File "/usr/bin/ffc", line 80, in ?
> > > > >     main(sys.argv[1:])
> > > > >   File "/usr/bin/ffc", line 58, in main
> > > > >     execfile(outname)
> > > > >   File "Poisson.py", line 38, in ?
> > > > >     compile([a, L], name, "0.1.7", "C++", "GNU GPL Version 2")
> > > > >   File "/usr/lib/python2.3/site-packages/ffc/compiler/compiler.py",
> > line
> > > > 75, in
> > > > > compile
> > > > >     form.AKi = ElementTensor(form.sum, "interior", format)
> > > > >   File
> > "/usr/lib/python2.3/site-packages/ffc/compiler/elementtensor.py",
> > > > line
> > > > > 41, in __init__
> > > > >     gK_used = set()
> > > > > NameError: global name 'set' is not defined
> > > > > 
> > > > > Garth
> > > > > 
> > > > > 
> > > > > Quoting Anders Logg <logg@xxxxxxxxx>:
> > > > > 
> > > > > > 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
> > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > > _______________________________________________
> > > FFC-dev mailing list
> > > FFC-dev@xxxxxxxxxx
> > > http://www.fenics.org/cgi-bin/mailman/listinfo/ffc-dev
> > > 
> > 
> 

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



References