Hi all,
Using the most recent version of dolfinx on WSL2 Ubuntu, I run the following code:
from ufl import SpatialCoordinate, FiniteElement, MixedElement, TestFunctions, split
from dolfinx import mesh
from dolfinx.fem import FunctionSpace, Function, Constant
from mpi4py import MPI
import numpy
def y0_init(x):
values = numpy.zeros((1, x.shape[1]))
values[0] = 1.0
return values
def y1_init(x):
values = numpy.zeros((1, x.shape[1]))
values[0] = 2.0
return values
msh = mesh.create_interval(MPI.COMM_WORLD, 10, points=(0, 1))
x = SpatialCoordinate(msh)
CG1_elem = FiniteElement("CG", msh.ufl_cell(), 1)
ME_elem = MixedElement([CG1_elem, CG1_elem])
ME = FunctionSpace(msh, ME_elem)
y = Function(ME)
y.sub(0).interpolate(y0_init)
y.sub(1).interpolate(y1_init)
assert (y.sub(0).x.array != y.sub(1).x.array).any()
and the assert fails - the arrays are equal.
Why is this happening?