ffseval 0.4.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. FFSeval/FFS.py +1799 -0
  2. FFSeval/Kriging.py +100 -0
  3. FFSeval/__init__.py +0 -0
  4. FFSeval/data/J-1-b-1.csv +24 -0
  5. FFSeval/data/J-1-b-2.csv +24 -0
  6. FFSeval/data/J-1-b.csv +48 -0
  7. FFSeval/data/J-1-d.csv +24 -0
  8. FFSeval/data/J-2-a.csv +140 -0
  9. FFSeval/data/J-2-b.csv +90 -0
  10. FFSeval/data/J-2-f.csv +88 -0
  11. FFSeval/data/J-2-g-a.csv +88 -0
  12. FFSeval/data/J-2-g-b.csv +63 -0
  13. FFSeval/data/J-2-h.csv +66 -0
  14. FFSeval/data/J-2-k-a-1.csv +71 -0
  15. FFSeval/data/J-2-k-a-2.csv +54 -0
  16. FFSeval/data/J-2-k-b.csv +130 -0
  17. FFSeval/data/J-2-m.csv +224 -0
  18. FFSeval/data/J-7-a.csv +19 -0
  19. FFSeval/data/K-1-a-2.csv +136 -0
  20. FFSeval/data/K-1-a-3.csv +80 -0
  21. FFSeval/data/K-1-b-2.csv +15 -0
  22. FFSeval/data/K-1-c-2.csv +16 -0
  23. FFSeval/data/K-1-e-2-3-A.csv +13 -0
  24. FFSeval/data/K-1-e-2-3-B.csv +13 -0
  25. FFSeval/data/K-1-e-2.csv +50 -0
  26. FFSeval/data/K-2-a-1-F0A.csv +18 -0
  27. FFSeval/data/K-2-a-1-F0B.csv +18 -0
  28. FFSeval/data/K-2-a-1-F1A.csv +18 -0
  29. FFSeval/data/K-2-a-1-F1B.csv +18 -0
  30. FFSeval/data/K-2-a-1-F2A.csv +18 -0
  31. FFSeval/data/K-2-a-1-F2B.csv +18 -0
  32. FFSeval/data/K-2-a-1-F3A.csv +18 -0
  33. FFSeval/data/K-2-a-1-F3B.csv +18 -0
  34. FFSeval/data/K-2-a-1.csv +144 -0
  35. FFSeval/data/K-2-a-2-F0A.csv +20 -0
  36. FFSeval/data/K-2-a-2-F0B.csv +20 -0
  37. FFSeval/data/K-2-a-2-F1A.csv +20 -0
  38. FFSeval/data/K-2-a-2-F1B.csv +20 -0
  39. FFSeval/data/K-2-a-2-F2A.csv +20 -0
  40. FFSeval/data/K-2-a-2-F2B.csv +20 -0
  41. FFSeval/data/K-2-a-2-F3A.csv +20 -0
  42. FFSeval/data/K-2-a-2-F3B.csv +20 -0
  43. FFSeval/data/K-2-a-2.csv +160 -0
  44. FFSeval/data/K-2-b-1.csv +50 -0
  45. FFSeval/data/K-2-c-1-F0A.csv +18 -0
  46. FFSeval/data/K-2-c-1-F0B.csv +18 -0
  47. FFSeval/data/K-2-c-1-F1A.csv +18 -0
  48. FFSeval/data/K-2-c-1-F1B.csv +18 -0
  49. FFSeval/data/K-2-c-1-F2A.csv +18 -0
  50. FFSeval/data/K-2-c-1-F2B.csv +18 -0
  51. FFSeval/data/K-2-c-1-F3A.csv +18 -0
  52. FFSeval/data/K-2-c-1-F3B.csv +18 -0
  53. FFSeval/data/K-2-c-1.csv +153 -0
  54. FFSeval/data/K-2-d.csv +50 -0
  55. FFSeval/data/K-2-e-1.csv +56 -0
  56. FFSeval/data/K-2-e-3.csv +160 -0
  57. FFSeval/data/K-2-f-1.csv +550 -0
  58. FFSeval/data/K-2-f-2.csv +200 -0
  59. FFSeval/data/K-2-f-3.csv +91 -0
  60. FFSeval/data/K-2-h-1.csv +50 -0
  61. FFSeval/data/K-2-i-1.csv +550 -0
  62. FFSeval/data/K-2-i-2.csv +200 -0
  63. FFSeval/data/K-2-j.csv +50 -0
  64. FFSeval/data/K-2-k-1.csv +96 -0
  65. FFSeval/data/K-2-k-4.csv +264 -0
  66. FFSeval/data/K-3-a.csv +60 -0
  67. FFSeval/data/K-3-b-1.csv +48 -0
  68. FFSeval/data/K-3-c-1.csv +10 -0
  69. FFSeval/data/K-3-c-2.csv +10 -0
  70. FFSeval/data/K-3-c-3.csv +10 -0
  71. FFSeval/data/K-3-c.csv +42 -0
  72. FFSeval/data/K-4-a-1.csv +64 -0
  73. FFSeval/data/K-4-a-2.csv +16 -0
  74. FFSeval/data/K-4-b-1.csv +16 -0
  75. FFSeval/data/K-4-d.csv +16 -0
  76. FFSeval/data/K-5-b-1.csv +8 -0
  77. FFSeval/data/K-5-b-2.csv +13 -0
  78. FFSeval/data/K-5-b-3.csv +42 -0
  79. FFSeval/data/K-6-a.csv +60 -0
  80. FFSeval/data/K-6-b.csv +60 -0
  81. FFSeval/data/K-6-c.csv +52 -0
  82. FFSeval/data/Rho.csv +14 -0
  83. ffseval-0.4.5.dist-info/LICENSE +9 -0
  84. ffseval-0.4.5.dist-info/METADATA +64 -0
  85. ffseval-0.4.5.dist-info/RECORD +87 -0
  86. ffseval-0.4.5.dist-info/WHEEL +5 -0
  87. ffseval-0.4.5.dist-info/top_level.txt +1 -0
