Python Abaqus:序列中的索引超出范围

问题描述

我写了一个半球的代码,其中有一个洞。当我在abaqus中运行代码时,它会显示一些有关索引序列超出范围的警告。我已经尝试了一切,但是找不到错误。有人可以帮忙吗。

代码的一部分: 在此处输入代码

t = 1.0; # shell thickness
Re = 40.0 # radius 
Ri = 5.0 # hole radius
o = 30; # number of points to define cap
A = 10.0; # cap apex height
d = 1.8*A # actuated distance
th = 2*math.pi;
meshsize=1.3;

  

m=mdb.models['Model-1']
s=mdb.models['Model-1'].ConstrainedSketch(name='__profile__',sheetSize=200.0)
s.ConstructionLine(point1=(0.0,-100.0),point2=(0.0,100.0))
s.FixedConstraint(entity=s.geometry[2])
# sphere cap
n = np.linspace(start=1,stop=th,num=128,endpoint=False)
x = [Re*(math.cos(th*float(i)))+(Ri+(float(i))) for i in (n)];
y = [Re*(math.sin(th*float(i))) for i in (n)];
w = np.int_(x)
z = np.int_(y)
points=[];
l = len(n);
for i in (n):
    points.append([w[i],z[i]])
    
s.Spline(points=points)
p=m.Part(dimensionality=THREE_D,name='structure',type=DEFORMABLE_BODY)
p.BaseShellRevolve(angle=360.0,flipRevolveDirection=OFF,sketch=s)
del s

解决方法

这部分代码可以在我的机器上正常运行。

为什么要用样条曲线逼近圆弧?我建议您手动创建几何,然后检查生成的abaqus.rpy文件中的Python命令。