Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpolation of non-symmetric tensor into a symmetric space #3165

Open
mscroggs opened this issue Apr 23, 2024 · 0 comments
Open

Interpolation of non-symmetric tensor into a symmetric space #3165

mscroggs opened this issue Apr 23, 2024 · 0 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@mscroggs
Copy link
Member

mscroggs commented Apr 23, 2024

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 #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.

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

@mscroggs mscroggs added enhancement New feature or request question Further information is requested labels Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant