Creating a FunctionSpace with a MixedElement without a MeshSequence
- Dominant language
- Python
- Stars
- 150
- Forks
- 79
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 10
Description
With recent API changes it is no longer possible to create a `FunctionSpace` with a `MixedElement` without a `MeshSequence`. We should consider automating the construction of the `MeshSequence` if a standard Mesh is provided to mantain backwards-compatibility.
```
import ufl
import finat.ufl
cell = ufl.triangle
domain = ufl.Mesh(finat.ufl.VectorElement(finat.ufl.FiniteElement("Lagrange", cell, 1)))
V = finat.ufl.VectorElement(finat.ufl.FiniteElement("Lagrange", cell, 2))
Q = finat.ufl.FiniteElement("Lagrange", cell, 1)
Z = V * Q
# This works in ufl main
mixed_mesh = ufl.MeshSequence([domain]*len(Z.sub_elements))
space = ufl.FunctionSpace(mixed_mesh, Z)
# This works in ufl release, but throws an error in ufl main
space = ufl.FunctionSpace(domain, Z)
```
The error we get in main is
```
----> 1 space = ufl.FunctionSpace(domain, Z)
File /scratch/brubeckmarti/firedrake-venv/src/ufl/ufl/functionspace.py:57, in BaseFunctionSpace.__init__(self, domain, element, label)
55 else:
56 if element.cell != domain_cell:
---> 57 raise ValueError("Non-matching cell of finite element and domain.")
58 if not domain.can_make_function_space(element):
59 raise ValueError(f"Mismatching domain ({domain}) and element ({element}).")
ValueError: Non-matching cell of finite element and domain.
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.