Interpolation of non-symmetric tensor into a symmetric space
- Dominant language
- C++
- Stars
- 1.2k
- Forks
- 261
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 71
Description
### Describe new/missing feature
Currently if you interpolate a non-symmetric tensor into a symmetric space, it will ignore the part above the diagonal.
For example (once https://github.com/FEniCS/dolfinx/issues/3164 is fixed), the following code will print `[1. 2. 4. 2. 3. 5. 4. 5. 6.]` even though the input has 0s above the diagonal.
```python
import basix.ufl
import numpy as np
from dolfinx.mesh import create_unit_square
from dolfinx.fem import functionspace, Function
from mpi4py import MPI
mesh = create_unit_square(MPI.COMM_WORLD, 10, 10)
def tensor(x):
mat = np.array([[1], [0], [0], [2], [3], [0], [4], [5], [6]])
return np.broadcast_to(mat, (9, x.shape[1]))
element = basix.ufl.element("DG", mesh.basix_cell(), 0, shape=(3, 3), symmetry=True)
space = functionspace(mesh, element)
f = Function(space)
f.interpolate(lambda x: tensor(x))
print(f.eval([[0, 0, 0]], [0]))
```
I'm unsure what is the best thing to do in case like this
### Suggested user interface
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.