← Back to team overview

ffc team mailing list archive

Re: slight modification of FFC and UFL

 


On Sun, 23 Aug 2009, Kristian Oelgaard wrote:

Quoting Shawn Walker <walker@xxxxxxxxxxxxxxx>:

Hello.  I would like to know how hard it would be to modify FFC (and UFL)
to do the following.

Here is the sample .ufl file:

Poisson.ufl
------------------------------------------
element = FiniteElement("Lagrange", "triangle", 2)
vector  = VectorElement("Lagrange", "triangle", 2)

v = TestFunction(element)
u = TrialFunction(element)
f = Function(element)
G = Function(vector)

a = inner(grad(v), grad(u))*dx
L = v*f*dx
------------------------------------------

And I would like to do the following in C++:

// in C++
a.G = Some_Function;

Basically, I just want to attach to `a' some external function that does
NOT appear in the bilinear form.  How hard would that be?  I'm not sure
what the UFL syntax should be.  This is for the higher order mesh stuff.

I'm sure it's possible, but does it make sense that a has a function attached on
which it does not depend?
The code that will be generated from this form, will not use G in any way, so
how do you plan on using it? For higher order mesh stuff, should one not just
use:
triangle = Cell("triangle", 2) # Cell() is defined in geometry.py in UFL

and then define the finite element as:

element = FiniteElement("CG", triangle, 1)

maybe we should/could attach the function G to the cell if you intend to use
this to compute the geometry?

Kristian

Yes, that is exactly what I want to do! I'm not sure completely about the Syntax though. Would this make sense:

--------------------------------------
# this is just a normal lagrange polynomial over a straight triangle
G  = VectorElement("Lagrange", "triangle", 2)

# now define what the higher order element is
my_triangle = Cell("triangle", G)

# then define the element
element = FiniteElement("CG", my_triangle, 1)
--------------------------------------

That way it is clear that G influences what the shape of the triangle is, and it splits up the implementation in a nice way. How about this?

- Shawn


Follow ups

References