I have a 2nd-order displacement field, u_V2
, defined over my mesh. I want to move the mesh using this u_V2
vector, however it seems that the ALE.move()
function requires a 1st-order vector in order to move the mesh vertices.
V1 = VectorFunctionSpace(mesh, "CG", 1) # first-order vector space
V2 = VectorFunctionSpace(mesh, "CG", 2) # second-order vector space
...
u_V2 = Function(V2) # this eventually gets filled with non-zero values
...
ALE.move(mesh, u_V2) # this does not work
I know that I can use the project()
function to obtain a vector in the V1
space:
u_V1 = project(u_V2, V1)
ALE.move(mesh, u_V1)
However, using the project()
function is a last resort. I would prefer instead to take the vertex values out of u_V2
and feed them into u_V1
. I did try the following:
u_V1 = Function(V1)
u_V1.vector()[:] = u_V2.compute_vertex_values()
But in parallel, it seems that u_V1.vector()
and u_V2.compute_vertex_values()
have different sizes. I'm also wary that there will be issues with DOF mapping in the above approach.
Does anybody have a suggestion for this issue?