Hello. I have a GridFunction where my solution at a timestep is defined for my mesh (in a .sol file). I projected this data on a second uniform mesh successfully by doing the following:
#mesh is my original mesh, mesh_uniform is my uniform mesh.
#DEFINING FINITE ELEMENT SPACE
V = VectorH1(mesh, order=poly)
Q = H1(mesh, order=poly-1)
fes = FESpace([V, Q])
#For uniform grid
V_2 = VectorH1(mesh_uniform, order=poly)
Q_2 = H1(mesh_uniform, order=poly-1)
fes_2 = FESpace([V_u,Q_u])
gfu1 = GridFunction(fes)
gfu2 = GridFunction(fes_2)
velocity2 = gfu2.components[/code]
When I visualize velocity2, which is my velocity data projected on the uniform mesh, I see the expected results.
Now that I know I have the correct data stored in gfu2, how do I access the actual velocity/pressure data and their corresponding points? I’ve been doing the following, but got confused because what I thought was the velocity turned out to be a 2x2 vector, I was expecting a 2x1 for Ux, Uy.
for p in mesh_uniform.vertices:
print(velocity2(mesh_uniform(p.point)), "point = ", p.point)
This gives the following output (just pasted a few of many):
[ 3.10929498e-05 -1.96726351e-07]] point = (0.5, 1.0)
[ 3.10929498e-05 -1.96726351e-07]] point = (0.44999999999999996, 1.0)
[ 3.10929498e-05 -1.96726351e-07]] point = (0.3999999999999999, 1.0)