FEniCS/basix

Inconsistent default value size

Closed this issue · 0 comments

The following assert fails:

from basix import ufl_wrapper
import ufl

k = 1
gdim = 2
family = "Lagrange"
cell_type = "interval"

# Create the same element with Basix and UFL
ele_0 = ufl_wrapper.create_vector_element(family, cell_type, k, gdim=gdim)
ele_1 = ufl.VectorElement(family, ufl.Cell(cell_type, geometric_dimension=gdim), k)

assert ele_0.value_size == ele_1.value_size()

By default, UFL seems to use the geometric dimension for the value size, whilst Basix uses the topological dimension. I think using the geometric dimension is probably the most sensible default, but they should be consistent at least.

Should just be a simple change here: https://github.com/FEniCS/basix/blob/main/python/basix/ufl_wrapper.py#L1131