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:
Code:
#mesh is my original mesh, mesh_uniform is my uniform mesh.
#DEFINING FINITE ELEMENT SPACE
V = VectorH1(mesh, order=poly)
# Pressure Space
Q = H1(mesh, order=poly-1)
# Mixed Finite Element space
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)
gfu1.Load(sol_file)
gfu2.components[0].Set(gfu1.components[0])
velocity2 = gfu2.components[0]
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.
Code:
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):
Code:
[[-5.38850269e-05 8.02748156e-07]
[ 3.10929498e-05 -1.96726351e-07]] point = (0.5, 1.0)
[[-6.66841541e-05 6.56785237e-09]
[ 3.10929498e-05 -1.96726351e-07]] point = (0.44999999999999996, 1.0)
[[-6.12298336e-05 -1.44793065e-05]
[ 3.10929498e-05 -1.96726351e-07]] point = (0.3999999999999999, 1.0)
[[-3.04427322e-05 -1.85570629e-05]