Hi, sorry for replying so late. I tried your suggestions in the code, but it seems they are not easy to implement:

```
# The thermal elastic calculation eliminates the strain in the z-direction
from mpi4py import MPI
from dolfinx import io
from dolfinx.io import gmshio
from petsc4py import PETSc
from ufl import (tr, inner, lhs, rhs, Identity, TestFunction, TrialFunction, dx, as_matrix, sym)
from dolfinx.fem import (functionspace, Function, form)
from dolfinx.fem.petsc import (LinearProblem, assemble_matrix, assemble_vector)
# Mesh
mesh, cell_markers, facet_markers = gmshio.read_from_msh("test.msh", MPI.COMM_WORLD, gdim=3)
# Parameters
E = 2e5
nu = 0.3
mu = E/2/(1+nu)
lmbda = E*nu/(1+nu)/(1-2*nu)
alpha = 1e-5
# Function space
VU = functionspace(mesh, ("CG", 1, (mesh.geometry.dim - 1, ))) #
U = Function(VU)
def eps(v): #
grad = as_matrix([[U[0].dx(0), U[0].dx(1), 0],
[U[1].dx(0), U[1].dx(1), 0],
[0, 0, 0]])
return sym(grad)
def sigma(v, dT):
return (lmbda*tr(eps(v))-alpha*(3*lmbda + 2*mu)*dT)*Identity(3)+2.0*mu*eps(v)
# Variational formula
dU = TrialFunction(VU)
U_ = TestFunction(VU)
Wint = inner(sigma(dU, 1000), eps(U_)) * dx
aM = lhs(Wint)
LM = rhs(Wint)
# Assemble matrix
A = assemble_matrix(form(aM))
A.assemble()
b = assemble_vector(form(LM))
b.ghostUpdate(addv=PETSc.InsertMode.ADD, mode=PETSc.ScatterMode.REVERSE)
# Set solver options
opts = PETSc.Options()
opts["ksp_type"] = "preonly"
opts["pc_type"] = "lu"
opts["pc_factor_mat_solver_type"] = "mumps"
#Create PETSc Krylov solver and turn convergence monitoring on
solver = PETSc.KSP().create(mesh.comm)
solver.setFromOptions()
solver.setOperators(A)
# Solve
solver.solve(b, U.vector)
```

And I encountered the following error:

```
Traceback (most recent call last):
File "/home/dyfluid/Desktop/data_test2/test1.py", line 34, in <module>
A = assemble_matrix(form(aM))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dyfluid/anaconda3/envs/fenicsx-env/lib/python3.11/functools.py", line 909, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dyfluid/anaconda3/envs/fenicsx-env/lib/python3.11/site-packages/dolfinx/fem/petsc.py", line 424, in assemble_matrix
A = _cpp.fem.petsc.create_matrix(a._cpp_object)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Cannot create sparsity pattern. Form is not a bilinear.
```