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

Assembling a Trilinear Form

+1 vote

Dear all,

I have a mixed function u, splitted in c, mu, n defined on a ME = mixedspace([V,V,V]) where V is a P1 space and v,w,t are the test functions.

Is there a way to assemble the matrix from
a = c* n* v* dx ?

If I do A = assemble (a) , it gives me errors.. of course.

Thanks,
Cristina

asked May 18, 2015 by MCri FEniCS User (1,120 points)
reshown May 20, 2015 by MCri

This works just fine for me using dolfin1.5. The form a you're trying to assemble will assemble into a vector, not a matrix. Could you be more specific (code example, error messages)?

mesh= RectangleMesh(-3, -3, 3, 3, 2, 2)
V    = FunctionSpace(mesh,"Lagrange",1)
ME   = MixedFunctionSpace([V,V,V])
u = TrialFunction(ME)
c,mu,n = split(u)
v,w, t = TestFunctions(ME)
a = c*n*v*dx
A = assemble(a)

Traceback (most recent call last):
File "versione3.py", line 234, in
A = assemble(a_n)
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/dolfin/fem/assembling.py", line 193, in assemble
..........
File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/algorithms/check_arities.py", line 54, in product
raise ArityMismatch("Multiplying expressions with overlapping form argument number {0}, argument is {1}.".format(x.number(), x))
ufl.algorithms.check_arities.ArityMismatch: Multiplying expressions with overlapping form argument number 1, argument is v_1.

If I do u = Function(ME) it works and in gives me a vector as you suggested. The problem is that I should lump all the L2 product (in order to have the convergence of the loop) and I don't know how to do it. I have this term (cn, v) in my equation and I don't know how to treat it.
Do you know what is the meaning of A = assemble(c
n0vdx), with n0 a given vectors? That obtained A is a matrix..

Is this a bug? I am having the same problem with dolfin 1.6

...