注册 登录
编程论坛 Python论坛

使用Scipj进行3D映射的问题

xiangyue0510 发布于 2023-07-08 10:22, 728 次点击
我是想使用scip将粗网格模型的压力载荷映射到细网格上去。因为ANSYS本身找不到方法,所以只能曲线救国用Python
只有本站会员才能查看附件,请 登录

在这个网站上我找到了相关的代码https://www.
但是,我替换成自己的数据的时候报错
只有本站会员才能查看附件,请 登录

代码和数据如下,求高手指点错误在哪里。 python水平不高,见笑了
只有本站会员才能查看附件,请 登录

当然不一定非要用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))
#
1 回复
#2
xiangyue05102023-07-21 10:12
搞明白了,用rbf函数就可以。
1