# Initial conditions for mixed elements with vector and scalar elements

It is a bit hard for me to decipher your issue.
However, I think you want something along these lines (no pun intended):

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

nodes = np.array([[.0, 0.], [0.5, 0.], [0.25,0.3],
[1., 0.0], [0.75, -0.2]], dtype=np.float64)
connectivity = np.array([[0, 1, 2], [1, 3, 4]], dtype=np.int64)
c_el = ufl.Mesh(basix.ufl.element("Lagrange", "interval", 2, shape=(nodes.shape[1],)))
domain = dolfinx.mesh.create_mesh(MPI.COMM_SELF, connectivity, nodes, c_el)

with dolfinx.io.VTXWriter(domain.comm, "test.bp", domain, engine="BP4") as bp:
bp.write(0.0)

V1 = domain.ufl_domain().ufl_coordinate_element()
V2 = basix.ufl.element("CG", domain.basix_cell(), 2)

ME2 = dolfinx.fem.functionspace(domain, basix.ufl.mixed_element([V1, V2]))

uv = dolfinx.fem.Function(ME2)
uv.sub(0).interpolate(lambda x: (-0.1+0.2*x[0], +0.3+0.3*x[1]))

# Permute dofmap
V_geom = dolfinx.fem.functionspace(domain, V1)
u_geom = dolfinx.fem.Function(V_geom)
np.testing.assert_allclose(domain.geometry.x, V_geom.tabulate_dof_coordinates(), atol=1e-13)
u_geom.interpolate(uv.sub(0))

with dolfinx.io.VTXWriter(domain.comm, "test2.bp", [u_geom], engine="BP4") as bp:
bp.write(0.0)

domain.geometry.x[:, :2] += u_geom.x.array.reshape(-1, domain.geometry.dim)

with dolfinx.io.VTXWriter(domain.comm, "test3.bp", domain, engine="BP4") as bp:
bp.write(0.0)
``````

yielding