Python2.7:使用六个输入数组的Mayavi流函数

2024-09-24 02:13:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用Mayavi的流函数精确地可视化一些CFD数据。我有六个100x100x100数组(X,Y,Z,U,V,W),与被分析粒子的位置和速度有关。它们是从单列数组中创建的numpy.meshgrid. 在

当我输入三个数组(如U、V和W)时,图会很好地显示出来,但在本例中,可视化缺少其余的数据。enter image description here

当我输入所有六个数组时,3D打印出来的是一条直线。在

enter image description here

我的问题是:如何输入所有六个数组并得到一个工作流程图?更具体地说,有人能解释一下下面的内容吗?Flow documentation的节选?在

"the positions of the arrows are assumed to be the indices of the corresponding points in the (u, v, w) arrays."


Tags: ofthe数据函数numpy可视化粒子数组
1条回答
网友
1楼 · 发布于 2024-09-24 02:13:59

流程文档如下:

The x, y and z arrays are then supposed to have been generated by numpy.mgrid...

因此,为了使用六个输入数组成功地绘制Flow函数,必须使用numpy.mgrid创建前三个

由于X、Y和Z已经指定为一维数组,因此我的代码如下所示:

Xgrid, Ygrid, Zgrid = np.mgrid[X[1]:X[-1]:50j,Y[1]:Y[-1]:50j,Z[1]:Z[-1]:50j]

注意:numpy.mgrid与{}不同。在

相关问题 更多 >