For model reduction purposes I want to assemble the trilinear form
$$(\nabla \cdot(u*v), w)$$
that is associated with the convection term in the Navier-Stokes equations. Eventually, I want to have a matrix in $\mathbb R^{n,n^2}$ that I can multply $u \otimes u$ with to get the convection term.
For a start, I simply want to assemble the form $(u*v, w)$, with u
and v
from the same trial space and w
from the test space:
import dolfin
from dolfin import dx
N = 10
mesh = dolfin.UnitSquareMesh(N, N)
V = dolfin.FunctionSpace(mesh, 'CG', 2)
U = dolfin.FunctionSpace(mesh, 'CG', 2)
v = dolfin.TestFunction(V)
u = dolfin.TestFunction(U)
w = dolfin.TrialFunction(V)
nform = dolfin.assemble(u*v*w*dx)
However, this direct approach fails, with
UFLException: Found different Arguments with same counts.
Did you combine test or trial functions from different spaces?
Following Jan's answer to this question, I suspect I have to resort to the argument class in UFL. However, I have difficulties to understand this class. So my questions are:
- What are the possibilities to assemble this trilinear form?
- How to use the arguments class?