You need to split the trial function from the mixed space for each component, which can either be done by
y = ufl.TrialFunction(Y)
u, p, T = ufl.split(y)
or use ufl.TrialFunctions
, as shown below:
# Import
import dolfinx
from ufl import div, dx, inner, FiniteElement, VectorElement, TrialFunctions, TestFunctions, MixedElement
from mpi4py import MPI
mesh = dolfinx.UnitCubeMesh(MPI.COMM_WORLD, 10, 10, 10)
v_cg2 = VectorElement('CG', mesh.ufl_cell(), 2)
p_cg1 = FiniteElement('CG', mesh.ufl_cell(), 1)
T_cg2 = FiniteElement('CG', mesh.ufl_cell(), 2)
mel = MixedElement([v_cg2, p_cg1, T_cg2])
V = dolfinx.FunctionSpace(mesh, v_cg2)
Q = dolfinx.FunctionSpace(mesh, p_cg1)
W = dolfinx.FunctionSpace(mesh, T_cg2)
Y = dolfinx.FunctionSpace(mesh, mel)
# Trial and test functions
u, p, T = TrialFunctions(Y)
v, q, w = TestFunctions(Y)
# Numerical parameters
gamma = 1.017
# Second component
L2 = inner(w,div(u))*dx
# Assemble bilinear form
A = dolfinx.fem.assemble_matrix(L2)
A.assemble()