FEniCS / FEniCS/dolfinx

Finite element spaces on manifolds do not carry information about their value_shape in physical space

Open
#3,619 15 comments 0 reactions 1 assignee Claimed by @mscroggs View on GitHub
high-priority
Dominant language
C++
Stars
1.2k
Forks
261
Avg merge
1d 19h
Merged PRs (30d)
71

Description

### Summarize the issue

The value check for interpolating on manifolds are wrong.
Introduced in: https://github.com/FEniCS/dolfinx/pull/3500.

### How to reproduce the bug

The following example runs on v0.9.0, but not nightly

### Minimal Example (Python)

```Python
from mpi4py import MPI
import numpy as np
import basix.ufl
import dolfinx
import ufl

points = np.array([[0.0, 0.0, 0.0], [1.0, 0, 1.0], [1.0, 1.0, 0.0]])
cells = np.array([[0, 1, 2]], dtype=np.int32)
ud = ufl.Mesh(basix.ufl.element("Lagrange", "triangle", 1, shape=(3,)))
mesh = dolfinx.mesh.create_mesh(MPI.COMM_WORLD, cells, points, ud)

el = basix.ufl.element("RT", mesh.basix_cell(), 2)
V = dolfinx.fem.functionspace(mesh, el)
w = dolfinx.fem.Function(V)

el_o = basix.ufl.element("DG", mesh.basix_cell(), 1, shape=(mesh.geometry.dim,))
Q = dolfinx.fem.functionspace(mesh, el_o)
q = dolfinx.fem.Function(Q)
q.interpolate(w)
```

### Output (Python)

```bash
File "/root/shared/examples/eikonal/debug_interpolate_rt_manifold.py", line 21, in
q.interpolate(w)
File "/usr/local/dolfinx-real/lib/python3.12/dist-packages/dolfinx/fem/function.py", line 460, in interpolate
_interpolate(u0)
File "/usr/lib/python3.12/functools.py", line 909, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/dolfinx-real/lib/python3.12/dist-packages/dolfinx/fem/function.py", line 446, in _
self._cpp_object.interpolate(u0._cpp_object, cells0, cells1) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Interpolation: elements have different value dimensions
```

### Version

main branch

### DOLFINx git commit

d45b65f6fff295e575f774385b8172054f36d908

### Installation

Running DOLFINx nightly container

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.