CalcSteadyCavity 函数的数学公式表示
函数描述
CalcSteadyCavity 函数用于计算稳态空泡形状和间隙分布。该函数通过数值方法计算空泡轮廓,并根据模型的几何形状和初始条件,计算模型与空泡之间的间隙。
参数说明
HX0 \text{HX0} HX0 :计算步长。
Scale \text{Scale} Scale :缩放比例。
R n R_n R n :空化器半径。
X agr X_{\text{agr}} X agr :空泡增长系数。
ONETHIRD \text{ONETHIRD} ONETHIRD :1/3的值,用于计算。
S agr S_{\text{agr}} S agr :空泡面积增长系数。
A K 1 A_{K1} A K 1 :空泡面积系数。
w 2 w_2 w 2 :空泡宽度系数。
S G 0 S_{G0} S G 0 :初始空化数。
L c 0 L_{c0} L c 0 :空泡长度系数。
C x 0 C_{x0} C x 0 :轴向力系数。
Δ Rad \Delta_{\text{Rad}} Δ Rad :偏航角(弧度)。
Ψ 0 , Rad \Psi_{0,\text{Rad}} Ψ 0 , Rad :初始攻角(弧度)。
sin ( Ψ 0 ) \sin(\Psi_0) sin ( Ψ 0 ) :初始攻角的正弦值。
cos ( Ψ 0 ) \cos(\Psi_0) cos ( Ψ 0 ) :初始攻角的余弦值。
N con N_{\text{con}} N con :模型锥段数量。
Part \text{Part} Part :模型各锥段的相对位置。
BaseR \text{BaseR} BaseR :模型各锥段的半径。
L mm L_{\text{mm}} L mm :模型长度(毫米)。
Ψ 0 \Psi_0 Ψ 0 :初始攻角(度)。
数学公式表示
1. 初始化参数
缩放比例Scale \text{Scale} Scale 和计算步长HX0 \text{HX0} HX0 :
Scale = self.Scale
\text{Scale} = \text{self.Scale}
Scale = self.Scale
HX0 = self.HX0
\text{HX0} = \text{self.HX0}
HX0 = self.HX0
空化器半径R n R_n R n :
R n = self.Rn
R_n = \text{self.Rn}
R n = self.Rn
空泡增长系数X agr X_{\text{agr}} X agr 和 1/3 的值ONETHIRD \text{ONETHIRD} ONETHIRD :
X agr = self.Xagr
X_{\text{agr}} = \text{self.Xagr}
X agr = self.Xagr
ONETHIRD = self.ONETHIRD
\text{ONETHIRD} = \text{self.ONETHIRD}
ONETHIRD = self.ONETHIRD
空泡面积增长系数S agr S_{\text{agr}} S agr 和空泡面积系数A K 1 A_{K1} A K 1 :
S agr = self.Sagr
S_{\text{agr}} = \text{self.Sagr}
S agr = self.Sagr
A K 1 = self.AK1
A_{K1} = \text{self.AK1}
A K 1 = self.AK1
空泡宽度系数w 2 w_2 w 2 和初始空化数S G 0 S_{G0} S G 0 :
w 2 = self.w2
w_2 = \text{self.w2}
w 2 = self.w2
S G 0 = self.SG0
S_{G0} = \text{self.SG0}
S G 0 = self.SG0
轴向力系数C x 0 C_{x0} C x 0 和偏航角Δ Rad \Delta_{\text{Rad}} Δ Rad :
C x 0 = self.Cx0
C_{x0} = \text{self.Cx0}
C x 0 = self.Cx0
Δ Rad = self.DeltaRad
\Delta_{\text{Rad}} = \text{self.DeltaRad}
Δ Rad = self.DeltaRad
初始攻角Ψ 0 , Rad \Psi_{0,\text{Rad}} Ψ 0 , Rad 和其正弦、余弦值:
Ψ 0 , Rad = self.Psi0Rad
\Psi_{0,\text{Rad}} = \text{self.Psi0Rad}
Ψ 0 , Rad = self.Psi0Rad
sin ( Ψ 0 ) = self.SIN P
\sin(\Psi_0) = \text{self.SIN P}
sin ( Ψ 0 ) = self.SIN P
cos ( Ψ 0 ) = self.COS P
\cos(\Psi_0) = \text{self.COS P}
cos ( Ψ 0 ) = self.COS P
模型锥段数量N con N_{\text{con}} N con 和各锥段的相对位置Part \text{Part} Part :
N con = self.Ncon
N_{\text{con}} = \text{self.Ncon}
N con = self.Ncon
Part = self.Part
\text{Part} = \text{self.Part}
Part = self.Part
各锥段半径BaseR \text{BaseR} BaseR 和模型长度L mm L_{\text{mm}} L mm :
BaseR = self.BaseR
\text{BaseR} = \text{self.BaseR}
BaseR = self.BaseR
L mm = self.Lmm
L_{\text{mm}} = \text{self.Lmm}
L mm = self.Lmm
初始攻角Ψ 0 \Psi_0 Ψ 0 和空泡长度系数L c 0 L_{c0} L c 0 :
Ψ 0 = self.Psi0
\Psi_0 = \text{self.Psi0}
Ψ 0 = self.Psi0
L c 0 = self.Lc0
L_{c0} = \text{self.Lc0}
L c 0 = self.Lc0
2. 计算空泡轮廓
根据缩放比例和步长计算视图中的步数N view N_{\text{view}} N view :
N view = { ⌊ 1.4 ⋅ Scale HX0 ⌋ + 2 if Scale ≥ 0.72 ⌊ 1.4 HX0 ⌋ + 2 otherwise
N_{\text{view}} =
\begin{cases}
\left\lfloor \frac{1.4 \cdot \text{Scale}}{\text{HX0}} \right\rfloor + 2 & \text{if } \text{Scale} \geq 0.72 \\
\left\lfloor \frac{1.4}{\text{HX0}} \right\rfloor + 2 & \text{otherwise}
\end{cases}
N view = { ⌊ HX0 1.4 ⋅ Scale ⌋ + 2 ⌊ HX0 1.4 ⌋ + 2 if Scale ≥ 0.72 otherwise
初始化空泡轮廓的 x 坐标数组X pr X_{\text{pr}} X pr 和半径数组R pr R_{\text{pr}} R pr :
X pr [ 0 ] = 0.0
X_{\text{pr}}[0] = 0.0
X pr [ 0 ] = 0.0
R pr [ 0 ] = R n
R_{\text{pr}}[0] = R_n
R pr [ 0 ] = R n
计算轴对称空泡的主要部分:
for i = 1 to N view − 1 :
\text{for } i = 1 \text{ to } N_{\text{view}} - 1:
for i = 1 to N view − 1 :
X pr [ i ] = ( i − 1 ) ⋅ HX0
X_{\text{pr}}[i] = (i - 1) \cdot \text{HX0}
X pr [ i ] = ( i − 1 ) ⋅ HX0
if X pr [ i ] ≤ R n ⋅ X agr :
\text{if } X_{\text{pr}}[i] \leq R_n \cdot X_{\text{agr}}:
if X pr [ i ] ≤ R n ⋅ X agr :
S = π ⋅ ( R n ⋅ ( 1 + 3 ⋅ X pr [ i ] R n ) ONETHIRD ) 2
S = \pi \cdot \left( R_n \cdot \left(1 + 3 \cdot \frac{X_{\text{pr}}[i]}{R_n} \right)^{\text{ONETHIRD}} \right)^2
S = π ⋅ ( R n ⋅ ( 1 + 3 ⋅ R n X pr [ i ] ) ONETHIRD ) 2
else :
\text{else}:
else :
work = X pr [ i ] − R n ⋅ X agr 2
\text{work} = \frac{X_{\text{pr}}[i] - R_n \cdot X_{\text{agr}}}{2}
work = 2 X pr [ i ] − R n ⋅ X agr
S = S agr + A K 1 ⋅ work ⋅ ( w 2 − work ⋅ S G 0 )
S = S_{\text{agr}} + A_{K1} \cdot \text{work} \cdot (w_2 - \text{work} \cdot S_{G0})
S = S agr + A K 1 ⋅ work ⋅ ( w 2 − work ⋅ S G 0 )
if S ≥ 0 :
\text{if } S \geq 0:
if S ≥ 0 :
R pr [ i ] = S π
R_{\text{pr}}[i] = \sqrt{\frac{S}{\pi}}
R pr [ i ] = π S
I pr = i
I_{\text{pr}} = i
I pr = i
3. 计算实际空泡轮廓和间隙
计算流向坐标系中的升力系数C y C_y C y :
C y = − 0.5 ⋅ C x 0 ⋅ sin ( 2 ⋅ ( Δ Rad + Ψ 0 , Rad ) )
C_y = -0.5 \cdot C_{x0} \cdot \sin(2 \cdot (\Delta_{\text{Rad}} + \Psi_{0,\text{Rad}}))
C y = − 0.5 ⋅ C x 0 ⋅ sin ( 2 ⋅ ( Δ Rad + Ψ 0 , Rad ))
计算空泡轴的弯曲和实际空泡轮廓:
for i = 1 to N view − 1 :
\text{for } i = 1 \text{ to } N_{\text{view}} - 1:
for i = 1 to N view − 1 :
h fi = − C y ⋅ R n ⋅ ( 0.46 − S G 0 + 2 ⋅ X pr [ i ] L c 0 ⋅ R n )
h_{\text{fi}} = -C_y \cdot R_n \cdot \left(0.46 - S_{G0} + 2 \cdot \frac{X_{\text{pr}}[i]}{L_{c0} \cdot R_n}\right)
h fi = − C y ⋅ R n ⋅ ( 0.46 − S G 0 + 2 ⋅ L c 0 ⋅ R n X pr [ i ] )
Y pr2 [ i ] = R pr [ i ] + h fi
Y_{\text{pr2}}[i] = R_{\text{pr}}[i] + h_{\text{fi}}
Y pr2 [ i ] = R pr [ i ] + h fi
Y pr1 [ i ] = − R pr [ i ] + h fi
Y_{\text{pr1}}[i] = -R_{\text{pr}}[i] + h_{\text{fi}}
Y pr1 [ i ] = − R pr [ i ] + h fi
计算模型轮廓和间隙:
if X pr [ i ] ≤ Part [ 0 ] + 5 × 10 − 4 :
\text{if } X_{\text{pr}}[i] \leq \text{Part}[0] + 5 \times 10^{-4}:
if X pr [ i ] ≤ Part [ 0 ] + 5 × 1 0 − 4 :
Y mod2 [ i ] = R n + X pr [ i ] ⋅ BaseR [ 0 ] − R n Part [ 0 ]
Y_{\text{mod2}}[i] = R_n + X_{\text{pr}}[i] \cdot \frac{\text{BaseR}[0] - R_n}{\text{Part}[0]}
Y mod2 [ i ] = R n + X pr [ i ] ⋅ Part [ 0 ] BaseR [ 0 ] − R n
Y mod1 [ i ] = − Y mod2 [ i ]
Y_{\text{mod1}}[i] = -Y_{\text{mod2}}[i]
Y mod1 [ i ] = − Y mod2 [ i ]
if Ψ 0 ≠ 0 :
\text{if } \Psi_0 \neq 0:
if Ψ 0 = 0 :
Y mod2 [ i ] = − X pr [ i ] ⋅ sin ( Ψ 0 ) + Y mod2 [ i ] ⋅ cos ( Ψ 0 )
Y_{\text{mod2}}[i] = -X_{\text{pr}}[i] \cdot \sin(\Psi_0) + Y_{\text{mod2}}[i] \cdot \cos(\Psi_0)
Y mod2 [ i ] = − X pr [ i ] ⋅ sin ( Ψ 0 ) + Y mod2 [ i ] ⋅ cos ( Ψ 0 )
Y mod1 [ i ] = − X pr [ i ] ⋅ sin ( Ψ 0 ) + Y mod1 [ i ] ⋅ cos ( Ψ 0 )
Y_{\text{mod1}}[i] = -X_{\text{pr}}[i] \cdot \sin(\Psi_0) + Y_{\text{mod1}}[i] \cdot \cos(\Psi_0)
Y mod1 [ i ] = − X pr [ i ] ⋅ sin ( Ψ 0 ) + Y mod1 [ i ] ⋅ cos ( Ψ 0 )
H 2 [ i ] = ( Y pr2 [ i ] − Y mod2 [ i ] ) ⋅ L mm
H_2[i] = (Y_{\text{pr2}}[i] - Y_{\text{mod2}}[i]) \cdot L_{\text{mm}}
H 2 [ i ] = ( Y pr2 [ i ] − Y mod2 [ i ]) ⋅ L mm
H 1 [ i ] = ( − Y pr1 [ i ] + Y mod1 [ i ] ) ⋅ L mm
H_1[i] = (-Y_{\text{pr1}}[i] + Y_{\text{mod1}}[i]) \cdot L_{\text{mm}}
H 1 [ i ] = ( − Y pr1 [ i ] + Y mod1 [ i ]) ⋅ L mm
else :
\text{else}:
else :
for j = 1 to N con − 1 :
\text{for } j = 1 \text{ to } N_{\text{con}} - 1:
for j = 1 to N con − 1 :
if X pr [ i ] ≤ Part [ j ] + 5 × 10 − 4 :
\text{if } X_{\text{pr}}[i] \leq \text{Part}[j] + 5 \times 10^{-4}:
if X pr [ i ] ≤ Part [ j ] + 5 × 1 0 − 4 :
Y mod2 [ i ] = BaseR [ j − 1 ] + ( X pr [ i ] − Part [ j − 1 ] ) ⋅ BaseR [ j ] − BaseR [ j − 1 ] Part [ j ] − Part [ j − 1 ]
Y_{\text{mod2}}[i] = \text{BaseR}[j-1] + (X_{\text{pr}}[i] - \text{Part}[j-1]) \cdot \frac{\text{BaseR}[j] - \text{BaseR}[j-1]}{\text{Part}[j] - \text{Part}[j-1]}
Y mod2 [ i ] = BaseR [ j − 1 ] + ( X pr [ i ] − Part [ j − 1 ]) ⋅ Part [ j ] − Part [ j − 1 ] BaseR [ j ] − BaseR [ j − 1 ]
Y mod1 [ i ] = − Y mod2 [ i ]
Y_{\text{mod1}}[i] = -Y_{\text{mod2}}[i]
Y mod1 [ i ] = − Y mod2 [ i ]
if Ψ 0 ≠ 0 :
\text{if } \Psi_0 \neq 0:
if Ψ 0 = 0 :
Y mod2 [ i ] = − X pr [ i ] ⋅ sin ( Ψ 0 ) + Y mod2 [ i ] ⋅ cos ( Ψ 0 )
Y_{\text{mod2}}[i] = -X_{\text{pr}}[i] \cdot \sin(\Psi_0) + Y_{\text{mod2}}[i] \cdot \cos(\Psi_0)
Y mod2 [ i ] = − X pr [ i ] ⋅ sin ( Ψ 0 ) + Y mod2 [ i ] ⋅ cos ( Ψ 0 )
Y mod1 [ i ] = − X pr [ i ] ⋅ sin ( Ψ 0 ) + Y mod1 [ i ] ⋅ cos ( Ψ 0 )
Y_{\text{mod1}}[i] = -X_{\text{pr}}[i] \cdot \sin(\Psi_0) + Y_{\text{mod1}}[i] \cdot \cos(\Psi_0)
Y mod1 [ i ] = − X pr [ i ] ⋅ sin ( Ψ 0 ) + Y mod1 [ i ] ⋅ cos ( Ψ 0 )
H 2 [ i ] = ( Y pr2 [ i ] − Y mod2 [ i ] ) ⋅ L mm
H_2[i] = (Y_{\text{pr2}}[i] - Y_{\text{mod2}}[i]) \cdot L_{\text{mm}}
H 2 [ i ] = ( Y pr2 [ i ] − Y mod2 [ i ]) ⋅ L mm
H 1 [ i ] = ( − Y pr1 [ i ] + Y mod1 [ i ] ) ⋅ L mm
H_1[i] = (-Y_{\text{pr1}}[i] + Y_{\text{mod1}}[i]) \cdot L_{\text{mm}}
H 1 [ i ] = ( − Y pr1 [ i ] + Y mod1 [ i ]) ⋅ L mm
4. 计算模型后部的间隙
如果空泡轮廓的最后一个有效点X pr [ I pr ] X_{\text{pr}}[I_{\text{pr}}] X pr [ I pr ] 大于 1.0005:
H 2 t = Y pr2 [ − 1 ] − Y mod2 [ − 1 ]
H_{2t} = Y_{\text{pr2}}[-1] - Y_{\text{mod2}}[-1]
H 2 t = Y pr2 [ − 1 ] − Y mod2 [ − 1 ]
H 1 t = − Y pr1 [ − 1 ] + Y mod1 [ − 1 ]
H_{1t} = -Y_{\text{pr1}}[-1] + Y_{\text{mod1}}[-1]
H 1 t = − Y pr1 [ − 1 ] + Y mod1 [ − 1 ]
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 def CalcSteadyCavity (self ): """ 计算稳态空泡形状和间隙分布。 参数: HX0: 计算步长。 Scale: 缩放比例。 Rn: 空化器半径。 Xagr: 空泡增长系数。 ONETHIRD: 1/3的值,用于计算。 Sagr: 空泡面积增长系数。 AK1: 空泡面积系数。 w2: 空泡宽度系数。 SG0: 初始空化数。 Lc0: 空泡长度系数。 Cx0: 轴向力系数。 DeltaRad: 偏航角(弧度)。 Psi0Rad: 初始攻角(弧度)。 SIN_P: 初始攻角的正弦值。 COS_P: 初始攻角的余弦值。 Ncon: 模型锥段数量。 Part: 模型各锥段的相对位置。 BaseR: 模型各锥段的半径。 Lmm: 模型长度(毫米)。 Psi0: 初始攻角(度)。 """ Scale = self .Scale HX0 = self .HX0 Rn = self .Rn Xagr = self .Xagr ONETHIRD = self .ONETHIRD Sagr = self .Sagr AK1 = self .AK1 w2 = self .w2 SG0 = self .SG0 Cx0 = self .Cx0 DeltaRad = self .DeltaRad Psi0Rad = self .Psi0Rad SIN_P = self .SIN_P COS_P = self .COS_P Ncon = self .Ncon Part = self .Part BaseR = self .BaseR Lmm = self .Lmm Psi0 = self .Psi0 Lc0 = self .Lc0 if Scale >= 0.72 : Nview = int (1.4 * Scale / HX0) + 2 else : Nview = int (1.4 / HX0) + 2 self .Xpr = np.zeros(Nview) self .Rpr = np.zeros(Nview) self .Ypr1 = np.zeros(Nview) self .Ypr2 = np.zeros(Nview) self .H1 = np.zeros(Nview) self .H2 = np.zeros(Nview) self .Ymod1 = np.zeros(Nview) self .Ymod2 = np.zeros(Nview) Nmod = int (1 / HX0) + 1 self .Ymod1 = np.zeros(Nmod) self .Ymod2 = np.zeros(Nmod) self .Xpr[0 ] = 0.0 self .Rpr[0 ] = Rn self .Ymod2[0 ] = Rn self .Ymod1[0 ] = -Rn self .Ypr2[0 ] = Rn self .Ypr1[0 ] = -Rn self .H1[0 ] = 0.0 self .H2[0 ] = 0.0 for i in range (1 , Nview): self .Xpr[i] = (i - 1 ) * HX0 if self .Xpr[i] <= Rn * Xagr: S = np.pi * (Rn * (1 + 3 * self .Xpr[i] / Rn)**ONETHIRD)**2 else : work = (self .Xpr[i] - Rn * Xagr) / 2 S = Sagr + AK1 * work * (w2 - work * SG0) if S >= 0 : self .Rpr[i] = np.sqrt(S / np.pi) self .Ipr = i Cy = -0.5 * Cx0 * np.sin(2 * (DeltaRad + Psi0Rad)) for i in range (1 , Nview): hfi = -Cy * Rn * (0.46 - SG0 + 2 * self .Xpr[i] / (Lc0 * Rn)) self .Ypr2[i] = self .Rpr[i] + hfi self .Ypr1[i] = -self .Rpr[i] + hfi if self .Xpr[i] <= Part[0 ] + 5e-4 : self .Ymod2[i] = Rn + self .Xpr[i] * (BaseR[0 ] - Rn) / Part[0 ] self .Ymod1[i] = -self .Ymod2[i] if Psi0 != 0 : self .Ymod2[i] = -self .Xpr[i] * SIN_P + self .Ymod2[i] * COS_P self .Ymod1[i] = -self .Xpr[i] * SIN_P + self .Ymod1[i] * COS_P self .H2[i] = (self .Ypr2[i] - self .Ymod2[i]) * Lmm self .H1[i] = (-self .Ypr1[i] + self .Ymod1[i]) * Lmm else : for j in range (1 , Ncon): if self .Xpr[i] <= Part[j] + 5e-4 : self .Ymod2[i] = BaseR[j-1 ] + (self .Xpr[i] - Part[j-1 ]) * (BaseR[j] - BaseR[j-1 ]) / (Part[j] - Part[j-1 ]) self .Ymod1[i] = -self .Ymod2[i] if Psi0 != 0 : self .Ymod2[i] = -self .Xpr[i] * SIN_P + self .Ymod2[i] * COS_P self .Ymod1[i] = -self .Xpr[i] * SIN_P + self .Ymod1[i] * COS_P self .H2[i] = (self .Ypr2[i] - self .Ymod2[i]) * Lmm self .H1[i] = (-self .Ypr1[i] + self .Ymod1[i]) * Lmm break if self .Xpr[self .Ipr] >= 1.0005 : self .H2t = self .Ypr2[-1 ] - self .Ymod2[-1 ] self .H1t = -self .Ypr1[-1 ] + self .Ymod1[-1 ]