← Back to team overview

ffc team mailing list archive

outer product with grad(scalar)

 

I'd like to take the outer product of the gradient of a scalar and a normal vector. I am running into some trouble.

For example, when I try to compile the following code:

   elem = FiniteElement("Lagrange", "triangle", 1)

   v = TestFunction(elem)
   n = FacetNormal("triangle")

   test = outer(grad(v),n)


I get the following error


   [jtostie@tostien elasto-diffusion]$ ffc -d1 -l dolfin test.form
   This is FFC, the FEniCS Form Compiler, version 0.4.1.
   For further information, go to http://www/fenics.org/ffc/.

   Preprocessing form file: test.form --> test.py

   Traceback (most recent call last):
     File "/home/jtostie/builds/bin/ffc", line 180, in ?
       sys.exit(main(sys.argv[1:]))
     File "/home/jtostie/builds/bin/ffc", line 107, in main
       execfile(outname, ns)
     File "test.py", line 14, in ?
       test = outer(grad(v),n)
     File
   "/home/jtostie/builds/lib/python/ffc/compiler/language/operators.py",
   line 135, in outer
       raise FormError, (v, "Outer products are only defined for
   Functions.")


What I think this means is that the gradient of a function is no longer a function? Is this expected? I can see that I could project grad(v) onto a continuous basis and then use that as a function, or simply hard code the outer product for this simple case, but my real question is whether or not this should be handled correctly as is.

-Jake


Follow ups