Dear all,

Please see below for a snippet of my code where I solve a simple linear elasticity problem on a submesh with spring boundary conditions:

\quad \int_{\Omega_L} \boldsymbol{\sigma}(\mathbf{u}_L):\boldsymbol{\varepsilon}(\delta \mathbf{u}_L)\ d\mathbf{x} + \kappa \int_{\partial \Omega_L} \mathbf{u}_L \cdot \delta\mathbf{u}_L\ d\Gamma = \int_{\partial \Omega_L } \left( \mathbf{t}(\mathbf{u}_{\text{global}} ) + \kappa \mathbf{u}_{\text{global}} \right) \cdot \delta\mathbf{u}_L \ d\Gamma

where

\quad \mathbf{t}(\mathbf{u}_{\text{global}} ) = \mathbf{n} \cdot \boldsymbol{\sigma}(\mathbf{u}_{\text{global}})

Unfortunately I cannot create a minimum working example, but I hope the following explanation is sufficiently clear. In the code snippet the different u’s are all vector fields. In essence I am trying to compute the tractions on ds from an auxiliary (global) problem and apply them on the local problem.

```
du = TestFunction(self.Geom_local.U)
Dd_total_nrg, Du_total_nrg = self.mp.Der_total_nrg( \
self.Geom_local.d, dd, self.Geom_local.u, du)
u_global = project(self.Geom_ref.u, self.Geom_local.U)
n = FacetNormal(self.Geom_local.mesh)
ds = Measure("ds", subdomain_data=boundary_markers)
tractions = dot(self.mp.sigma0(u_global), n)
Du_total_nrg += self.mp.kappa*dot(self.Geom_local.u, du) * ds(0) \
- dot(tractions, du) * ds(0) \
- dot(self.mp.kappa*u_global, du) * ds(0)
```

The error I obtain is: ufl.log.UFLException: Can only integrate scalar expressions. The integrand is a tensor expression with value shape (2, 2) and free indices with labels (). The error stems from the traction term since omitting it will compute a solution. I cannot see however what I possibly did wrong in computing the tractions.