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