模型半径计算

函数描述

计算模型半径,步长HXL=0.005\frac{HX}{L} = 0.005

参数

  • LmmL_{\text{mm}}:模型总长度(mm)。
  • RnmmR_{\text{nmm}}:空化器半径(mm)。
  • Part\text{Part}:每节的无量纲长度。
  • BaseR\text{BaseR}:每节末端半径的无量纲数。
  • NconN_{\text{con}}:模型节数。

返回值

  • Rmstr\text{Rmstr}:模型半径数组(无量纲)。

计算公式

1. 初始化变量

  • 模型总长LmmL_{\text{mm}}
  • 空化器半径RnmmR_{\text{nmm}}
  • 描述部件位置的数组Part\text{Part}(每节的无量纲长度)
  • 每一节末端的无量纲半径BaseR\text{BaseR}
  • 模型节数NconN_{\text{con}}

2. 计算模型半径

初始化模型半径数组Rmstr\text{Rmstr}
Rmstr=zeros(201)\text{Rmstr} = \text{zeros}(201)

计算模型总长与空化器半径的比值:
work=LmmRnmm\text{work} = \frac{L_{\text{mm}}}{R_{\text{nmm}}}

计算每一步的模型半径:
xi=(i1)×0.005for i=1,2,,201\text{xi} = (i - 1) \times 0.005 \quad \text{for } i = 1, 2, \ldots, 201

对于每一步ii

  • 如果xiPart[0]+0.0025\text{xi} \leq \text{Part}[0] + 0.0025
    Rmstr[i]=1.0+xi×(BaseR[0]×work1.0Part[0])\text{Rmstr}[i] = 1.0 + \text{xi} \times \left( \frac{\text{BaseR}[0] \times \text{work} - 1.0}{\text{Part}[0]} \right)
  • 否则:
    Rmstr[i]=BaseR[j1]×work+(xiPart[j1])×(BaseR[j]BaseR[j1]Part[j]Part[j1])×work\text{Rmstr}[i] = \text{BaseR}[j - 1] \times \text{work} + (\text{xi} - \text{Part}[j - 1]) \times \left( \frac{\text{BaseR}[j] - \text{BaseR}[j - 1]}{\text{Part}[j] - \text{Part}[j - 1]} \right) \times \text{work}
    其中jj是满足xiPart[j]+0.0025\text{xi} \leq \text{Part}[j] + 0.0025的最小索引。

3. 返回值

返回无量纲半径数组Rmstr\text{Rmstr}

python 代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
def ModelRadii(self):
# Lmm, Rnmm, Part, BaseR, Ncon
"""
计算模型半径,步长 HX / L = 0.005。

参数:
Lmm (float): 模型总长度(mm)。
Rnmm (float): 空化器半径(mm)。
Part (list of float): 每节的无量纲长度。
BaseR (list of float): 每节末端半径的无量纲数。
Ncon (int): 模型节数。

返回:
Rmstr (list of float): 模型半径数组(无量纲)。
"""
# 模型总长
Lmm = self.Lmm
# 空化器半径
Rnmm = self.Rnmm
# 描述部件位置的数组,每节的无量纲长度
Part = self.Part
# 每一节末端的无量纲半径
BaseR = self.BaseR
# 模型节数
Ncon = self.Ncon

# 初始化模型半径数组
# 这里不知道为啥要分成200份,有啥说法喵?
# 喵喵不解,喵喵麻木,喵喵默默记录
Rmstr = np.zeros(201)
work = Lmm / Rnmm # 模型总长除以空化器半径

# 计算每一步的模型半径
for i in range(1, 201):
xi = (i - 1) * 0.005 # 步长为0.005
if xi <= Part[0] + 0.0025:
# 第一节锥形部分
Rmstr[i] = 1.0 + xi * (BaseR[0] * work - 1.0) / Part[0]
else:
# 其他节部分
for j in range(1, Ncon):
if xi <= Part[j] + 0.0025:
Rmstr[i] = BaseR[j - 1] * work + (xi - Part[j - 1]) * (BaseR[j] - BaseR[j - 1]) * work / (
Part[j] - Part[j - 1])
break
# 返回无量纲半径
self.Rmstr = Rmstr