This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Confused about use of multiplication symbol (*) in some UFL examples

0 votes

Hi,

I am new to FEniCS and have been looking at the incompressible Navier-Stokes demo and am confused about this UFL code representing a term in the weak formulation:

inner(grad(u0)*u0, v)

I am likely missing something, but I can't see how this is equivalent to the following term (given previously in the example):

$$\langle\nabla u \cdot u, v \rangle$$

The FEniCS book seems to indicate that the multiplication operator in UFL is only valid between two scalars, a scalar and a tensor, a matrix and a vector or two matrices. (I interpret grad(u0)*u0 as multiplication between a tensor and a vector.)

This usage seems to be prevalent throughout other examples as well, so I'd appreciate it if someone could clear this up for me!

asked Jun 4, 2015 by FF FEniCS User (4,630 points)

1 Answer

+1 vote
 
Best answer

With u0 vector-valued, grad(u0) is matrix-valued, and grad(u0)*u is the "a matrix and a vector" case you mentioned, i.e. it's equivalent to dot(grad(u0), u).

answered Jun 5, 2015 by martinal FEniCS User (2,800 points)
selected Jun 5, 2015 by FF
...