I’m a bit confused on the changes between v0.8 to v0.9 in regards to the shape of functions defined on mixed function spaces. Here’s a MWE:
from dolfinx import fem,mesh
from mpi4py import MPI
import ufl
import basix
a = ufl.as_tensor([[1,2,3],[4,5,6],[7,8,9]])
b = ufl.as_tensor([1,2,3])
print(f'2nd order tensor shape: {a.ufl_shape}')
print(f'1st order tensor shape: {b.ufl_shape}')
c = ufl.dot(a,b)
print(f'inner product shape: {c.ufl_shape}')
msh = mesh.create_unit_interval(MPI.COMM_WORLD,10)
U = fem.functionspace(msh,("DG", 0,(6,3)))
u = fem.Function(U)
print(f'function shape: {u.ufl_shape}')
d = ufl.dot(u,b)
print(f'inner product shape: {d.ufl_shape}')
e = basix.ufl.element('CG',msh.topology.cell_name(),1,shape=(6,3))
T = fem.functionspace(msh,basix.ufl.mixed_element(2*[e]))
t = fem.Function(T)
t1,t2 = t.split()
print(f'function shape: {t.ufl_shape}')
print(f'sub-function shape: {t1.ufl_shape}')
d = ufl.dot(t1,b)
print(f'inner product shape: {u.ufl_shape}')
The result in v0.8 is:
2nd order tensor shape: (3, 3)
1st order tensor shape: (3,)
inner product shape: (3,)
function shape: (6, 3)
inner product shape: (6,)
function shape: (36,)
sub-function shape: (6, 3)
inner product shape: (6, 3)
And in v0.9:
2nd order tensor shape: (3, 3)
1st order tensor shape: (3,)
inner product shape: (3,)
function shape: (6, 3)
inner product shape: (6,)
function shape: (36,)
sub-function shape: (18,)
Traceback (most recent call last):
File "...", line 33, in <module>
d = ufl.dot(t1,b)
File ".../ufl/operators.py", line 225, in dot
return Dot(a, b)
File ".../ufl/tensoralgebra.py", line 217, in __new__
raise ValueError("Dimension mismatch in dot product.")
ValueError: Dimension mismatch in dot product.
Is this expected and if so, what would be the correct syntax?