Hi. I'm working on the following MixedElement code, where I solve an advection-diffusion equation problem and plot velocity, pressure and concentration.
I want to plot those scalar and vector fields on Matplotlib, using quiver, streamline and scatter, so I need the answers organized on arrays for just do "quiver(X,Y, Vx, Vy)".
To plot with Matplotlib, the Functions and Coordinates must be converted to NumPy arrays X, Y, Vx, Vy in a organized way.
The trivial way explained on tutorial "ans.vector().array()" needs the dof to vertex map. But the usual methods such as dof_to_vertex_map(U) doesn't work on MixedFunctionSpaces.
So, I'm having trouble to understand how to solve this mapping and ploting problem. Could someone help me?
I am very grateful for your attention and for any help.
mesh = generate_mesh(channel, res)
FE_V = FiniteElement('P', 'triangle', 2)
FE_P = FiniteElement('P', 'triangle', 1)
elem = MixedElement([FE_P, FE_V, FE_V, FE_P])
U = FunctionSpace(mesh, elem)
[...]
solve(F==0, ans, BC)
pp,ux,uy,aa = split(ans1)
uu = as_vector([ux,uy])
plot(pp, title = 'Pressure')
plot(uu, title = 'Velocity')
plot(aa, title = 'Concentration')
interactive()