Adding expressions with non-matching form arguments ('v_0',) vs ('v_0', 'v_1')

Dear all,
I try to solve the thermal problem of two phases material in fenics with the below code:

from fenics import *

# Define mesh and function space
mesh = UnitSquareMesh(32, 32)
V = FunctionSpace(mesh, 'P', 1)

# Define material properties
alpha1 = 1.0      # thermal expansion coefficient of phase 1
alpha2 = 0.5      # thermal expansion coefficient of phase 2
epsilon = 0.5     # volume fraction of phase 1
T_ref = Constant(0.0)  # reference temperature

# Define boundary conditions
u_L = Constant(0.0) # left boundary temperature
u_R = Constant(1.0) # right boundary temperature

# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
T = Function(V)
T_n = Function(V) # previous time step solution
F = ((1 + alpha1*(T - T_ref))*epsilon + (1 + alpha2*(T - T_ref))*(1-epsilon))*u*v*dx \
    + dot(grad(u), grad(v))*dx \
    - ((1 + alpha1*(T_ref - u_L))*epsilon + (1 + alpha2*(T_ref - u_R))*(1-epsilon))*v*dx

# Define time step and solve
dt = 0.01
t_end = 1.0
t = dt
while t <= t_end:
    solve(F == 0, T)
    T_n.assign(T)
    t += dt

# Compute average thermal expansion coefficient
alpha = assemble(((1 + alpha1*(T - T_ref))*epsilon + (1 + alpha2*(T - T_ref))*(1-epsilon)) * dx) / assemble(u * dx)

# Output thermal expansion coefficient
print("The thermal expansion coefficient is: ", alpha)

when I run this code, there is an error:

Adding expressions with non-matching form arguments ('v_0',) vs ('v_0', 'v_1').

how to fix this problem please
thank you very much and wait for your response

You have two unknowns in your equation, namely u and T, which does not make sense variationally.
Which of the two are you trying to solve the problem for? To me it seems like you want to solve for T, but then u cannot be a TrialFunction.

Thank you for your reply