FFSeval/FFS.py ADDED
@@ -0,0 +1,1799 @@
1
+ import numpy as np
2
+ from scipy.optimize import fsolve
3
+ import matplotlib.pyplot as plt
4
+ class Base:
5
+ def __init__(self):
6
+ self.title=None
7
+ self.data=None
8
+ self.res=None
9
+ self.refer=None
10
+ def SetTitle(self,title:str)->None:
11
+ self.title=title
12
+ def Title(self)->str:
13
+ return self.title
14
+ def SetData(self,data:dict):
15
+ self.data=data
16
+ def GetData(self):
17
+ return self.data
18
+ def SetRes(self,res:dict):
19
+ self.res=res
20
+ def GetRes(self):
21
+ return self.res
22
+ def SetRefer(self,refer:str):
23
+ self.refer=refer
24
+ def GetRefer(self):
25
+ return self.refer
26
+ def CalcKc(self):
27
+ nu=self.data['Nu']
28
+ E=self.data['E']
29
+ j1c=self.data['J1c']
30
+ Ed=E/(1-nu*nu)
31
+ return np.sqrt(Ed*j1c)
32
+ def Option1(self,Kr,Lr):
33
+ kk=(1-0.14*Lr*Lr)*(0.3+0.7*np.exp(-0.65*Lr**6))
34
+ flag=False
35
+ if Kr<kk:
36
+ flag=True
37
+ return flag,kk
38
+ def DrawOption1(self,Lr0,Kr0,Su,Sy):
39
+ """
40
+ R6法-Rev.3のOption1破壊評価曲線の描画
41
+ Lr0,Kr0描画点
42
+ Su:引張強さ
43
+ Sy:降伏強さ
44
+ """
45
+ compute_Kr = lambda Lr: (1 - 0.14 * Lr**2) * (0.3 + 0.7 * np.exp(-0.65 * Lr**6))
46
+ Sf=(Sy+Su)/2
47
+ Lrmax=Sf/Sy
48
+ Krmax=compute_Kr(Lrmax)
49
+ # Lrの範囲を生成
50
+ Lr_values = np.linspace(0, Lrmax, 500)
51
+ Kr_values = compute_Kr(Lr_values)
52
+
53
+ # グラフ描画
54
+ plt.figure(figsize=(8, 5))
55
+ plt.plot(Lr_values, Kr_values,color='blue')
56
+ plt.plot(Lr0, Kr0, 'ro') # 赤い点をプロット
57
+ plt.plot([Lrmax,Lrmax],[0,Krmax],color='blue')
58
+ plt.ylim(0,1.2)
59
+ plt.xlabel('Lr',fontsize=16)
60
+ plt.ylabel('Kr',fontsize=16)
61
+ plt.grid(True)
62
+ plt.legend()
63
+ plt.tight_layout()
64
+ plt.show()
65
+ def Margin(self,K:float,L:float)->dict:
66
+ '''
67
+ 評価点(L,K)について,Option1曲線に対する安全裕度を評価する
68
+ 計算する値
69
+ (L0,K0): 原点と評価点の延長線とOption1曲線との交点
70
+ margin: 安全裕度 1以下であれば安全
71
+ '''
72
+
73
+ # Krの定義
74
+ Kr1 = lambda Lr: (1 - 0.14 * Lr**2) * (0.3 + 0.7 * np.exp(-0.65 * Lr**6))
75
+ Kr2 = lambda Lr:(K / L) * Lr
76
+ equation=lambda Lr:Kr1(Lr) - Kr2(Lr)
77
+ # 初期値の推測(範囲によって複数回試すと良い)
78
+ initial_guess = 0.5
79
+ solution = fsolve(equation, initial_guess)
80
+ res={}
81
+ res['L0']=solution[0]
82
+ res['K0']=Kr1(solution[0])
83
+ res['margin']=K/res['K0']
84
+ return res
85
+ def RolfeBarsom(self,Cv,Sy)->float:
86
+ #Cv=self.data['Cv']
87
+ #Sy=self.data['Sy']
88
+ cc=np.array(Cv)
89
+ c=0.6478*(cc/Sy-0.0098)
90
+ K1c=np.sqrt(c)*Sy
91
+ return K1c
92
+ def JR(self,C:float,m:float,da:float)->float:
93
+ return C*da**m
94
+ class Fatigue:
95
+ '''
96
+ JSME維持規格における炭素鋼および低合金鋼の大気中における疲労亀裂進展特性
97
+ '''
98
+ def __init__(self,cls,data,pfm=False,cov=0.1):
99
+ self.cls=cls
100
+ self.cls.SetData(data)
101
+ self.data=data
102
+ self.pfm=pfm #PFM計算のときTrue
103
+ self.cov=cov #PFM計算のとき,係数Cのcov
104
+ def dadN(self,a,c,Pmin,Pmax):
105
+ self.data['a']=a
106
+ self.data['c']=c
107
+ self.data['P']=Pmin
108
+ self.cls.SetData(self.data)
109
+ self.cls.Calc()
110
+ resMin=self.cls.GetRes()
111
+ self.data['P']=Pmax
112
+ self.cls.SetData(self.data)
113
+ self.cls.Calc()
114
+ resMax=self.cls.GetRes()
115
+ dKA=resMax['KA']-resMin['KA']
116
+ dKB=resMax['KB']-resMin['KB']
117
+ da=self.FatigueSteel(dKA)
118
+ dc=self.FatigueSteel(dKB)
119
+ return da,dc,resMax
120
+ def FatigueSteel(self,dK):
121
+ n=3.07
122
+ da=self.C*dK**n
123
+ return da
124
+ def EvalAC(self,a0,c0,Pmin,Pmax,R,n):
125
+ S=25.72*(2.88-R)**(-3.07)
126
+ C=3.88e-9*S
127
+ if self.pfm:#PFM計算のときには,正規乱数を発生してCに割り当てる
128
+ mean=C
129
+ std_dev=C*self.cov
130
+ C=np.random.normal(mean,std_dev)
131
+ self.C=C
132
+ self.data['a']=a0
133
+ self.data['c']=c0
134
+ self.data['P']=Pmax
135
+ self.cls.SetData(self.data)
136
+ self.cls.Calc()
137
+ res0=self.cls.GetRes()
138
+ a=a0
139
+ c=c0
140
+ for i in range(n):
141
+ da,dc,resMax=self.dadN(a,c,Pmin,Pmax)
142
+ a += da/1000
143
+ c += dc/1000
144
+ crack={'a':a,
145
+ 'c':c}
146
+ res1=resMax
147
+ return res0,res1,crack
148
+
149
+
150
+ class Treat:
151
+ def Set(self,spec:str):
152
+ '''
153
+ 対象とする解析記号名を文字列でセット
154
+ '''
155
+ spec2=spec.replace("-","_")
156
+ df=self.Registered()
157
+ dd=df[spec2[0]]
158
+ if spec2 not in dd:
159
+ print(spec+' is not registered yet!')
160
+ return
161
+ cls=globals()[spec2]
162
+ instance=cls()
163
+ return instance
164
+ def Registered(self):
165
+ df={'J':[
166
+ 'J_2_k_a',
167
+ 'J_2_k_b',
168
+ 'J_7_a'
169
+ ],
170
+ 'K':[
171
+ 'K_1_a_1',
172
+ 'K_1_a_2',
173
+ 'K_1_a_3',
174
+ 'K_1_b_1',
175
+ 'K_1_c_1',
176
+ 'K_1_d_1',
177
+ 'K_1_d_2',
178
+ 'K_1_e_1',
179
+ 'K_1_e_2',
180
+ 'K_1_e_3',
181
+ 'K_2_a_1',
182
+ 'K_2_a_2',
183
+ 'K_2_a_3',
184
+ 'K_2_b_1',
185
+ 'K_2_b_2',
186
+ 'K_2_c_1',
187
+ 'K_2_c_2',
188
+ 'K_2_d',
189
+ 'K_2_e_1',
190
+ 'K_2_e_2',
191
+ 'K_2_e_3',
192
+ 'K_2_f_1',
193
+ 'K_2_f_2',
194
+ 'K_2_f_3',
195
+ 'K_2_g',
196
+ 'K_2_k_2'
197
+ ],'L':[
198
+ 'L_1_a',
199
+ 'L_2_b'
200
+ ]
201
+ }
202
+ return df
203
+ from FFSeval import Kriging as kr
204
+ import csv
205
+ import matplotlib.pyplot as plt
206
+ from mpl_toolkits.mplot3d import Axes3D
207
+ from typing import Tuple
208
+ import importlib.resources as pkg_resources
209
+ from importlib import resources
210
+ from FFSeval import data
211
+ class dmanage:
212
+ '''
213
+ 係数が表形式で与えられるときに,表データをcsvファイルから読み取り,
214
+ Kriging法で内挿した上で,評価値を返す
215
+ [使用法]二次元の場合*****************************
216
+ dm=dmanage()
217
+ data=dm.Finput('J-2-k-b.csv')
218
+ X,W=dm.CSV2XW(data,1)
219
+ r2_score=dm.KrigCalc(X,W)
220
+ dm.DrawRes(X,W) #鳥観図による確認
221
+ x_val=0.5; y_val=2.0 #評価したい点
222
+ target_point=np.array([[x_val,y_val]])
223
+ w_pred,sigma=dm.Eval(target_point)# w_predが予測値
224
+ [使用法]三次元の場合*****************************
225
+ dm=dmanage()
226
+ data=dm.Finput('J-2-k-b.csv')
227
+ z=[0.0625,0.125,0.25,0.37,0.50]#三次元目のデータリスト(表の数だけ存在)
228
+ X,W=dm.Fconv3D(data,z)
229
+ r2_score=dm.KrigCalc(X,W)
230
+ target_point=np.array([[0.5,2,0.18]])
231
+ w_pred,sigma=dm.Eval(target_point)# w_predが予測値
232
+ '''
233
+ def __init__(self):
234
+ self.df=None
235
+ def Fconv3D(self,data:list,z:list)->Tuple[np.ndarray, np.ndarray]:
236
+ '''
237
+ 3次元の入力テーブルに対する対応
238
+ dataの中から,全データの処理を行いX,Wを構成して戻す
239
+ 三次元目の情報はz:listで与える
240
+ '''
241
+ # STARTを含む要素の数をカウント
242
+ count = 0
243
+ for sublist in data:
244
+ for item in sublist:
245
+ if "START" in item:
246
+ count += 1
247
+ nz=len(z)
248
+ if count!=nz:
249
+ print(f'STARTの数{count}とzのサイズ{nz}が一致していない')
250
+ return
251
+ W=np.array([])
252
+ X=np.empty((0,3))
253
+ for i in range(count):
254
+ ith=i+1
255
+ df=self.dRead(data,ith)
256
+ xval=df['xval']
257
+ yval=df['yval']
258
+ xn=len(xval)
259
+ yn=len(yval)
260
+ for iy in range(yn):
261
+ for ix in range(xn):
262
+ d=[yval[iy],xval[ix],z[i]]
263
+ X=np.append(X,[d], axis=0)
264
+ W=np.append(W,df['arr'][iy,ix])
265
+ return X,W
266
+ def Fconv4D(self,data:list,z1:list,z2:list)->Tuple[np.ndarray, np.ndarray]:
267
+ '''
268
+ 4次元の入力テーブルに対する対応
269
+ dataの中から,全データの処理を行いX,Wを構成して戻す
270
+ 三次元目,四次元目の情報はz1:list,z2:listで与える
271
+ '''
272
+ # STARTを含む要素の数をカウント
273
+ count = 0
274
+ for sublist in data:
275
+ for item in sublist:
276
+ if "START" in item:
277
+ count += 1
278
+ nz1=len(z1)
279
+ nz2=len(z2)
280
+ if count!=nz1 or count!=nz2:
281
+ print(f'STARTの数{count}とzのサイズ{nz1,nz2}が一致していない')
282
+ return
283
+ W=np.array([])
284
+ X=np.empty((0,4))
285
+ for i in range(count):
286
+ ith=i+1
287
+ df=self.dRead(data,ith)
288
+ xval=df['xval']
289
+ yval=df['yval']
290
+ xn=len(xval)
291
+ yn=len(yval)
292
+ for iy in range(yn):
293
+ for ix in range(xn):
294
+ d=[yval[iy],xval[ix],z1[i],z2[i]]
295
+ X=np.append(X,[d], axis=0)
296
+ W=np.append(W,df['arr'][iy,ix])
297
+ return X,W
298
+ def Finput(self,fname:str)->list:
299
+ '''
300
+ csvファイルを読み取りリストに格納する
301
+ '''
302
+ # with resources.files("FFSeval.data").joinpath("J-2-k-a-2.csv").open("r", encoding="utf-8", newline='') as csvfile:
303
+ with resources.files("FFSeval.data").joinpath(fname).open("r", encoding="utf-8", newline='') as csvfile:
304
+
305
+ reader = csv.reader(csvfile)
306
+
307
+ data=[]
308
+ for row in reader:
309
+ data.append(row)
310
+ return data
311
+ def dRead(self,data:list,ith:int)->dict:
312
+ '''
313
+ dataのith番目のテーブルを辞書として返す
314
+ '''
315
+ n=len(data)
316
+ ii=0
317
+ flag=False
318
+ res=[]
319
+ l=0
320
+ for ll in data:
321
+ if ll[0]=='START':
322
+ ii+=1
323
+ if ii==ith:
324
+ flag=True
325
+ l+=1
326
+ continue
327
+ if flag and l!=0:
328
+ if ll[0]=='END':
329
+ break
330
+ if l==1:
331
+ nx=int(ll[0])
332
+ ny=int(ll[1])
333
+ l+=1
334
+ continue
335
+ if l==2:
336
+ numlist=[float(x) for x in ll[:nx]]
337
+ #numlist = [float(x) if x.strip() != '' else 0.0 for x in ll[:nx]]
338
+ xval=numlist
339
+ l+=1
340
+ continue
341
+ if l==3:
342
+ numlist=[float(x) for x in ll[:ny]]
343
+ #numlist = [float(x) if x.strip() != '' else 0.0 for x in ll[:ny]]
344
+ yval=numlist
345
+ l+=1
346
+ continue
347
+ numlist=[float(x) for x in ll[:nx]]
348
+ #numlist = [float(x) if x.strip() != '' else 0.0 for x in ll[:nx]]
349
+ res.append(numlist)
350
+ l+=1
351
+ arr=np.array(res)
352
+ df={}
353
+ df['xval']=xval
354
+ df['yval']=yval
355
+ df['arr']=arr
356
+ return df
357
+ def MakeInp(self,df:dict)->Tuple[np.ndarray, np.ndarray]:
358
+ '''
359
+ 辞書型データを,Kriging入力用のnp.arrayに変換する
360
+ '''
361
+ xval=df['xval']
362
+ yval=df['yval']
363
+ xn=len(xval)
364
+ yn=len(yval)
365
+ W=np.array([])
366
+ X=np.empty((0,2))
367
+ for iy in range(yn):
368
+ for ix in range(xn):
369
+ d=[yval[iy],xval[ix]]
370
+ X=np.append(X,[d], axis=0)
371
+ W=np.append(W,df['arr'][iy,ix])
372
+ return X,W
373
+ def CSV2XW(self,data:list,ith:int)->Tuple[np.ndarray, np.ndarray]:
374
+ df=self.dRead(data,ith)
375
+ X,W=self.MakeInp(df)
376
+ self.df=df
377
+ return X,W
378
+ def GetDf(self):
379
+ return self.df
380
+ def KrigCalc(self,X,W,alpha=5e-4):
381
+ self.krig=kr.Kriging()
382
+ self.krig.setData(X,W)
383
+ r2_score=self.krig.Fit(alpha=alpha)
384
+ return r2_score
385
+ def Eval(self,target_point:np.array)->float:
386
+ #target_point = np.array([[x, y]])
387
+ w_pred,sigma=self.krig.Predict(target_point)
388
+ return w_pred[0],sigma
389
+ def DrawRes(self,X,W)->None:
390
+ # 1. 描画用のメッシュグリッドを作成
391
+ x = np.linspace(np.min(X[:,0]), np.max(X[:,0]), 50)
392
+ y = np.linspace(np.min(X[:,1]), np.max(X[:,1]), 50)
393
+ X_grid, Y_grid = np.meshgrid(x, y)
394
+
395
+ # 2. メッシュ座標を一次元にして予測
396
+ XY = np.vstack([X_grid.ravel(), Y_grid.ravel()]).T
397
+
398
+ # Kriging モデルで予測(タプルで返る)
399
+ Z_pred, _ = self.krig.Predict(XY)
400
+
401
+ # 予測値をグリッド形状に整形
402
+ Z_grid = Z_pred.reshape(X_grid.shape)
403
+
404
+ # 4. 描画
405
+ fig = plt.figure(figsize=(10, 7))
406
+ ax = fig.add_subplot(111, projection='3d')
407
+
408
+ # 予測面
409
+ ax.plot_surface(X_grid, Y_grid, Z_grid, cmap='viridis', alpha=0.7)
410
+
411
+ # 元データ点も重ねる
412
+ #ax.scatter(X[:,0], X[:,1], W, color='r', s=30, label='Data points')
413
+ # 予測に使ったデータ点を赤い球で表示
414
+ ax.scatter(X[:, 0], X[:, 1], W, color='black', s=30, marker='^', label='Training data')
415
+ # 軸ラベル
416
+ ax.set_xlabel('X')
417
+ ax.set_ylabel('Y')
418
+ ax.set_zlabel('W')
419
+
420
+ # タイトル・凡例
421
+ ax.set_title('Kriging Model Surface')
422
+ ax.legend()
423
+ plt.show()
424
+ class J_2_k_a(Base):
425
+ #by S.Sakai
426
+ def __init__(self):
427
+ super().SetTitle('周方向貫通亀裂 Zahoorの解')
428
+ super().SetRefer('Zahoor, A.:Ductile Fracture Handbook Volume 1,EPRI NP-6301-D,1989')
429
+ # Kriging法による応答曲面を計算
430
+ self.dm_P=dmanage()
431
+ data=self.dm_P.Finput('J-2-k-a-1.csv')
432
+ z=[5.0,10.0,20.0]
433
+ X,W=self.dm_P.Fconv3D(data,z)
434
+ r2_score=self.dm_P.KrigCalc(X,W)
435
+ self.dm_M=dmanage()
436
+ data=self.dm_M.Finput('J-2-k-a-2.csv')
437
+ z=[5.0,10.0,20.0]
438
+ X,W=self.dm_M.Fconv3D(data,z)
439
+ r2_score=self.dm_M.KrigCalc(X,W)
440
+ def Calc(self):
441
+ df=super().GetData()
442
+ th=df['th']
443
+ plane=df['plane']
444
+ if plane=='stress': beta=2
445
+ if plane=='strain': beta=6
446
+ M=df['M']
447
+ R=df['R']
448
+ t=df['t']
449
+ P=df['P']
450
+ S0=df['S0']
451
+ alpha=df['alpha']
452
+ e0=df['e0']
453
+ n=df['n']
454
+ E=df['E']
455
+ A=0.0
456
+ P0=2.0*S0*R*t*(np.pi-th-2.0*np.arcsin(0.5*np.sin(th)))
457
+ M0=4.0*S0*R*R*t*(np.cos(th/2.0)-0.5*np.sin(th))
458
+ if df['Case']=='Collapse': #塑性崩壊値の計算
459
+ res={
460
+ 'P0':P0,
461
+ 'M0':M0
462
+ }
463
+ super().SetRes(res)
464
+ return
465
+ if R/t >= 5.0 and R/t<10.0:
466
+ A=(0.125*(R/t)-0.25)**0.25
467
+ if R/t>=10.0 and R/t<=20.0:
468
+ A=(0.4*R/t-3.0)**0.25
469
+ if plane=='stress': beta=2
470
+ if plane=='strain': beta=6
471
+ if df['Case']=='PR': #塑性崩壊強度の計算
472
+ pass #将来開発すること
473
+ if df['Case']=='PJ':
474
+ target_point=np.array([[th/np.pi,n,R/t]])
475
+ H1,sigma=self.dm_P.Eval(target_point)
476
+ Ft=1.0+A*(5.3303*(th/np.pi)**1.5+18.773*(th/np.pi)**4.24)
477
+ St=P/(2.0*np.pi*R*t)
478
+ the=th*(1.0+(Ft*Ft/beta)*(n-1)/(n+1)*(St/S0)**2/(1+(P/P0)**2))
479
+ ft=(the/np.pi)*(1.0+A*(5.3303*(the/np.pi)**1.5+18.773*(the/np.pi)**4.24))**2
480
+ J=ft*P*P/(4.0*np.pi*R*t*t*E)+alpha*S0*e0*(np.pi-th)*H1*(P/P0)**(n+1)
481
+ res={'J':J}
482
+ super().SetRes(res)
483
+ return
484
+ if df['Case']=='MR': #塑性崩壊強度の計算
485
+ target_point=np.array([[th/np.pi,n,R/t]])
486
+ H1,sigma=self.dm_M.Eval(target_point)
487
+ JR=df['JR']
488
+ MR=M0*(JR/(alpha*S0*e0*np.pi*R*(1.0-th/np.pi)**2*H1))**(1./(n+1.))
489
+ res={'MR':MR,
490
+ 'M0':M0,
491
+ 'H1':H1}
492
+ super().SetRes(res)
493
+ return
494
+ if df['Case']=='MJ':
495
+ target_point=np.array([[th/np.pi,n,R/t]])
496
+ H1,sigma=self.dm_M.Eval(target_point)
497
+ Sb=M/(np.pi*R*R*t)
498
+
499
+ Fb=1.0+A*(4.5967*(th/np.pi)**1.5+2.6422*(th/np.pi)**4.24)
500
+ the=th*(1.0+Fb*Fb/beta*(n-1)/(n+1)*(Sb/S0)**2/(1+(M/M0)**2))
501
+ fb=(the/np.pi)*(1.0+A*(4.5967*(the/np.pi)**1.5+2.6422*(the/np.pi)**4.24))**2
502
+ J=fb*M*M/(R*R*R*t*t*E)+alpha*S0*e0*np.pi*R*(1-th/np.pi)**2*H1*(M/M0)**(n+1)
503
+ res={'J':J,
504
+ 'M0':M0,
505
+ 'H1':H1}
506
+ super().SetRes(res)
507
+ class J_2_k_b(Base):
508
+ #by S.Sakai
509
+ def __init__(self):
510
+ super().SetTitle('周方向貫通亀裂 Zahoorの解')
511
+ super().SetRefer('Zahoor, A.:Ductile Fracture Handbook Volume 1,EPRI NP-6301-D,1989')
512
+
513
+
514
+
515
+ def Calc(self):
516
+ df=super().GetData()
517
+ th=df['Th']/180.0*np.pi
518
+ plane=df['plane']
519
+ if plane=='stress': beta=2
520
+ if plane=='strain': beta=6
521
+ M=df['M']
522
+ R=df['R']
523
+ t=df['t']
524
+ P=df['P']
525
+ St=P/(2.*np.pi*R*t)
526
+ Sb=M/(np.pi*R*R*t)
527
+ S0=df['S0']
528
+ P0=2*S0*R*t*(np.pi-th-2*np.arcsin(0.5*np.sin(th)))
529
+ M0=4*S0*R*R*t*(np.cos(th/2)-0.5*np.sin(th))
530
+ lam=M/P/R
531
+ P0d=0.5*(-lam*R*P0*P0/M0+np.sqrt((lam*R*P0*P0/M0)**2+4*P0*P0))
532
+ n=df['n']
533
+ dm=dmanage()
534
+ x=lam/(1.+lam)
535
+ data=dm.Finput('J-2-k-b.csv')
536
+ z=[0.0625,0.125,0.25,0.37,0.50]#三次元目のデータリスト(表の数だけ存在)
537
+ X,W=dm.Fconv3D(data,z)
538
+ r2_score=dm.KrigCalc(X,W)
539
+ target_point=np.array([[x,n,th/np.pi]])
540
+ h1,sigma=dm.Eval(target_point)
541
+ E=df['E']
542
+ alpha=df['alpha']
543
+ e0=df['e0']
544
+ the=th*(1+(1/beta)*((n-1)/(n+1))*((St*Ft+Sb*Fb)**2/S0/S0)/(1+(P/P0d)**2))
545
+ ft=(the/np.pi)*(1+A*(5.3303*(the/np.pi)**1.5+18.773*(the/np.pi)**4.24))**2
546
+ fb=(the/np.pi)*(1+A*(4.5967*(the/np.pi)**1.5+2.6422*(the/np.pi)**4.24))**2
547
+ J=ft*P*P/(4*R*t*t*E)+fb*M*M/(R*R*R*t*t*E)+alpha*S0*e0*R*(np.pi-th)*(th/np.pi)*h1*(P/P0d)**(n+1)
548
+ res={'J':J}
549
+ super().SetRes(res)
550
+ class J_7_a(Base):
551
+ #by S.Sakai
552
+ def __init__(self):
553
+ super().SetTitle('円孔縁のき裂 片側貫通亀裂 Zahoorの解')
554
+ super().SetRefer('Zahoor, A.:Ductile Fracture Handbook Volume 3,EPRI NP-6301-D,1991')
555
+ def Calc(self):
556
+ dm=dmanage()
557
+ df=super().GetData()
558
+
559
+ a=df['a']
560
+ R=df['R']
561
+ alpha=df['alpha']
562
+ n=df['n']
563
+ S=df['sigma'] # σ
564
+ S0=df['sigma0'] # σ0
565
+ E = df['E']
566
+ e0=S0/E # ε0
567
+
568
+ data=dm.Finput('J-7-a.csv')
569
+ ith=1
570
+ X,W=dm.CSV2XW(data,ith)
571
+ r2_score=dm.KrigCalc(X,W)
572
+ target_point=np.array([[a/R,n]])
573
+ H1,sigma=dm.Eval(target_point)
574
+
575
+ a_over_R=a/R #代入してみましたが、代入するのとしないのとどちらが良いですか?
576
+ B0=(4.0/3.0)/(1-0.08696*(1+0.5*a_over_R))**2
577
+ F=(2.8041-4.9327*a_over_R+7.986*a_over_R**2-6.9783*a_over_R**3+2.4132*a_over_R**4)
578
+ ae=a*(1+0.5*F**2*((n-1)/(n+1))*((S/S0)**2/(1+B0*(S/S0)**2)))
579
+ ae_over_R=ae/R #代入してみましたが、代入するのとしないのとどちらが良いですか?
580
+ f=np.pi*ae_over_R*(2.8041-4.9327*ae_over_R+7.986*ae_over_R**2-6.9783*ae_over_R**3+2.4132*ae_over_R**4)**2
581
+ #J=f*R*S**2/E+alpha*S0*e0*H1*(S/S0)**(n+1)
582
+ J=f*R*S**2/E+alpha*S0*e0*R*H1*(S/S0)**(n+1) #R*が抜けていなした
583
+
584
+ #res={'J':J,
585
+ #'H1':H1}
586
+ res={'J':J}#H1は戻す必要はありません
587
+ super().SetRes(res)
588
+
589
+
590
+ class K_1_a_1(Base):
591
+ #by S.Sakai
592
+ def __init__(self):
593
+ super().SetTitle('平板の半楕円表面亀裂,Raju-Newmanの解')
594
+ super().SetRefer('Newman,J.C>Jr., and Raju,I.S.:Stress-Intensity Factor Equations for Cracks in Three-Dimentional Finite Bodies Subjected to Tension and Bending Loads, NASA Technical Memorandum, 85793, NASA,1984')
595
+ def Calc(self):
596
+ df=super().GetData()
597
+ a=df['a']
598
+ c=df['c']
599
+ b=df['b']
600
+ t=df['t']
601
+ P=df['P']
602
+ M=df['M']
603
+ Sm=P/(2*b*t)
604
+ Sb=3*M/(b*t*t)
605
+ if a/c <=1.0:
606
+ Q=1+1.464*(a/c)**1.65
607
+ g=1
608
+ fphai=1
609
+ fw=np.sqrt(1.0/np.cos(np.pi*c/(2*b)*np.sqrt(a/t)))
610
+ H=1+(-1.22-0.12*a/c)*a/t+(0.55-1.05*(a/c)**0.75+0.47*(a/c)**1.5)*(a/t)**2
611
+ FA=(1.13-0.09*a/c+(-0.54+0.89/(0.2+a/c))*(a/t)**2+(0.5-1/(0.65+a/c)+14*(1-a/c)**24)*(a/t)**4)*g*fphai*fw
612
+ else:
613
+ Q=1+1.464*(c/a)**1.65
614
+ g=1
615
+ fphai=np.sqrt(c/a)
616
+ fw=np.sqrt(1.0/np.cos(np.pi*c/(2*b)*np.sqrt(a/t)))
617
+ FA=(np.sqrt(c/a)*(1+0.04*c/a)+0.2*(c/a)**4*(a/t)**2-0.11*(c/a)**4*(a/t)**4)*g*fphai*fw
618
+ H=1+(-2.11+0.77*c/a)*a/t+(0.55-0.72*(c/a)**0.75+0.14*(c/a)**1.5)*(a/t)**2
619
+ KA=FA*(Sm+H*Sb)*np.sqrt(np.pi*a/Q)
620
+ if a/c <=1.0:
621
+ Q=1+1.464*(a/c)**1.65
622
+ g=1.1+0.35*(a/t)**2
623
+ fphai=np.sqrt(a/c)
624
+ fw=np.sqrt(1.0/np.cos(np.pi*c/(2*b)*np.sqrt(a/t)))
625
+ FB=(1.13-0.09*a/c+(-0.54+0.89/(0.2+a/c))*(a/t)**2+(0.5-1/(0.65+a/c)+14*(1-a/c)**24)*(a/t)**4)*g*fphai*fw
626
+ H=1-0.34*a/t-0.11*a/c*a/t
627
+ else:
628
+ Q=1+1.464*(c/a)**1.65
629
+ g=1.1+0.35*c/a*(a/t)**2
630
+ fphai=1
631
+ fw=np.sqrt(1.0/np.cos(np.pi*c/(2*b)*np.sqrt(a/t)))
632
+ FB=(np.sqrt(c/a)*(1+0.04*c/a)+0.2*(c/a)**4*(a/t)**2-0.11*(c/a)**4*(a/t)**4)*g*fphai*fw
633
+ H=1+(-0.04-0.41*c/a)*a/t+(0.55-1.93*(c/a)**0.75+1.38*(c/a)**1.5)*(a/t)**2
634
+ KB=FB*(Sm+H*Sb)*np.sqrt(np.pi*a/Q)
635
+ res={
636
+ 'KA':KA,
637
+ 'KB':KB
638
+ }
639
+ super().SetRes(res)
640
+ class K_1_a_2(Base):
641
+ #by S.Sakai
642
+ def __init__(self):
643
+ super().SetTitle('半楕円表面き裂 ASME Section XI, Appendix A の解')
644
+
645
+ super().SetRefer(
646
+ "ASME Boiler and Pressure Vessel Code, Section XI, Rules for Inservice Inspection of Nuclear Power Plant Components, 2004\n"
647
+ "Cipolla, R. C.: Technical Basis for the Residual Stress Intensity Factor Equation for Surface Flaws in ASME Section XI Appendix A, ASME PVP, Vol. 313-1, p. 105, 1995"
648
+ )
649
+
650
+ # Applicable range: 0 < a/t ≤ 0.8, 0 < a/c ≤ 1
651
+
652
+ def Calc(self):
653
+ dm = dmanage()
654
+ df = super().GetData()
655
+
656
+ a = df['a'] # crack depth
657
+ t = df['t'] # thickness
658
+ c = df['c'] # half surface length
659
+ sigma0 = df['sigma0']
660
+ sigma1 = df['sigma1']
661
+ sigma2 = df['sigma2']
662
+ sigma3 = df['sigma3']
663
+ sigmaY = df['Sy']
664
+
665
+ data = dm.Finput('K-1-a-2.csv')
666
+ target_point = np.array([[a / t, a / c]])
667
+
668
+ FA = np.zeros(4, dtype=float) # F0A..F3A
669
+ for ith in range(1, 5): # 1,2,3,4 (→ F0A..F3A)
670
+ X_ith, W_ith = dm.CSV2XW(data, ith)
671
+ r2_score = dm.KrigCalc(X_ith, W_ith)
672
+ Fi, _sigma = dm.Eval(target_point)
673
+ FA[ith - 1] = float(Fi)
674
+
675
+ FB = np.zeros(4, dtype=float) # F0B..F3B
676
+ for ith in range(5, 9): # 5,6,7,8 (→ F0B..F3B)
677
+ X_ith, W_ith = dm.CSV2XW(data, ith)
678
+ r2_score = dm.KrigCalc(X_ith, W_ith)
679
+ Fi, _sigma = dm.Eval(target_point)
680
+ FB[ith - 5] = float(Fi)
681
+
682
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3
683
+ qyA = (SA**2) / (6.0 * sigmaY**2)
684
+ QA = 1.0 + 1.464 * (a / c)**1.65 - qyA
685
+ KA = SA * np.sqrt(np.pi * a / QA)
686
+
687
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3
688
+ qyB = (SB**2) / (6.0 * sigmaY**2)
689
+ QB = 1.0 + 1.464 * (a / c)**1.65 - qyB
690
+ KB = SB * np.sqrt(np.pi * a / QB)
691
+
692
+ res = {
693
+ 'KA': KA, 'KB': KB
694
+ }
695
+ super().SetRes(res)
696
+ class K_1_a_3(Base):
697
+ #by S.Sakai
698
+ def __init__(self):
699
+ super().SetTitle('半楕円表面き裂 白鳥の解')
700
+
701
+ super().SetRefer(
702
+ "白鳥: 影響関数法による応力拡大係数の解析, 日本機械学会講習会教材, 表面き裂—その解析と評価—, No.900-2, p. 1, 1990"
703
+ )
704
+
705
+ # Applicable range: 0.1 ≤ a/t ≤ 0.8, 0.2 ≤ a/c ≤ 2
706
+
707
+ def Calc(self):
708
+ dm = dmanage()
709
+ df = super().GetData()
710
+
711
+ a = df['a'] # crack depth
712
+ t = df['t'] # thickness
713
+ c = df['c'] # half surface length
714
+ sigma0 = df['sigma0']
715
+ sigma1 = df['sigma1']
716
+ sigma2 = df['sigma2']
717
+ sigma3 = df['sigma3']
718
+ # sigma0, sigma1, sigma2, sigma3 は、き裂深さ方向の応力分布
719
+ # σ = σ0 + σ1·ξ + σ2·ξ² + σ3·ξ³
720
+ # における多項式展開の係数を表す
721
+ # ここで ξ = 1 - u/a (u:表面からの距離,a:き裂深さ)
722
+ data = dm.Finput('K-1-a-3.csv')
723
+ target_point = np.array([[a / t, a / c]])
724
+
725
+ FA = np.zeros(4, dtype=float) # F0A..F3A
726
+ for ith in range(1, 5): # 1,2,3,4 (→ F0A..F3A)
727
+ X_ith, W_ith = dm.CSV2XW(data, ith)
728
+ r2_score = dm.KrigCalc(X_ith, W_ith)
729
+ Fi, _sigma = dm.Eval(target_point)
730
+ FA[ith - 1] = float(Fi)
731
+
732
+ FB = np.zeros(4, dtype=float) # F0B..F3B
733
+ for ith in range(5, 9): # 5,6,7,8 (→ F0B..F3B)
734
+ X_ith, W_ith = dm.CSV2XW(data, ith)
735
+ r2_score = dm.KrigCalc(X_ith, W_ith)
736
+ Fi, _sigma = dm.Eval(target_point)
737
+ FB[ith - 5] = float(Fi)
738
+
739
+ Q = 1.0 + 1.464 * (a / c)**1.65
740
+
741
+ # 最深点の応力拡大係数
742
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3
743
+ KA = SA * np.sqrt(np.pi * a / Q)
744
+
745
+ # 表面点の応力拡大係数
746
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3
747
+ KB = SB * np.sqrt(np.pi * a / Q)
748
+
749
+ res = {
750
+ 'KA': KA, 'KB': KB
751
+ }
752
+ super().SetRes(res)
753
+ class K_1_b_1(Base):
754
+ def __init__(self):
755
+ super().SetTitle('長い表面き裂(片側) Tada らの解')
756
+ super().SetRefer('Tada, H., Paris, P. C.,and Irwin, G. R.: The Stress Analysis of Cracks Handbook, Third edition, ASME, 2000')
757
+
758
+ # Applicable range: 0 < a/t < 1
759
+
760
+ def Calc(self):
761
+ df = super().GetData()
762
+
763
+ a = df['a'] # crack depth
764
+ t = df['t'] # thickness
765
+ b = df['b'] # half width
766
+ P = df['P'] # axial load
767
+ M = df['M'] # bending moment
768
+
769
+ sigma_m = P / (2.0 * b * t)
770
+ sigma_b = 3.0 * M / (b * t**2)
771
+ theta = np.pi * a / (2.0 * t)
772
+ root_term = np.sqrt((2.0 * t) / (np.pi * a) * np.tan(theta))
773
+ cos_term = np.cos(theta)
774
+ Fm = root_term * (0.752 + 2.02 * (a / t) + 0.37 * (1.0 - np.sin(theta))**3) / cos_term
775
+ Fb = root_term * (0.923 + 0.199 * (1.0 - np.sin(theta))**4) / cos_term
776
+
777
+ K = (Fm * sigma_m + Fb * sigma_b) * np.sqrt(np.pi * a)
778
+
779
+ res = {'K': K}
780
+ super().SetRes(res)
781
+ class K_1_c_1(Base):
782
+ def __init__(self):
783
+ super().SetTitle('長い表面き裂(両側) Tada らの解')
784
+ super().SetRefer('Tada, H., Paris, P. C., and Irwin, G. R.: The Stress Analysis of Cracks Handbook, Third edition, ASME, 2000')
785
+
786
+ # Applicable range: 0 < a/t < 0.5
787
+
788
+ def Calc(self):
789
+ df = super().GetData()
790
+
791
+ a = df['a'] # crack depth
792
+ t = df['t'] # thickness
793
+ b = df['b'] # half width
794
+ P = df['P'] # axial load
795
+ M = df['M'] # bending moment
796
+
797
+ sigma_m = P / (2.0 * b * t)
798
+ theta = np.pi * a / t
799
+ Fm = (1.0 + 0.122 * np.cos(theta)**4) * np.sqrt((t / (np.pi * a)) * np.tan(theta))
800
+
801
+ K = Fm * sigma_m * np.sqrt(np.pi * a)
802
+
803
+ res = {'K': K}
804
+ super().SetRes(res)
805
+
806
+ class K_1_d_1(Base):
807
+ def __init__(self):
808
+ super().SetTitle('中央貫通き裂 Shih らの解(き裂が短い場合)')
809
+ super().SetRefer('Shih, G. C., Paris, P. C., and Erdogan, F.: Stress Intensity Factors for Plane Extension and Plate Bending Problems, Trans. ASME, J. of Applied Mechanics, 29, p. 306, 1962')
810
+
811
+ # Applicable range: 0 < c/b ≤ 0.15
812
+
813
+ def Calc(self):
814
+ df = super().GetData()
815
+
816
+ c = df['c'] # crack half-length
817
+ t = df['t'] # thickness
818
+ b = df['b'] # half width
819
+ P = df['P'] # axial load
820
+ M = df['M'] # bending moment
821
+
822
+ sigma_m = P/(2.0*b*t)
823
+ sigma_b = 3.0*M/(b*t**2)
824
+
825
+ #開口側の応力拡大係数
826
+
827
+ FmA, FbA = 1.0, 1.0
828
+
829
+ KA = (FmA*sigma_m + FbA*sigma_b)*np.sqrt(np.pi*c)
830
+
831
+ #閉口側の応力拡大係数
832
+
833
+ FmB, FbB = 1.0, -1.0
834
+
835
+ KB = (FmB*sigma_m + FbB*sigma_b)*np.sqrt(np.pi*c)
836
+
837
+ res = {'KA': KA, 'KB': KB}
838
+ super().SetRes(res)
839
+ class K_1_d_2(Base):
840
+ def __init__(self):
841
+ super().SetTitle('中央貫通き裂 Tada らの解(き裂が長い場合)')
842
+ super().SetRefer('Tada, H., Paris, P. C., and Irwin, G. R.: The Stress Analysis of Cracks Handbook, Third edition, ASME, 2000')
843
+
844
+ # Applicable range: 0 < c/b < 1
845
+
846
+ def Calc(self):
847
+ df = super().GetData()
848
+
849
+ c = df['c'] # crack half-length
850
+ t = df['t'] # thickness
851
+ b = df['b'] # half width
852
+ P = df['P'] # axial load
853
+ M = df['M'] # bending moment
854
+
855
+ sigma_m = P/(2.0*b*t)
856
+ ratio = c/b
857
+ theta = np.pi*c/(2.0*b)
858
+ Fm = (1.0 - 0.025*ratio**2 + 0.06*ratio**4) / np.sqrt(np.cos(theta))
859
+
860
+ K = Fm * sigma_m * np.sqrt(np.pi*c)
861
+
862
+ res = {'K': K}
863
+ super().SetRes(res)
864
+ class K_1_e_1(Base):
865
+ def __init__(self):
866
+ super().SetTitle('楕円内部き裂 Ovchinnikov–Vasiltchenko の解')
867
+ super().SetRefer("Ovchinnikov, A. V., and Vasiltchenko, G. S.: The Defect Schematization and SIF Determination for Assessment of the Vessel and Piping Integrity, Final Report, CHIITMASH Project 125-01-90, p. 1, 1990")
868
+
869
+ # Applicable range: 0 < a/t ≤ 0.45(1 - 2e/t), 0 < a/c ≤ 1, 0 ≤ e/t ≤ 0.5, 0 < c/b ≤ 0.15
870
+
871
+ def Calc(self):
872
+ df = super().GetData()
873
+
874
+ a = df['a'] # crack depth (semi-minor)
875
+ c = df['c'] # crack half-length (semi-major)
876
+ t = df['t'] # thickness
877
+ b = df['b'] # half width
878
+ e = df['e'] # offset from mid-plane
879
+ P = df['P'] # axial load
880
+ M = df['M'] # bending moment
881
+
882
+ sigma_m = P/(2.0*b*t)
883
+ sigma_b = 3.0*M/(b*t**2)
884
+
885
+ ac = a/c
886
+ at = a/t
887
+ et = e/t
888
+ L = (2.0*at)/(1.0 - 2.0*et)
889
+
890
+ #評価点Aにおける応力拡大係数
891
+
892
+ denom_A = (1.0 - (L**1.8)*(1.0 - 0.4*ac - et**2))**0.54
893
+ FmA = (1.01 - 0.37*ac)/denom_A
894
+ FbA = (1.01 - 0.37*ac)*(2.0*et + at + 0.34*ac*at)/denom_A
895
+
896
+ KA = (FmA*sigma_m + FbA*sigma_b)*np.sqrt(np.pi*a)
897
+
898
+ #評価点Bにおける応力拡大係数
899
+
900
+ denom_B = (1.0 - (L**1.8)*(1.0 - 0.4*ac - 0.8*et**2))**0.54
901
+ FmB = (1.01 - 0.37*ac)/denom_B
902
+ FbB = (1.01 - 0.37*ac)*(2.0*et + at + 0.34*ac*at)/denom_B
903
+
904
+ KB = (FmB*sigma_m + FbB*sigma_b)*np.sqrt(np.pi*a)
905
+
906
+ res = {'KA': KA, 'KB': KB}
907
+ super().SetRes(res)
908
+ class K_1_e_2(Base):
909
+ def __init__(self):
910
+ super().SetTitle('楕円内部き裂 ASME Section XI, Appendix A の解')
911
+
912
+ super().SetRefer(
913
+ "ASME Boiler and Pressure Vessel Code, Section XI, Rules for Inservice Inspection of Nuclear Power Plant Components, 2004"
914
+ )
915
+
916
+ # Applicable range: 0.075 < a/t ≤ 0.325, 0 ≤ e/t ≤ 0.35
917
+
918
+ def Calc(self):
919
+ dm = dmanage()
920
+ df = super().GetData()
921
+
922
+ a = df['a'] # crack half-depth (semi-minor axis)
923
+ b = df['b'] # plate half-width
924
+ c = df['c'] # crack half-length (semi-major axis)
925
+ t = df['t'] # thickness
926
+ e = df['e'] # offset from mid-thickness
927
+ P = df['P'] # axial force
928
+ M = df['M'] # bending moment
929
+ Sy = df['Sy'] # yield strength
930
+
931
+ sigma_m = P / (2.0 * b * t)
932
+ sigma_b = 3.0 * M / (b * t**2)
933
+
934
+ data = dm.Finput('K-1-e-2.csv')
935
+ target_point = np.array([[a / t, e / t]])
936
+
937
+ # 1 -> FmA, 2 -> FmB, 3 -> FbA, 4 -> FbB
938
+ X1, W1 = dm.CSV2XW(data, 1)
939
+ r2_score = dm.KrigCalc(X1, W1)
940
+ FmA, _sigma = dm.Eval(target_point)
941
+ FmA = float(FmA)
942
+
943
+ X2, W2 = dm.CSV2XW(data, 2)
944
+ r2_score = dm.KrigCalc(X2, W2)
945
+ FmB, _sigma = dm.Eval(target_point)
946
+ FmB = float(FmB)
947
+
948
+ X3, W3 = dm.CSV2XW(data, 3)
949
+ r2_score = dm.KrigCalc(X3, W3)
950
+ FbA, _sigma = dm.Eval(target_point)
951
+ FbA = float(FbA)
952
+
953
+ X4, W4 = dm.CSV2XW(data, 4)
954
+ r2_score = dm.KrigCalc(X4, W4)
955
+ FbB, _sigma = dm.Eval(target_point)
956
+ FbB = float(FbB)
957
+
958
+ # 評価点Aにおける応力拡大係数
959
+ SA = FmA * sigma_m + FbA * sigma_b
960
+ qyA = (SA**2) / (6.0 * Sy**2)
961
+ QA = 1.0 + 1.464 * (a / c)**1.65 - qyA
962
+ KA = SA * np.sqrt(np.pi * a / QA)
963
+
964
+ # 評価点Bにおける応力拡大係数
965
+ SB = FmB * sigma_m + FbB * sigma_b
966
+ qyB = (SB**2) / (6.0 * Sy**2)
967
+ QB = 1.0 + 1.464 * (a / c)**1.65 - qyB
968
+ KB = SB * np.sqrt(np.pi * a / QB)
969
+
970
+ super().SetRes({'KA': KA, 'KB': KB})
971
+ class K_1_e_3(Base):
972
+ def __init__(self):
973
+ super().SetTitle('楕円内部き裂 Raju–Newman の解')
974
+ super().SetRefer('Newman, J. C. Jr., and Raju, I. S.: Stress-Intensity Factor Equations for Cracks in Three-Dimensional Finite Bodies, NASA Technical Memorandum 83200, NASA, 1981')
975
+
976
+ # Applicable range: c/b < 0.5
977
+
978
+ def Calc(self):
979
+ df = super().GetData()
980
+
981
+ a = df['a'] # crack semi-minor (depth)
982
+ c = df['c'] # crack semi-major (half-length)
983
+ t = df['t'] # thickness
984
+ b = df['b'] # half width
985
+ P = df['P'] # axial load
986
+
987
+ sigma_m = P/(2.0*b*t)
988
+
989
+ ac = a/c
990
+ at = a/t
991
+ theta_w = (np.pi*c/(2.0*b))*np.sqrt(at)
992
+ f_w = (1.0/np.cos(theta_w))**0.5
993
+
994
+ if ac <= 1.0:
995
+ Q = 1.0 + 1.464*(ac**1.65)
996
+ base = 1.0 + (0.05/(0.11 + ac**1.5))*(at**2) + (0.29/(0.23 + ac**1.5))*(at**4)
997
+ # Point A
998
+ gA = 1.0
999
+ fphiA = 1.0
1000
+ FA = base*gA*fphiA*f_w
1001
+ # Point C
1002
+ gC = 1.0 - (at**4)/(1.0 + 4.0*(ac))
1003
+ fphiC = np.sqrt(ac)
1004
+ FC = base*gC*fphiC*f_w
1005
+ else:
1006
+ Q = 1.0 + 1.464*((c/a)**1.65)
1007
+ base = np.sqrt(c/a) + (0.05/(0.11 + ac**1.5))*(at**2) + (0.29/(0.23 + ac**1.5))*(at**4)
1008
+ # Point A
1009
+ gA = 1.0
1010
+ fphiA = np.sqrt(c/a)
1011
+ FA = base*gA*fphiA*f_w
1012
+ # Point C
1013
+ gC = 1.0 - (at**4)/(1.0 + 4.0*(ac))
1014
+ fphiC = 1.0
1015
+ FC = base*gC*fphiC*f_w
1016
+
1017
+ #評価点Aにおける応力拡大係数
1018
+
1019
+ KA = FA*sigma_m*np.sqrt(np.pi*a/Q)
1020
+
1021
+ #評価点Cにおける応力拡大係数
1022
+
1023
+ KC = FC*sigma_m*np.sqrt(np.pi*a/Q)
1024
+
1025
+ res = {'KA': KA, 'KC': KC}
1026
+ super().SetRes(res)
1027
+
1028
+ class K_2_a_1(Base):
1029
+ def __init__(self):
1030
+ super().SetTitle('軸方向内表面半楕円表面き裂 Fett らの解')
1031
+
1032
+ super().SetRefer(
1033
+ "Fett, T., Munz, D., and Neuman, J.: Local Stress Intensity Factors for Surface Cracks in Plates under Power-Shaped Stress Distributions, Engineering Fracture Mechanics, 36, 4, p. 647, 1990\n"
1034
+ "Raju, I. S. and Newman, J. C.: Stress Intensity Factor Influence Coefficients for Internal and External Surface Cracks in Cylindrical Vessels, ASME PVP, 58, p. 37, 1978"
1035
+ )
1036
+
1037
+ # Applicable range: 0 < a/t ≤ 0.8, 0.2 ≤ a/c ≤ 1, 4 ≤ Ri/t ≤ 10
1038
+
1039
+ def Calc(self):
1040
+ dm = dmanage()
1041
+ df = super().GetData()
1042
+
1043
+ a = df['a'] # crack depth
1044
+ t = df['t'] # wall thickness
1045
+ c = df['c'] # half surface length
1046
+ Ri = df['Ri'] # inner radius
1047
+ sigma0 = df['sigma0']
1048
+ sigma1 = df['sigma1']
1049
+ sigma2 = df['sigma2']
1050
+ sigma3 = df['sigma3']
1051
+ dataA=[]
1052
+ dataA.append(dm.Finput('K-2-a-1-F0A.csv'))
1053
+ dataA.append(dm.Finput('K-2-a-1-F1A.csv'))
1054
+ dataA.append(dm.Finput('K-2-a-1-F2A.csv'))
1055
+ dataA.append(dm.Finput('K-2-a-1-F3A.csv'))
1056
+ dataB=[]
1057
+ dataB.append(dm.Finput('K-2-a-1-F0B.csv'))
1058
+ dataB.append(dm.Finput('K-2-a-1-F1B.csv'))
1059
+ dataB.append(dm.Finput('K-2-a-1-F2B.csv'))
1060
+ dataB.append(dm.Finput('K-2-a-1-F3B.csv'))
1061
+ target_point = np.array([[a / t, a / c, Ri / t]])
1062
+ z=[4.0,10.0] #added by S.Sakai
1063
+ FA = np.zeros(4, dtype=float) # F0A..F3A
1064
+ for ith in range(1, 5): # 1,2,3,4 (→ F0A..F3A)
1065
+ #X_ith, W_ith = dm.CSV2XW(data, ith)
1066
+ X_ith,W_ith=dm.Fconv3D(dataA[ith-1],z) #modified by S.Sakai
1067
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1068
+ Fi, _sigma = dm.Eval(target_point)
1069
+ FA[ith - 1] = float(Fi)
1070
+
1071
+ FB = np.zeros(4, dtype=float) # F0B..F3B
1072
+ for ith in range(5, 9): # 5,6,7,8 (→ F0B..F3B)
1073
+ #X_ith, W_ith = dm.CSV2XW(data, ith)
1074
+ X_ith,W_ith=dm.Fconv3D(dataB[ith-5],z) #modified by S.Sakai
1075
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1076
+ Fi, _sigma = dm.Eval(target_point)
1077
+ FB[ith - 5] = float(Fi)
1078
+
1079
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3
1080
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3
1081
+
1082
+ # 最深点の応力拡大係数
1083
+ KA = SA * np.sqrt(np.pi * a)
1084
+
1085
+ # 表面点の応力拡大係数
1086
+ KB = SB * np.sqrt(np.pi * a)
1087
+
1088
+ res = {
1089
+ 'KA': KA, 'KB': KB
1090
+ }
1091
+ super().SetRes(res)
1092
+ class K_2_a_2(Base):
1093
+ def __init__(self):
1094
+ super().SetTitle('軸方向内表面半楕円表面き裂 白鳥の解')
1095
+
1096
+ super().SetRefer(
1097
+ "白鳥: 影響関数法による応力拡大係数の解析, 日本機械学会講習会教材, 表面き裂—その解析と評価—, No.900-2, p. 1, 1990"
1098
+ )
1099
+
1100
+ # Applicable range: 0.1 ≤ a/t ≤ 0.8, 0.2 ≤ a/c ≤ 1, 1/9 ≤ Ri/t ≤ 10
1101
+
1102
+ def Calc(self):
1103
+ dm = dmanage()
1104
+ df = super().GetData()
1105
+
1106
+ a = df['a'] # crack depth
1107
+ t = df['t'] # wall thickness
1108
+ c = df['c'] # half surface crack length
1109
+ Ri = df['Ri'] # inner radius
1110
+ sigma0 = df['sigma0']
1111
+ sigma1 = df['sigma1']
1112
+ sigma2 = df['sigma2']
1113
+ sigma3 = df['sigma3']
1114
+
1115
+ #data = dm.Finput('K-2-a-2.csv')
1116
+ dataA=[]
1117
+ dataA.append(dm.Finput('K-2-a-2-F0A.csv'))
1118
+ dataA.append(dm.Finput('K-2-a-2-F1A.csv'))
1119
+ dataA.append(dm.Finput('K-2-a-2-F2A.csv'))
1120
+ dataA.append(dm.Finput('K-2-a-2-F3A.csv'))
1121
+ dataB=[]
1122
+ dataB.append(dm.Finput('K-2-a-2-F0B.csv'))
1123
+ dataB.append(dm.Finput('K-2-a-2-F1B.csv'))
1124
+ dataB.append(dm.Finput('K-2-a-2-F2B.csv'))
1125
+ dataB.append(dm.Finput('K-2-a-2-F3B.csv'))
1126
+ target_point = np.array([[a / t, a / c, Ri / t]])
1127
+ z=[1./9.,10.0] #added by S.Sakai
1128
+ FA = np.zeros(4, dtype=float) # F0A..F3A
1129
+ for ith in range(1, 5): # 1,2,3,4 (→ F0A..F3A)
1130
+ #X_ith, W_ith = dm.CSV2XW(data, ith)
1131
+ X_ith,W_ith=dm.Fconv3D(dataA[ith-1],z) #modified by S.Sakai
1132
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1133
+ Fi, _sigma = dm.Eval(target_point)
1134
+ FA[ith - 1] = float(Fi)
1135
+
1136
+ FB = np.zeros(4, dtype=float) # F0B..F3B
1137
+ for ith in range(5, 9): # 5,6,7,8 (→ F0B..F3B)
1138
+ #X_ith, W_ith = dm.CSV2XW(data, ith)
1139
+ X_ith,W_ith=dm.Fconv3D(dataB[ith-5],z) #modified by S.Sakai
1140
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1141
+ Fi, _sigma = dm.Eval(target_point)
1142
+ FB[ith - 5] = float(Fi)
1143
+
1144
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3
1145
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3
1146
+
1147
+ Q = 1.0 + 1.464 * (a / c)**1.65
1148
+
1149
+ # 最深点の応力拡大係数
1150
+ KA = SA * np.sqrt(np.pi * a / Q)
1151
+
1152
+ # 表面点の応力拡大係数
1153
+ KB = SB * np.sqrt(np.pi * a / Q)
1154
+
1155
+ res = {
1156
+ 'KA': KA, 'KB': KB
1157
+ }
1158
+ super().SetRes(res)
1159
+
1160
+ class K_2_a_3(Base):
1161
+ # by S.Sakai
1162
+ def __init__(self):
1163
+ super().SetTitle('軸方向無い表面半楕円表面亀裂,Zahoorの解')
1164
+ super().SetRefer('Zahoor,A.:Ductile Fracture Handbook Volume 3,EPRI NP-6301-D,1991')
1165
+ def Calc(self):
1166
+ df=super().GetData()
1167
+ Ro=df['Ro']
1168
+ Ri=df['Ri']
1169
+ p=df['p']
1170
+ Sm=(Ro*Ro+Ri*Ri)/(Ro*Ro-Ri*Ri)*p
1171
+ a=df['a']
1172
+ c=df['c']
1173
+ t=df['t']
1174
+ ar=(a/t)/(a/c)**0.58
1175
+ FA=0.25+(0.4759*ar+0.1262*ar*ar)/(0.102*(Ri/t)-0.02)**0.1
1176
+ KA=FA*Sm*np.sqrt(np.pi*t)
1177
+ FB=FA*(1.06+0.28*(a/t)**2)*(a/c)**0.41
1178
+ KB=FB*Sm*np.sqrt(np.pi*t)
1179
+ res={'KA':KA,
1180
+ 'KB':KB}
1181
+ super().SetRes(res)
1182
+ class K_2_a_3(Base):
1183
+ def __init__(self):
1184
+ super().SetTitle('軸方向内表面半楕円表面き裂 Zahoor の解')
1185
+ super().SetRefer('Zahoor, A.: Ductile Fracture Handbook Volume 3, EPRI NP-6301-D, 1991')
1186
+
1187
+ # Applicable range: 0.05 ≤ a/t ≤ 0.85, 0.1 ≤ a/c ≤ 1, 0.2 ≤ α, 1 ≤ Ri/t ≤ 10
1188
+
1189
+ def Calc(self):
1190
+ df = super().GetData()
1191
+
1192
+ a = df['a'] # crack depth
1193
+ c = df['c'] # half surface crack length
1194
+ t = df['t'] # wall thickness
1195
+ Ri = df['Ri'] # inner radius
1196
+ Ro = df['Ro'] # outer radius
1197
+ p = df['p'] # internal pressure
1198
+
1199
+ sigma_m = ((Ro**2 + Ri**2) / (Ro**2 - Ri**2)) * p
1200
+ alpha = (a/t) / ((a/c)**0.58)
1201
+
1202
+ # 最深点の応力拡大係数
1203
+ denomA = (0.102*(Ri/t) - 0.02)**0.1
1204
+ FA = 0.25 + (0.4759*alpha + 0.1262*alpha**2) / denomA
1205
+ KA = FA * sigma_m * np.sqrt(np.pi * t)
1206
+
1207
+ # 表面点の応力拡大係数
1208
+ FB = FA * (1.06 + 0.28*(a/t)**2) * (a/c)**0.41
1209
+ KB = FB * sigma_m * np.sqrt(np.pi * t)
1210
+
1211
+ res = {'KA': KA, 'KB': KB}
1212
+ super().SetRes(res)
1213
+ class K_2_b_1(Base):
1214
+ def __init__(self):
1215
+ super().SetTitle('軸方向内表面長い表面き裂 Fuhley-Osage の解')
1216
+
1217
+ super().SetRefer(
1218
+ "American Petroleum Institute: Recommended Practice for Fitness-for-Service, "
1219
+ "API RP 579, 2000"
1220
+ )
1221
+
1222
+ # Applicable range: 0 ≤ a/t ≤ 0.8, 2 ≤ Ri/t ≤ 1000
1223
+
1224
+ def Calc(self):
1225
+ dm = dmanage()
1226
+ df = super().GetData()
1227
+
1228
+ a = df['a'] # crack depth
1229
+ t = df['t'] # thickness
1230
+ Ri = df['Ri'] # inner radius
1231
+ sigma0 = df['sigma0']
1232
+ sigma1 = df['sigma1']
1233
+ sigma2 = df['sigma2']
1234
+ sigma3 = df['sigma3']
1235
+ sigma4 = df['sigma4']
1236
+
1237
+ data = dm.Finput('K-2-b-1.csv')
1238
+ target_point = np.array([[a / t, Ri / t]])
1239
+
1240
+ F = np.zeros(5, dtype=float) # F0..F4
1241
+ for ith in range(1, 6): # 1,2,3,4,5 (→ F0..F4)
1242
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1243
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1244
+ Fi, _sigma = dm.Eval(target_point)
1245
+ F[ith - 1] = float(Fi)
1246
+
1247
+ # 応力拡大係数
1248
+ S = F[0]*sigma0 + F[1]*sigma1*(a/t) + F[2]*sigma2*(a/t)**2 + F[3]*sigma3*(a/t)**3 + F[4]*sigma4*(a/t)**4
1249
+ K = S * np.sqrt(np.pi * a)
1250
+
1251
+ res = {
1252
+ 'K': K
1253
+ }
1254
+ super().SetRes(res)
1255
+
1256
+ class K_2_b_2(Base):
1257
+ #by S.Sakai
1258
+ def __init__(self):
1259
+ super().SetTitle('軸方向内表面長い表面亀裂,Zahoorの解')
1260
+ super().SetRefer('Zahoor,A.:Closed Form Expressions for Fracture Mechanics Analysis of Cracked Pipes, Trans.ASME, J. of Pressure Vessel Technology,107,p.203,1987')
1261
+ def Calc(self):
1262
+ df=super().GetData()
1263
+ Ro=df['Ro']
1264
+ Ri=df['Ri']
1265
+ p=df['p']
1266
+ Sm=2*Ro*Ro/(Ro*Ro-Ri*Ri)*p
1267
+ a=df['a']
1268
+ t=Ro-Ri
1269
+ if Ri/t >=5.0 and Ri/t<10.0:
1270
+ A=(0.125*(Ri/t)-0.25)**0.25
1271
+ if Ri/t >=10.0 and Ri/t<=20.0:
1272
+ A=(0.2*(Ri/t)-1)**0.25
1273
+ F=1.1+A*(4.951*(a/t)**2+1.092*(a/t)**4)
1274
+ K=F*Sm*np.sqrt(np.pi*a)
1275
+ res={'K':K}
1276
+ super().SetRes(res)
1277
+ class K_2_c_1(Base):
1278
+ def __init__(self):
1279
+ super().SetTitle('軸方向外表面半楕円表面き裂 Fett らの解')
1280
+
1281
+ super().SetRefer(
1282
+ "Fett, T., Munz, D., and Neuman, J.: Local Stress Intensity Factors for Surface Cracks in Plates under Power-Shaped Stress Distributions, Engineering Fracture Mechanics, 36, 4, p. 647, 1990\n"
1283
+ "Raju, I. S. and Newman, J. C.: Stress Intensity Factor Influence Coefficients for Internal and External Surface Cracks in Cylindrical Vessels, ASME PVP, 58, p. 37, 1978"
1284
+ )
1285
+
1286
+ # Applicable range: 0 < a/t ≤ 0.8, 0.2 ≤ a/c ≤ 1, 4 ≤ Ri/t ≤ 10
1287
+
1288
+ def Calc(self):
1289
+ dm = dmanage()
1290
+ df = super().GetData()
1291
+
1292
+ a = df['a'] # crack depth
1293
+ t = df['t'] # wall thickness
1294
+ c = df['c'] # half surface crack length
1295
+ Ri = df['Ri'] # inner radius
1296
+ sigma0 = df['sigma0']
1297
+ sigma1 = df['sigma1']
1298
+ sigma2 = df['sigma2']
1299
+ sigma3 = df['sigma3']
1300
+
1301
+ #data = dm.Finput('K-2-c-1.csv')
1302
+ dataA=[]
1303
+ dataA.append(dm.Finput('K-2-c-1-F0A.csv'))
1304
+ dataA.append(dm.Finput('K-2-c-1-F1A.csv'))
1305
+ dataA.append(dm.Finput('K-2-c-1-F2A.csv'))
1306
+ dataA.append(dm.Finput('K-2-c-1-F3A.csv'))
1307
+ dataB=[]
1308
+ dataB.append(dm.Finput('K-2-c-1-F0B.csv'))
1309
+ dataB.append(dm.Finput('K-2-c-1-F1B.csv'))
1310
+ dataB.append(dm.Finput('K-2-c-1-F2B.csv'))
1311
+ dataB.append(dm.Finput('K-2-c-1-F3B.csv'))
1312
+ target_point = np.array([[a / t, a / c, Ri / t]])
1313
+ z=[4.0,10.0] #added by S.Sakai
1314
+ FA = np.zeros(4, dtype=float) # F0A..F3A
1315
+ for ith in range(1, 5): # 1,2,3,4 (→ F0A..F3A)
1316
+ #X_ith, W_ith = dm.CSV2XW(data, ith)
1317
+ X_ith,W_ith=dm.Fconv3D(dataA[ith-1],z) #modified by S.Sakai
1318
+ Fi, _sigma = dm.Eval(target_point)
1319
+ FA[ith - 1] = float(Fi)
1320
+
1321
+ FB = np.zeros(4, dtype=float) # F0B..F3B
1322
+ for ith in range(5, 9): # 5,6,7,8 (→ F0B..F3B)
1323
+ #X_ith, W_ith = dm.CSV2XW(data, ith)
1324
+ X_ith,W_ith=dm.Fconv3D(dataB[ith-5],z) #modified by S.Sakai
1325
+ Fi, _sigma = dm.Eval(target_point)
1326
+ FB[ith - 5] = float(Fi)
1327
+
1328
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3
1329
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3
1330
+
1331
+ # 最深点の応力拡大係数
1332
+ KA = SA * np.sqrt(np.pi * a)
1333
+
1334
+ # 表面点の応力拡大係数
1335
+ KB = SB * np.sqrt(np.pi * a)
1336
+
1337
+ res = {
1338
+ 'KA': KA, 'KB': KB
1339
+ }
1340
+ super().SetRes(res)
1341
+ class K_2_c_2(Base):
1342
+ def __init__(self):
1343
+ super().SetTitle('軸方向外表面半楕円表面き裂 Zahoor の解')
1344
+ super().SetRefer('Zahoor, A.: Ductile Fracture Handbook Volume 3, EPRI NP-6301-D, 1991')
1345
+
1346
+ # Applicable range: 0.05 ≤ a/t ≤ 0.85, 0.1 ≤ a/c ≤ 1, 0.2 ≤ α, 2 ≤ Ri/t ≤ 10
1347
+
1348
+ def Calc(self):
1349
+ df = super().GetData()
1350
+
1351
+ a = df['a'] # crack depth
1352
+ c = df['c'] #half surface crack length
1353
+ t = df['t'] # wall thickness
1354
+ Ri = df['Ri'] # inner radius
1355
+ Ro = df['Ro'] # outer radius
1356
+ p = df['p'] # internal pressure
1357
+
1358
+ # 最深点の応力拡大係数
1359
+ sigma_m = (2.0 * Ri**2 / (Ro**2 - Ri**2)) * p
1360
+ alpha = (a/t) / ((a/c)**0.58)
1361
+ denomA = (0.11*(Ri/t) - 0.1)**0.1
1362
+ FA = 0.25 + (0.42*alpha + 0.21*alpha**2) / denomA
1363
+ KA = FA * sigma_m * np.sqrt(np.pi * t)
1364
+
1365
+ # 表面点の応力拡大係数
1366
+ FB = FA * (1.0 + 0.33*(a/t)**2) * (a/c)**0.47
1367
+ KB = FB * sigma_m * np.sqrt(np.pi * t)
1368
+
1369
+ res = {'KA': KA, 'KB': KB}
1370
+ super().SetRes(res)
1371
+ class K_2_d(Base):
1372
+ def __init__(self):
1373
+ super().SetTitle('軸方向外表面長い表面き裂 Fuhley-Osage の解')
1374
+
1375
+ super().SetRefer(
1376
+ "American Petroleum Institute: Recommended Practice for Fitness-for-Service, "
1377
+ "API RP 579, 2000"
1378
+ )
1379
+
1380
+ # Applicable range: 0 ≤ a/t ≤ 0.8, 2 ≤ Ri/t ≤ 1000
1381
+
1382
+ def Calc(self):
1383
+ dm = dmanage()
1384
+ df = super().GetData()
1385
+
1386
+ a = df['a'] # crack depth
1387
+ t = df['t'] # wall thickness
1388
+ Ri = df['Ri'] # inner radius
1389
+ sigma0 = df['sigma0']
1390
+ sigma1 = df['sigma1']
1391
+ sigma2 = df['sigma2']
1392
+ sigma3 = df['sigma3']
1393
+ sigma4 = df['sigma4']
1394
+
1395
+ data = dm.Finput('K-2-d.csv')
1396
+ target_point = np.array([[a / t, Ri / t]])
1397
+
1398
+ F = np.zeros(5, dtype=float) # F0..F4
1399
+ for ith in range(1, 6): # 1,2,3,4,5 (→ F0..F4)
1400
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1401
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1402
+ Fi, _sigma = dm.Eval(target_point)
1403
+ F[ith - 1] = float(Fi)
1404
+
1405
+ S = F[0]*sigma0 + F[1]*sigma1*(a/t) + F[2]*sigma2*(a/t)**2 + F[3]*sigma3*(a/t)**3 + F[4]*sigma4*(a/t)**4
1406
+ K = S * np.sqrt(np.pi * a)
1407
+
1408
+ res = {
1409
+ 'K': K
1410
+ }
1411
+ super().SetRes(res)
1412
+ class K_2_e_1(Base):
1413
+ def __init__(self):
1414
+ super().SetTitle('軸方向貫通き裂 Erdogan-Kibler の解')
1415
+
1416
+ super().SetRefer(
1417
+ "Erdogan, F., and Kibler, J. J.: Cylindrical and Spherical Shells with Cracks, International Journal of Fracture Mechanics, 5, p. 229, 1969"
1418
+ )
1419
+
1420
+ # Applicable range: 0 < c/t ≤ 12.5, 10 ≤ Ri/t ≤ 20
1421
+
1422
+ def Calc(self):
1423
+ dm = dmanage()
1424
+ df = super().GetData()
1425
+
1426
+ c = df['c'] # half crack length
1427
+ t = df['t'] # wall thickness
1428
+ Ri = df['Ri'] # inner radius
1429
+ sigma_m = df['sigma_m']
1430
+ sigma_b = df['sigma_b']
1431
+
1432
+ data = dm.Finput('K-2-e-1.csv')
1433
+ target_point = np.array([[c / t, Ri / t]])
1434
+
1435
+ FA = np.zeros(2, dtype=float) # FmA, FbA
1436
+ for ith in range(1, 3): # 1,2 (→ FmA, FbA)
1437
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1438
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1439
+ Fi, _sigma = dm.Eval(target_point)
1440
+ FA[ith - 1] = float(Fi)
1441
+
1442
+ FB = np.zeros(2, dtype=float) # FmB, FbB
1443
+ for ith in range(3, 5): # 3,4 (→ FmB, FbB)
1444
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1445
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1446
+ Fi, _sigma = dm.Eval(target_point)
1447
+ FB[ith - 3] = float(Fi)
1448
+
1449
+ # 内表面における応力拡大係数
1450
+ KA = (FA[0]*sigma_m + FA[1]*sigma_b) * np.sqrt(np.pi * c)
1451
+
1452
+ # 外表面における応力拡大係数
1453
+ KB = (FB[0]*sigma_m + FB[1]*sigma_b) * np.sqrt(np.pi * c)
1454
+
1455
+ res = {
1456
+ 'KA': KA, 'KB': KB
1457
+ }
1458
+ super().SetRes(res)
1459
+
1460
+ class K_2_e_2(Base):
1461
+ #by S.Sakai
1462
+ def __init__(self):
1463
+ super().SetTitle('軸方向貫通亀裂,ASME Code Case N-513の解')
1464
+ super().SetRefer('ASME Boiler and Pressure Vessel Code, Code Case N-513, Evaluation Criteria for Temporary Acceptance of Flaws in Calss 3 Piping, 1997')
1465
+ def Calc(self):
1466
+ df=super().GetData()
1467
+ p=df['p']
1468
+ R=df['R']
1469
+ t=df['t']
1470
+ Sm=p*R/t
1471
+ c=df['c']
1472
+ l=c/np.sqrt(R*t)
1473
+ F=1+0.072449*l+0.64856*l*l-0.2327*l*l*l+0.038154*l**4-0.0023487*l**5
1474
+ K=F*Sm*np.sqrt(np.pi*c)
1475
+ res={'K':K}
1476
+ super().SetRes(res)
1477
+ class K_2_e_3(Base):
1478
+ def __init__(self):
1479
+ super().SetTitle('軸方向貫通き裂 Zang の解')
1480
+
1481
+ super().SetRefer(
1482
+ "Zang, W.: Stress Intensity Factor Solutions for Axial and Circumferential Through-Wall Cracks in Cylinders, "
1483
+ "SINTAP/SAQ/02, SAQ Control AB, 1997"
1484
+ )
1485
+
1486
+ # Applicable range: 0.5 ≤ c/t ≤ 25, 5 ≤ Ri/t ≤ 100
1487
+
1488
+ def Calc(self):
1489
+ dm = dmanage()
1490
+ df = super().GetData()
1491
+
1492
+ c = df['c'] # half crack length
1493
+ t = df['t'] # wall thickness
1494
+ Ri = df['Ri'] # inner radius
1495
+ sigma0 = df['sigma0']
1496
+ sigma1 = df['sigma1']
1497
+ sigma2 = df['sigma2']
1498
+ sigma3 = df['sigma3']
1499
+ sigma4 = df['sigma4']
1500
+
1501
+ data = dm.Finput('K-2-e-3.csv')
1502
+ target_point = np.array([[c / t, Ri / t]])
1503
+
1504
+ FA = np.zeros(5, dtype=float) # F0A..F4A
1505
+ for ith in range(1, 6): # 1..5 -> F0A..F4A
1506
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1507
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1508
+ Fi, _sigma = dm.Eval(target_point)
1509
+ FA[ith - 1] = float(Fi)
1510
+
1511
+ FB = np.zeros(5, dtype=float) # F0B..F4B
1512
+ for ith in range(6, 11): # 6..10 -> F0B..F4B
1513
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1514
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1515
+ Fi, _sigma = dm.Eval(target_point)
1516
+ FB[ith - 6] = float(Fi)
1517
+
1518
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3 + FA[4]*sigma4
1519
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3 + FB[4]*sigma4
1520
+
1521
+ # 内表面における応力拡大係数
1522
+ KA = SA * np.sqrt(np.pi * c)
1523
+
1524
+ # 外表面における応力拡大係数
1525
+ KB = SB * np.sqrt(np.pi * c)
1526
+
1527
+ res = {
1528
+ 'KA': KA, 'KB': KB
1529
+ }
1530
+ super().SetRes(res)
1531
+ class K_2_f_1(Base):
1532
+ def __init__(self):
1533
+ super().SetTitle('周方向内表面半楕円表面き裂 Chapuliot らの解')
1534
+ super().SetRefer(
1535
+ "Chapuliot, S.: Formulaire de KI Pour les Tubes Comportant un Defaut de Surface Semi-elliptique "
1536
+ "Longitudinal ou Circonférentiel, interne ou externe, Rapport CEA-R-5900, 2000"
1537
+ )
1538
+ # Applicable range: 0 < a/t ≤ 0.8, 0 < a/c ≤ 1, 1 ≤ Ri/t < ∞
1539
+
1540
+ def Calc(self):
1541
+ dm = dmanage()
1542
+ df = super().GetData()
1543
+
1544
+ a = df['a'] # crack depth
1545
+ t = df['t'] # wall thickness
1546
+ c = df['c'] # half surface crack length
1547
+ Ri = df['Ri'] # inner radius
1548
+ sigma0 = df['sigma0']
1549
+ sigma1 = df['sigma1']
1550
+ sigma2 = df['sigma2']
1551
+ sigma3 = df['sigma3']
1552
+ sigma_bg = df['sigma_bg']
1553
+
1554
+ data = dm.Finput('K-2-f-1.csv')
1555
+ target_point = np.array([[a / c, a / t, Ri / t]])
1556
+
1557
+ FA = np.zeros(5, dtype=float)
1558
+ for ith in range(1, 5 + 1):
1559
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1560
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1561
+ Fi, _sigma = dm.Eval(target_point)
1562
+ FA[ith - 1] = float(Fi)
1563
+
1564
+ FB = np.zeros(5, dtype=float)
1565
+ for ith in range(6, 10 + 1):
1566
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1567
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1568
+ Fi, _sigma = dm.Eval(target_point)
1569
+ FB[ith - 6] = float(Fi)
1570
+
1571
+ SA = FA[0]*sigma0 + FA[1]*sigma1*(a/t) + FA[2]*sigma2*(a/t)**2 + FA[3]*sigma3*(a/t)**3 + FA[4]*sigma_bg
1572
+ SB = FB[0]*sigma0 + FB[1]*sigma1*(a/t) + FB[2]*sigma2*(a/t)**2 + FB[3]*sigma3*(a/t)**3 + FB[4]*sigma_bg
1573
+
1574
+ # 最深点の応力拡大係数
1575
+ KA = SA * np.sqrt(np.pi * a)
1576
+
1577
+ # 表面点の応力拡大係数
1578
+ KB = SB * np.sqrt(np.pi * a)
1579
+
1580
+ res = {'KA': KA, 'KB': KB}
1581
+ super().SetRes(res)
1582
+ class K_2_f_2(Base):
1583
+ def __init__(self):
1584
+ super().SetTitle('周方向内表面半楕円表面き裂 白鳥の解')
1585
+
1586
+ super().SetRefer(
1587
+ "白鳥: 影響関数法による応力拡大係数の解析, 日本機械学会講習会教材, "
1588
+ "表面き裂―その解析と評価―, No. 900-2, p. 1, 1990"
1589
+ )
1590
+
1591
+ # Applicable range: 0.1 ≤ a/t ≤ 0.8, 0.2 ≤ a/c ≤ 1, 1.25 ≤ Ri/t ≤ 10
1592
+
1593
+ def Calc(self):
1594
+ dm = dmanage()
1595
+ df = super().GetData()
1596
+
1597
+ a = df['a'] # crack depth
1598
+ t = df['t'] # wall thickness
1599
+ c = df['c'] # half surface crack length
1600
+ Ri = df['Ri'] # inner radius
1601
+ sigma_m = df['sigma_m']
1602
+ sigma_bg = df['sigma_bg']
1603
+
1604
+ data = dm.Finput('K-2-f-2.csv')
1605
+ target_point = np.array([[a / t, a / c, Ri / t]])
1606
+
1607
+ FA = np.zeros(2, dtype=float) # FmA, FbgA
1608
+ for ith in range(1, 3): # 1,2 (→ FmA, FbgA)
1609
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1610
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1611
+ Fi, _sigma = dm.Eval(target_point)
1612
+ FA[ith - 1] = float(Fi)
1613
+
1614
+ FB = np.zeros(2, dtype=float) # FmB, FbgB
1615
+ for ith in range(3, 5): # 3,4 (→ FmB, FbgB)
1616
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1617
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1618
+ Fi, _sigma = dm.Eval(target_point)
1619
+ FB[ith - 3] = float(Fi)
1620
+
1621
+ Q = 1.0 + 1.464 * (a / c)**1.65
1622
+
1623
+ # 最深点の応力拡大係数
1624
+ SA = FA[0]*sigma_m + FA[1]*sigma_bg
1625
+ KA = SA * np.sqrt(np.pi * a / Q)
1626
+
1627
+ # 表面点の応力拡大係数
1628
+ SB = FB[0]*sigma_m + FB[1]*sigma_bg
1629
+ KB = SB * np.sqrt(np.pi * a / Q)
1630
+
1631
+ res = {
1632
+ 'KA': KA, 'KB': KB
1633
+ }
1634
+ super().SetRes(res)
1635
+ class K_2_f_3(Base):
1636
+ def __init__(self):
1637
+ super().SetTitle('周方向内表面半楕円表面き裂 Zahoor の解')
1638
+
1639
+ super().SetRefer(
1640
+ "Zahoor, A.: Closed Form Expressions for Fracture Mechanics Analysis of Cracked Pipes, "
1641
+ "Trans. ASME, J. of Pressure Vessel Technology, 107, p. 203, 1985\n"
1642
+ "Zahoor, A.: Ductile Fracture Handbook Volume 2, EPRI NP-6301-D, 1990"
1643
+ )
1644
+
1645
+ # Applicable range (軸方向荷重に対して):
1646
+ # 0.05 ≤ a/t ≤ 0.8, 1/6 ≤ a/c ≤ 2/3, 5 ≤ R/t ≤ 20
1647
+ # (曲げモーメントに対して):
1648
+ # 0.05 ≤ a/t ≤ 0.8, a/c ≤ 2/3, 5 ≤ R/t ≤ 160
1649
+
1650
+ def Calc(self):
1651
+ dm = dmanage()
1652
+ df = super().GetData()
1653
+
1654
+ a = df['a'] # crack depth
1655
+ t = df['t'] # wall thickness
1656
+ c = df['c'] # half surface crack length
1657
+ Ri = df['Ri'] # inner radius
1658
+ P = df['P'] # axial load
1659
+ M = df['M'] # bending moment
1660
+
1661
+ data = dm.Finput('K-2-f-3.csv')
1662
+ target_point = np.array([[a / t, a / c, Ri / t]])
1663
+
1664
+ X_1, W_1 = dm.CSV2XW(data, 1) # 1列目 → F_bg^A
1665
+ r2_score = dm.KrigCalc(X_1, W_1)
1666
+ FbgA, _sigma = dm.Eval(target_point)
1667
+ FbgA = float(FbgA)
1668
+
1669
+ sigma_m = P/(2.0*np.pi*Ri*t)
1670
+ sigma_bg = M/(np.pi*Ri**2*t)
1671
+ Q = 1.0 + 1.464 * (a / c)**1.65
1672
+ alpha = 2.0 * c / t
1673
+ FmA = (1.0 + (0.02 + 0.0103*alpha + 0.00617*alpha**2 + 0.0035*(1.0 + 0.7*alpha)*(Ri/t - 5.0)**0.7) * Q**2) / Q**0.5
1674
+
1675
+ # 最深点の応力拡大係数
1676
+ K = FmA*sigma_m * np.sqrt(np.pi * a) + FbgA*sigma_bg * np.sqrt(np.pi * t)
1677
+
1678
+ res = {
1679
+ 'K': K
1680
+ }
1681
+ super().SetRes(res)
1682
+ class K_2_g(Base):
1683
+ def __init__(self):
1684
+ super().SetTitle('周方向内表面扇形表面き裂 ASME Section XI, Appendix C の解')
1685
+ super().SetRefer('ASME Boiler and Pressure Vessel Code, Section XI, Rules for Inservice Inspection of Nuclear Power Plant Components, 2004')
1686
+
1687
+ # Applicable range: 0.08 ≤ a/t ≤ 0.8, 0 < a/c ≤ 1, 0.05 ≤ c/(πRi) ≤ 1
1688
+
1689
+ def Calc(self):
1690
+ df = super().GetData()
1691
+
1692
+ a = df['a'] # crack depth
1693
+ c = df['c'] # half surface crack length
1694
+ t = df['t'] # wall thickness
1695
+ Ri = df['Ri'] # inner radius
1696
+ R = df['R'] # mean radius
1697
+ P = df['P'] # axial load
1698
+ M = df['M'] # bending moment
1699
+
1700
+ sigma_m = P/(2.0*np.pi*R*t)
1701
+ sigma_bg = M/(np.pi*R**2*t)
1702
+
1703
+ cp = c/(np.pi*Ri)
1704
+ if 0.5 <= cp <= 1.0:
1705
+ cp = 0.5
1706
+
1707
+ x = (a/t)*cp
1708
+
1709
+ # 最深点の応力拡大係数
1710
+ FmA = 1.1 + (a/t)*(0.15241 + 16.722*x**0.855 - 14.944*x)
1711
+ FbgA = 1.1 + (a/t)*(-0.09967 + 5.0057*x**0.565 - 2.8329*x)
1712
+ KA = (FmA*sigma_m + FbgA*sigma_bg)*np.sqrt(np.pi*a)
1713
+
1714
+ res = {'KA': KA}
1715
+ super().SetRes(res)
1716
+
1717
+ class K_2_k_2(Base):
1718
+ def __init__(self):
1719
+ super().SetTitle('周方向貫通亀裂,ASME Code Case N-513の解')
1720
+ super().SetRefer('ASME Boiler and Pressure Vessel Code, Code Cae N-513,Evaluation Criteria for Temporary Acceptance of Flaws in Class 3 Piping,1997')
1721
+ def Calc(self):
1722
+ df=super().GetData()
1723
+ R=df['R']
1724
+ c=df['c']
1725
+ P=df['P']
1726
+ M=df['M']
1727
+ t=df['t']
1728
+ Sm=P/(2*np.pi*R*t)
1729
+ Sbg=M/(np.pi*R*R*t)
1730
+ evaluate_cubic = lambda x, c: c[0] + c[1]*x + c[2]*x**2 + c[3]*x**3
1731
+ x=R/t
1732
+ coeffs=[-2.02917,1.67763,-0.07987,0.00176]
1733
+ Am=evaluate_cubic(x,coeffs)
1734
+ coeffs=[7.09987,-4.42394,0.21036,-0.00463]
1735
+ Bm=evaluate_cubic(x,coeffs)
1736
+ coeffs=[7.79661,5.16676,-0.24577,0.00541]
1737
+ Cm=evaluate_cubic(x,coeffs)
1738
+ coeffs=[-3.26543,1.52784,-0.072698,0.0016011]
1739
+ Abg=evaluate_cubic(x,coeffs)
1740
+ coeffs=[11.36322,-3.91412,0.18619,-0.004099]
1741
+ Bbg=evaluate_cubic(x,coeffs)
1742
+ coeffs=[-3.18609,3.84763,-0.18304,0.00403]
1743
+ Cbg=evaluate_cubic(x,coeffs)
1744
+ evaluate_F = lambda x, c: c[0] + c[1]*x**1.5 + c[2]*x**2.5 + c[3]*x**3.5
1745
+ x=c/(np.pi*R)
1746
+ coeffs=[1,Am,Bm,Cm]
1747
+ Fm=evaluate_F(x,coeffs)
1748
+ coeffs=[1,Abg,Bbg,Cbg]
1749
+ Fbg=evaluate_F(x,coeffs)
1750
+ K=(Fm*Sm+Fbg*Sbg)*np.sqrt(np.pi*c)
1751
+ res={'K':K
1752
+ }
1753
+ super().SetRes(res)
1754
+
1755
+
1756
+ class L_1_a(Base):
1757
+ def __init__(self):
1758
+ super().SetTitle('平板の亀裂,半楕円表面亀裂')
1759
+ super().SetRefer('Dillstrom,P.andSattari-Far,I.:Limit Load Solutions for Surface Cracks in Plates and Cylinders, RSE R & D Report,No.2002/01,Det Norske Veritas AB 2002')
1760
+ def Calc(self):
1761
+ df=super().GetData()
1762
+ w=df['b']
1763
+ a=df['a']
1764
+ t=df['t']
1765
+ P=df['P']
1766
+ M=df['M']
1767
+ l=df['c']*2
1768
+ Sy=df['Sy']
1769
+ Sm=P/(2*w*t)
1770
+ Sb=3*M/(w*t*t)
1771
+ z=a*l/(t*(l+2*t))
1772
+ Lr=((1-z)**1.58*Sb/3+np.sqrt((1-z)**3.16*Sb*Sb/9+(1-z)**3.14*Sm*Sm))/((1-z)**2*Sy)
1773
+ res={'Lr':Lr}
1774
+ super().SetRes(res)
1775
+
1776
+
1777
+
1778
+ class L_2_b(Base):
1779
+ def __init__(self):
1780
+ super().SetTitle('軸方向内表面長い表面亀裂')
1781
+ super().SetRefer('Kumar V.,German M.D. and Shih C.F.:EPRI NP-1931,Electric Power Research Institute, Palo Alto,CA,July 1981')
1782
+ def Calc(self):
1783
+ df=super().GetData()
1784
+ a=df['a']
1785
+ t=df['t']
1786
+ Sy=df['Sy']
1787
+ Ri=df['Ri']
1788
+ p=df['p']
1789
+ z=a/t
1790
+ p0=(2/np.sqrt(3))*Sy*(t/Ri)
1791
+ pc=p0*((1-z)/(1+z/(Ri/t)))
1792
+ Lr=p/pc
1793
+ res={'Lr':Lr,
1794
+ 'pc':pc}
1795
+ super().SetRes(res)
1796
+
1797
+
1798
+
1799
+