Mapping of results to mesh nodes, debugging of dolfinx implentation of shell formulation

Please note that you can also interpolate from one space to another,i.e.

from dolfinx import fem, mesh as msh
from mpi4py import MPI
import ufl
mesh = msh.create_unit_cube(MPI.COMM_WORLD, 1,1,1)
Ue = ufl.VectorElement("Lagrange", mesh.ufl_cell(), 2,dim=3)
Te = ufl.VectorElement("CR", mesh.ufl_cell(), 1, dim=3)
V = fem.FunctionSpace(mesh, ufl.MixedElement([Ue, Te]))
v = fem.Function(V)
v.sub(0).interpolate(lambda x: (x[0], x[1], x[2]))
v.sub(1).interpolate(lambda x: (x[0], x[1],x[2]))

VCG1 = fem.VectorFunctionSpace(mesh, ("CG", 1))
u = fem.Function(VCG1)
u.interpolate(v.sub(0))


coords = VCG1.tabulate_dof_coordinates()
for i, coord in enumerate(coords):
    print("Coord ", coord, "Value: ", end="")
    for b in range(VCG1.dofmap.bs):
        print(u.x.array[i*VCG1.dofmap.bs+b],end=" ")
    print("")
3 Likes