I am attempting to accurately visualize some CFD data using Mayavi's flow function. I have six 100x100x100 arrays (X, Y, Z, U, V, W), pertaining to the positions and velocities of the particles being analyzed. These were created from single-column arrays with numpy.meshgrid.
The plot comes out nicely when I input three of the arrays, such as U, V, and W, but in this case the visualization is lacking the rest of the data.
When I input all six arrays, the 3D plot comes out as a straight line.
My question is: how can I input all six arrays and get a working Flow plot? More specifically, can someone explain the following, an excerpt from the Flow documentation?
"the positions of the arrows are assumed to be the indices of the corresponding points in the (u, v, w) arrays."
The Flow documentation reads:
The x, y and z arrays are then supposed to have been generated by numpy.mgrid...
So, in order to succeed plotting with the Flow function using six input arrays, one must create the first three using numpy.mgrid
With X, Y, and Z already designated as 1-dimensional arrays, this is what my code looks like this:
Xgrid, Ygrid, Zgrid = np.mgrid[X[1]:X[-1]:50j,Y[1]:Y[-1]:50j,Z[1]:Z[-1]:50j]
Note: numpy.mgrid
is different than numpy.meshgrid
.