使用Scipj进行3D映射的问题
我是想使用scip将粗网格模型的压力载荷映射到细网格上去。因为ANSYS本身找不到方法,所以只能曲线救国用Python在这个网站上我找到了相关的代码https://www.
但是,我替换成自己的数据的时候报错
代码和数据如下,求高手指点错误在哪里。 python水平不高,见笑了
2023-07.zip
(4.49 KB)
当然不一定非要用scip,其他手段可以实现也可以。提前谢过了
程序代码:
import scipy.interpolate as reg_grid import numpy as np # # define an interpolating function RGI = reg_grid.RegularGridInterpolator # #Input 3D coordinates x1 = np.loadtxt(r"D:\\x1.txt") y1 = np.loadtxt(r"D:\\y1.txt") z1 = np.loadtxt(r"D:\\z1.txt") # in three dimensions, a point is a number (coordinates) that are treated collectively as a single object. points = (x1, y1 ,z1) # print(type(points)) # Input Pressure P1 = (np.loadtxt(r"D:\\p1.txt")) # print(type(P1)) # # # # make the interpolator rgi = RGI(points , values=P1, method='linear') pnt = (2.5, 3.5, 1.5) print (rgi(pnt)) #