ffseval 0.3.4__tar.gz

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 (69) hide show
  1. ffseval-0.3.4/FFSeval/FFS.py +1765 -0
  2. ffseval-0.3.4/FFSeval/Kriging.py +100 -0
  3. ffseval-0.3.4/FFSeval/__init__.py +0 -0
  4. ffseval-0.3.4/FFSeval/data/J-1-b-1.csv +24 -0
  5. ffseval-0.3.4/FFSeval/data/J-1-b-2.csv +24 -0
  6. ffseval-0.3.4/FFSeval/data/J-1-b.csv +48 -0
  7. ffseval-0.3.4/FFSeval/data/J-1-d.csv +24 -0
  8. ffseval-0.3.4/FFSeval/data/J-2-a.csv +140 -0
  9. ffseval-0.3.4/FFSeval/data/J-2-b.csv +90 -0
  10. ffseval-0.3.4/FFSeval/data/J-2-f.csv +88 -0
  11. ffseval-0.3.4/FFSeval/data/J-2-g-a.csv +88 -0
  12. ffseval-0.3.4/FFSeval/data/J-2-g-b.csv +63 -0
  13. ffseval-0.3.4/FFSeval/data/J-2-h.csv +66 -0
  14. ffseval-0.3.4/FFSeval/data/J-2-k-a-1.csv +71 -0
  15. ffseval-0.3.4/FFSeval/data/J-2-k-a-2.csv +54 -0
  16. ffseval-0.3.4/FFSeval/data/J-2-k-b.csv +130 -0
  17. ffseval-0.3.4/FFSeval/data/J-2-m.csv +224 -0
  18. ffseval-0.3.4/FFSeval/data/J-7-a.csv +19 -0
  19. ffseval-0.3.4/FFSeval/data/K-1-a-2.csv +136 -0
  20. ffseval-0.3.4/FFSeval/data/K-1-a-3.csv +80 -0
  21. ffseval-0.3.4/FFSeval/data/K-1-b-2.csv +15 -0
  22. ffseval-0.3.4/FFSeval/data/K-1-c-2.csv +16 -0
  23. ffseval-0.3.4/FFSeval/data/K-1-e-2-3-A.csv +13 -0
  24. ffseval-0.3.4/FFSeval/data/K-1-e-2-3-B.csv +13 -0
  25. ffseval-0.3.4/FFSeval/data/K-1-e-2.csv +50 -0
  26. ffseval-0.3.4/FFSeval/data/K-2-a-1.csv +144 -0
  27. ffseval-0.3.4/FFSeval/data/K-2-a-2.csv +160 -0
  28. ffseval-0.3.4/FFSeval/data/K-2-b-1.csv +50 -0
  29. ffseval-0.3.4/FFSeval/data/K-2-c-1.csv +153 -0
  30. ffseval-0.3.4/FFSeval/data/K-2-d.csv +50 -0
  31. ffseval-0.3.4/FFSeval/data/K-2-e-1.csv +56 -0
  32. ffseval-0.3.4/FFSeval/data/K-2-e-3.csv +160 -0
  33. ffseval-0.3.4/FFSeval/data/K-2-f-1.csv +550 -0
  34. ffseval-0.3.4/FFSeval/data/K-2-f-2.csv +200 -0
  35. ffseval-0.3.4/FFSeval/data/K-2-f-3.csv +91 -0
  36. ffseval-0.3.4/FFSeval/data/K-2-h-1.csv +50 -0
  37. ffseval-0.3.4/FFSeval/data/K-2-i-1.csv +550 -0
  38. ffseval-0.3.4/FFSeval/data/K-2-i-2.csv +200 -0
  39. ffseval-0.3.4/FFSeval/data/K-2-j.csv +50 -0
  40. ffseval-0.3.4/FFSeval/data/K-2-k-1.csv +96 -0
  41. ffseval-0.3.4/FFSeval/data/K-2-k-4.csv +264 -0
  42. ffseval-0.3.4/FFSeval/data/K-3-a.csv +60 -0
  43. ffseval-0.3.4/FFSeval/data/K-3-b-1.csv +48 -0
  44. ffseval-0.3.4/FFSeval/data/K-3-c-1.csv +10 -0
  45. ffseval-0.3.4/FFSeval/data/K-3-c-2.csv +10 -0
  46. ffseval-0.3.4/FFSeval/data/K-3-c-3.csv +10 -0
  47. ffseval-0.3.4/FFSeval/data/K-3-c.csv +42 -0
  48. ffseval-0.3.4/FFSeval/data/K-4-a-1.csv +64 -0
  49. ffseval-0.3.4/FFSeval/data/K-4-a-2.csv +16 -0
  50. ffseval-0.3.4/FFSeval/data/K-4-b-1.csv +16 -0
  51. ffseval-0.3.4/FFSeval/data/K-4-d.csv +16 -0
  52. ffseval-0.3.4/FFSeval/data/K-5-b-1.csv +8 -0
  53. ffseval-0.3.4/FFSeval/data/K-5-b-2.csv +13 -0
  54. ffseval-0.3.4/FFSeval/data/K-5-b-3.csv +42 -0
  55. ffseval-0.3.4/FFSeval/data/K-6-a.csv +60 -0
  56. ffseval-0.3.4/FFSeval/data/K-6-b.csv +60 -0
  57. ffseval-0.3.4/FFSeval/data/K-6-c.csv +52 -0
  58. ffseval-0.3.4/FFSeval/data/Rho.csv +14 -0
  59. ffseval-0.3.4/LICENSE +9 -0
  60. ffseval-0.3.4/MANIFEST.in +1 -0
  61. ffseval-0.3.4/PKG-INFO +64 -0
  62. ffseval-0.3.4/README.md +34 -0
  63. ffseval-0.3.4/ffseval.egg-info/PKG-INFO +64 -0
  64. ffseval-0.3.4/ffseval.egg-info/SOURCES.txt +67 -0
  65. ffseval-0.3.4/ffseval.egg-info/dependency_links.txt +1 -0
  66. ffseval-0.3.4/ffseval.egg-info/requires.txt +5 -0
  67. ffseval-0.3.4/ffseval.egg-info/top_level.txt +1 -0
  68. ffseval-0.3.4/setup.cfg +4 -0
  69. ffseval-0.3.4/setup.py +33 -0
@@ -0,0 +1,1765 @@
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
+ 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
+ xval=numlist
338
+ l+=1
339
+ continue
340
+ if l==3:
341
+ numlist=[float(x) for x in ll[:ny]]
342
+ yval=numlist
343
+ l+=1
344
+ continue
345
+ numlist=[float(x) for x in ll[:nx]]
346
+ res.append(numlist)
347
+ l+=1
348
+ arr=np.array(res)
349
+ df={}
350
+ df['xval']=xval
351
+ df['yval']=yval
352
+ df['arr']=arr
353
+ return df
354
+ def MakeInp(self,df:dict)->Tuple[np.ndarray, np.ndarray]:
355
+ '''
356
+ 辞書型データを,Kriging入力用のnp.arrayに変換する
357
+ '''
358
+ xval=df['xval']
359
+ yval=df['yval']
360
+ xn=len(xval)
361
+ yn=len(yval)
362
+ W=np.array([])
363
+ X=np.empty((0,2))
364
+ for iy in range(yn):
365
+ for ix in range(xn):
366
+ d=[yval[iy],xval[ix]]
367
+ X=np.append(X,[d], axis=0)
368
+ W=np.append(W,df['arr'][iy,ix])
369
+ return X,W
370
+ def CSV2XW(self,data:list,ith:int)->Tuple[np.ndarray, np.ndarray]:
371
+ df=self.dRead(data,ith)
372
+ X,W=self.MakeInp(df)
373
+ self.df=df
374
+ return X,W
375
+ def GetDf(self):
376
+ return self.df
377
+ def KrigCalc(self,X,W,alpha=5e-4):
378
+ self.krig=kr.Kriging()
379
+ self.krig.setData(X,W)
380
+ r2_score=self.krig.Fit(alpha=alpha)
381
+ return r2_score
382
+ def Eval(self,target_point:np.array)->float:
383
+ #target_point = np.array([[x, y]])
384
+ w_pred,sigma=self.krig.Predict(target_point)
385
+ return w_pred[0],sigma
386
+ def DrawRes(self,X,W)->None:
387
+ # 1. 描画用のメッシュグリッドを作成
388
+ x = np.linspace(np.min(X[:,0]), np.max(X[:,0]), 50)
389
+ y = np.linspace(np.min(X[:,1]), np.max(X[:,1]), 50)
390
+ X_grid, Y_grid = np.meshgrid(x, y)
391
+
392
+ # 2. メッシュ座標を一次元にして予測
393
+ XY = np.vstack([X_grid.ravel(), Y_grid.ravel()]).T
394
+
395
+ # Kriging モデルで予測(タプルで返る)
396
+ Z_pred, _ = self.krig.Predict(XY)
397
+
398
+ # 予測値をグリッド形状に整形
399
+ Z_grid = Z_pred.reshape(X_grid.shape)
400
+
401
+ # 4. 描画
402
+ fig = plt.figure(figsize=(10, 7))
403
+ ax = fig.add_subplot(111, projection='3d')
404
+
405
+ # 予測面
406
+ ax.plot_surface(X_grid, Y_grid, Z_grid, cmap='viridis', alpha=0.7)
407
+
408
+ # 元データ点も重ねる
409
+ #ax.scatter(X[:,0], X[:,1], W, color='r', s=30, label='Data points')
410
+ # 予測に使ったデータ点を赤い球で表示
411
+ ax.scatter(X[:, 0], X[:, 1], W, color='black', s=30, marker='^', label='Training data')
412
+ # 軸ラベル
413
+ ax.set_xlabel('X')
414
+ ax.set_ylabel('Y')
415
+ ax.set_zlabel('W')
416
+
417
+ # タイトル・凡例
418
+ ax.set_title('Kriging Model Surface')
419
+ ax.legend()
420
+ plt.show()
421
+ class J_2_k_a(Base):
422
+ #by S.Sakai
423
+ def __init__(self):
424
+ super().SetTitle('周方向貫通亀裂 Zahoorの解')
425
+ super().SetRefer('Zahoor, A.:Ductile Fracture Handbook Volume 1,EPRI NP-6301-D,1989')
426
+ # Kriging法による応答曲面を計算
427
+ self.dm_P=dmanage()
428
+ data=self.dm_P.Finput('J-2-k-a-1.csv')
429
+ z=[5.0,10.0,20.0]
430
+ X,W=self.dm_P.Fconv3D(data,z)
431
+ r2_score=self.dm_P.KrigCalc(X,W)
432
+ self.dm_M=dmanage()
433
+ data=self.dm_M.Finput('J-2-k-a-2.csv')
434
+ z=[5.0,10.0,20.0]
435
+ X,W=self.dm_M.Fconv3D(data,z)
436
+ r2_score=self.dm_M.KrigCalc(X,W)
437
+ def Calc(self):
438
+ df=super().GetData()
439
+ th=df['th']
440
+ plane=df['plane']
441
+ if plane=='stress': beta=2
442
+ if plane=='strain': beta=6
443
+ M=df['M']
444
+ R=df['R']
445
+ t=df['t']
446
+ P=df['P']
447
+ S0=df['S0']
448
+ alpha=df['alpha']
449
+ e0=df['e0']
450
+ n=df['n']
451
+ E=df['E']
452
+ A=0.0
453
+ P0=2.0*S0*R*t*(np.pi-th-2.0*np.arcsin(0.5*np.sin(th)))
454
+ M0=4.0*S0*R*R*t*(np.cos(th/2.0)-0.5*np.sin(th))
455
+ if df['Case']=='Collapse': #塑性崩壊値の計算
456
+ res={
457
+ 'P0':P0,
458
+ 'M0':M0
459
+ }
460
+ super().SetRes(res)
461
+ return
462
+ if R/t >= 5.0 and R/t<10.0:
463
+ A=(0.125*(R/t)-0.25)**0.25
464
+ if R/t>=10.0 and R/t<=20.0:
465
+ A=(0.4*R/t-3.0)**0.25
466
+ if plane=='stress': beta=2
467
+ if plane=='strain': beta=6
468
+ if df['Case']=='PR': #塑性崩壊強度の計算
469
+ pass #将来開発すること
470
+ if df['Case']=='PJ':
471
+ target_point=np.array([[th/np.pi,n,R/t]])
472
+ H1,sigma=self.dm_P.Eval(target_point)
473
+ Ft=1.0+A*(5.3303*(th/np.pi)**1.5+18.773*(th/np.pi)**4.24)
474
+ St=P/(2.0*np.pi*R*t)
475
+ the=th*(1.0+(Ft*Ft/beta)*(n-1)/(n+1)*(St/S0)**2/(1+(P/P0)**2))
476
+ ft=(the/np.pi)*(1.0+A*(5.3303*(the/np.pi)**1.5+18.773*(the/np.pi)**4.24))**2
477
+ J=ft*P*P/(4.0*np.pi*R*t*t*E)+alpha*S0*e0*(np.pi-th)*H1*(P/P0)**(n+1)
478
+ res={'J':J}
479
+ super().SetRes(res)
480
+ return
481
+ if df['Case']=='MR': #塑性崩壊強度の計算
482
+ target_point=np.array([[th/np.pi,n,R/t]])
483
+ H1,sigma=self.dm_M.Eval(target_point)
484
+ JR=df['JR']
485
+ MR=M0*(JR/(alpha*S0*e0*np.pi*R*(1.0-th/np.pi)**2*H1))**(1./(n+1.))
486
+ res={'MR':MR,
487
+ 'M0':M0,
488
+ 'H1':H1}
489
+ super().SetRes(res)
490
+ return
491
+ if df['Case']=='MJ':
492
+ target_point=np.array([[th/np.pi,n,R/t]])
493
+ H1,sigma=self.dm_M.Eval(target_point)
494
+ Sb=M/(np.pi*R*R*t)
495
+
496
+ Fb=1.0+A*(4.5967*(th/np.pi)**1.5+2.6422*(th/np.pi)**4.24)
497
+ the=th*(1.0+Fb*Fb/beta*(n-1)/(n+1)*(Sb/S0)**2/(1+(M/M0)**2))
498
+ fb=(the/np.pi)*(1.0+A*(4.5967*(the/np.pi)**1.5+2.6422*(the/np.pi)**4.24))**2
499
+ 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)
500
+ res={'J':J,
501
+ 'M0':M0,
502
+ 'H1':H1}
503
+ super().SetRes(res)
504
+ class J_2_k_b(Base):
505
+ #by S.Sakai
506
+ def __init__(self):
507
+ super().SetTitle('周方向貫通亀裂 Zahoorの解')
508
+ super().SetRefer('Zahoor, A.:Ductile Fracture Handbook Volume 1,EPRI NP-6301-D,1989')
509
+
510
+
511
+
512
+ def Calc(self):
513
+ df=super().GetData()
514
+ th=df['Th']/180.0*np.pi
515
+ plane=df['plane']
516
+ if plane=='stress': beta=2
517
+ if plane=='strain': beta=6
518
+ M=df['M']
519
+ R=df['R']
520
+ t=df['t']
521
+ P=df['P']
522
+ St=P/(2.*np.pi*R*t)
523
+ Sb=M/(np.pi*R*R*t)
524
+ S0=df['S0']
525
+ P0=2*S0*R*t*(np.pi-th-2*np.arcsin(0.5*np.sin(th)))
526
+ M0=4*S0*R*R*t*(np.cos(th/2)-0.5*np.sin(th))
527
+ lam=M/P/R
528
+ P0d=0.5*(-lam*R*P0*P0/M0+np.sqrt((lam*R*P0*P0/M0)**2+4*P0*P0))
529
+ n=df['n']
530
+ dm=dmanage()
531
+ x=lam/(1.+lam)
532
+ data=dm.Finput('J-2-k-b.csv')
533
+ z=[0.0625,0.125,0.25,0.37,0.50]#三次元目のデータリスト(表の数だけ存在)
534
+ X,W=dm.Fconv3D(data,z)
535
+ r2_score=dm.KrigCalc(X,W)
536
+ target_point=np.array([[x,n,th/np.pi]])
537
+ h1,sigma=dm.Eval(target_point)
538
+ E=df['E']
539
+ alpha=df['alpha']
540
+ e0=df['e0']
541
+ the=th*(1+(1/beta)*((n-1)/(n+1))*((St*Ft+Sb*Fb)**2/S0/S0)/(1+(P/P0d)**2))
542
+ ft=(the/np.pi)*(1+A*(5.3303*(the/np.pi)**1.5+18.773*(the/np.pi)**4.24))**2
543
+ fb=(the/np.pi)*(1+A*(4.5967*(the/np.pi)**1.5+2.6422*(the/np.pi)**4.24))**2
544
+ 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)
545
+ res={'J':J}
546
+ super().SetRes(res)
547
+ class J_7_a(Base):
548
+ #by S.Sakai
549
+ def __init__(self):
550
+ super().SetTitle('円孔縁のき裂 片側貫通亀裂 Zahoorの解')
551
+ super().SetRefer('Zahoor, A.:Ductile Fracture Handbook Volume 3,EPRI NP-6301-D,1991')
552
+ def Calc(self):
553
+ dm=dmanage()
554
+ df=super().GetData()
555
+
556
+ a=df['a']
557
+ R=df['R']
558
+ alpha=df['alpha']
559
+ n=df['n']
560
+ S=df['sigma'] # σ
561
+ S0=df['sigma0'] # σ0
562
+ E = df['E']
563
+ e0=S0/E # ε0
564
+
565
+ data=dm.Finput('J-7-a.csv')
566
+ ith=1
567
+ X,W=dm.CSV2XW(data,ith)
568
+ r2_score=dm.KrigCalc(X,W)
569
+ target_point=np.array([[a/R,n]])
570
+ H1,sigma=dm.Eval(target_point)
571
+
572
+ a_over_R=a/R #代入してみましたが、代入するのとしないのとどちらが良いですか?
573
+ B0=(4.0/3.0)/(1-0.08696*(1+0.5*a_over_R))**2
574
+ 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)
575
+ ae=a*(1+0.5*F**2*((n-1)/(n+1))*((S/S0)**2/(1+B0*(S/S0)**2)))
576
+ ae_over_R=ae/R #代入してみましたが、代入するのとしないのとどちらが良いですか?
577
+ 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
578
+ #J=f*R*S**2/E+alpha*S0*e0*H1*(S/S0)**(n+1)
579
+ J=f*R*S**2/E+alpha*S0*e0*R*H1*(S/S0)**(n+1) #R*が抜けていなした
580
+
581
+ #res={'J':J,
582
+ #'H1':H1}
583
+ res={'J':J}#H1は戻す必要はありません
584
+ super().SetRes(res)
585
+
586
+
587
+ class K_1_a_1(Base):
588
+ #by S.Sakai
589
+ def __init__(self):
590
+ super().SetTitle('平板の半楕円表面亀裂,Raju-Newmanの解')
591
+ 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')
592
+ def Calc(self):
593
+ df=super().GetData()
594
+ a=df['a']
595
+ c=df['c']
596
+ b=df['b']
597
+ t=df['t']
598
+ P=df['P']
599
+ M=df['M']
600
+ Sm=P/(2*b*t)
601
+ Sb=3*M/(b*t*t)
602
+ if a/c <=1.0:
603
+ Q=1+1.464*(a/c)**1.65
604
+ g=1
605
+ fphai=1
606
+ fw=np.sqrt(1.0/np.cos(np.pi*c/(2*b)*np.sqrt(a/t)))
607
+ 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
608
+ 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
609
+ else:
610
+ Q=1+1.464*(c/a)**1.65
611
+ g=1
612
+ fphai=np.sqrt(c/a)
613
+ fw=np.sqrt(1.0/np.cos(np.pi*c/(2*b)*np.sqrt(a/t)))
614
+ 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
615
+ 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
616
+ KA=FA*(Sm+H*Sb)*np.sqrt(np.pi*a/Q)
617
+ if a/c <=1.0:
618
+ Q=1+1.464*(a/c)**1.65
619
+ g=1.1+0.35*(a/t)**2
620
+ fphai=np.sqrt(a/c)
621
+ fw=np.sqrt(1.0/np.cos(np.pi*c/(2*b)*np.sqrt(a/t)))
622
+ 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
623
+ H=1-0.34*a/t-0.11*a/c*a/t
624
+ else:
625
+ Q=1+1.464*(c/a)**1.65
626
+ g=1.1+0.35*c/a*(a/t)**2
627
+ fphai=1
628
+ fw=np.sqrt(1.0/np.cos(np.pi*c/(2*b)*np.sqrt(a/t)))
629
+ 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
630
+ 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
631
+ KB=FB*(Sm+H*Sb)*np.sqrt(np.pi*a/Q)
632
+ res={
633
+ 'KA':KA,
634
+ 'KB':KB
635
+ }
636
+ super().SetRes(res)
637
+ class K_1_a_2(Base):
638
+ #by S.Sakai
639
+ def __init__(self):
640
+ super().SetTitle('半楕円表面き裂 ASME Section XI, Appendix A の解')
641
+
642
+ super().SetRefer(
643
+ "ASME Boiler and Pressure Vessel Code, Section XI, Rules for Inservice Inspection of Nuclear Power Plant Components, 2004\n"
644
+ "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"
645
+ )
646
+
647
+ # Applicable range: 0 < a/t ≤ 0.8, 0 < a/c ≤ 1
648
+
649
+ def Calc(self):
650
+ dm = dmanage()
651
+ df = super().GetData()
652
+
653
+ a = df['a'] # crack depth
654
+ t = df['t'] # thickness
655
+ c = df['c'] # half surface length
656
+ sigma0 = df['sigma0']
657
+ sigma1 = df['sigma1']
658
+ sigma2 = df['sigma2']
659
+ sigma3 = df['sigma3']
660
+ sigmaY = df['Sy']
661
+
662
+ data = dm.Finput('K-1-a-2.csv')
663
+ target_point = np.array([[a / t, a / c]])
664
+
665
+ FA = np.zeros(4, dtype=float) # F0A..F3A
666
+ for ith in range(1, 5): # 1,2,3,4 (→ F0A..F3A)
667
+ X_ith, W_ith = dm.CSV2XW(data, ith)
668
+ r2_score = dm.KrigCalc(X_ith, W_ith)
669
+ Fi, _sigma = dm.Eval(target_point)
670
+ FA[ith - 1] = float(Fi)
671
+
672
+ FB = np.zeros(4, dtype=float) # F0B..F3B
673
+ for ith in range(5, 9): # 5,6,7,8 (→ F0B..F3B)
674
+ X_ith, W_ith = dm.CSV2XW(data, ith)
675
+ r2_score = dm.KrigCalc(X_ith, W_ith)
676
+ Fi, _sigma = dm.Eval(target_point)
677
+ FB[ith - 5] = float(Fi)
678
+
679
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3
680
+ qyA = (SA**2) / (6.0 * sigmaY**2)
681
+ QA = 1.0 + 1.464 * (a / c)**1.65 - qyA
682
+ KA = SA * np.sqrt(np.pi * a / QA)
683
+
684
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3
685
+ qyB = (SB**2) / (6.0 * sigmaY**2)
686
+ QB = 1.0 + 1.464 * (a / c)**1.65 - qyB
687
+ KB = SB * np.sqrt(np.pi * a / QB)
688
+
689
+ res = {
690
+ 'KA': KA, 'KB': KB
691
+ }
692
+ super().SetRes(res)
693
+ class K_1_a_3(Base):
694
+ #by S.Sakai
695
+ def __init__(self):
696
+ super().SetTitle('半楕円表面き裂 白鳥の解')
697
+
698
+ super().SetRefer(
699
+ "白鳥: 影響関数法による応力拡大係数の解析, 日本機械学会講習会教材, 表面き裂—その解析と評価—, No.900-2, p. 1, 1990"
700
+ )
701
+
702
+ # Applicable range: 0.1 ≤ a/t ≤ 0.8, 0.2 ≤ a/c ≤ 2
703
+
704
+ def Calc(self):
705
+ dm = dmanage()
706
+ df = super().GetData()
707
+
708
+ a = df['a'] # crack depth
709
+ t = df['t'] # thickness
710
+ c = df['c'] # half surface length
711
+ sigma0 = df['sigma0']
712
+ sigma1 = df['sigma1']
713
+ sigma2 = df['sigma2']
714
+ sigma3 = df['sigma3']
715
+ # sigma0, sigma1, sigma2, sigma3 は、き裂深さ方向の応力分布
716
+ # σ = σ0 + σ1·ξ + σ2·ξ² + σ3·ξ³
717
+ # における多項式展開の係数を表す
718
+ # ここで ξ = 1 - u/a (u:表面からの距離,a:き裂深さ)
719
+ data = dm.Finput('K-1-a-3.csv')
720
+ target_point = np.array([[a / t, a / c]])
721
+
722
+ FA = np.zeros(4, dtype=float) # F0A..F3A
723
+ for ith in range(1, 5): # 1,2,3,4 (→ F0A..F3A)
724
+ X_ith, W_ith = dm.CSV2XW(data, ith)
725
+ r2_score = dm.KrigCalc(X_ith, W_ith)
726
+ Fi, _sigma = dm.Eval(target_point)
727
+ FA[ith - 1] = float(Fi)
728
+
729
+ FB = np.zeros(4, dtype=float) # F0B..F3B
730
+ for ith in range(5, 9): # 5,6,7,8 (→ F0B..F3B)
731
+ X_ith, W_ith = dm.CSV2XW(data, ith)
732
+ r2_score = dm.KrigCalc(X_ith, W_ith)
733
+ Fi, _sigma = dm.Eval(target_point)
734
+ FB[ith - 5] = float(Fi)
735
+
736
+ Q = 1.0 + 1.464 * (a / c)**1.65
737
+
738
+ # 最深点の応力拡大係数
739
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3
740
+ KA = SA * np.sqrt(np.pi * a / Q)
741
+
742
+ # 表面点の応力拡大係数
743
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3
744
+ KB = SB * np.sqrt(np.pi * a / Q)
745
+
746
+ res = {
747
+ 'KA': KA, 'KB': KB
748
+ }
749
+ super().SetRes(res)
750
+ class K_1_b_1(Base):
751
+ def __init__(self):
752
+ super().SetTitle('長い表面き裂(片側) Tada らの解')
753
+ super().SetRefer('Tada, H., Paris, P. C.,and Irwin, G. R.: The Stress Analysis of Cracks Handbook, Third edition, ASME, 2000')
754
+
755
+ # Applicable range: 0 < a/t < 1
756
+
757
+ def Calc(self):
758
+ df = super().GetData()
759
+
760
+ a = df['a'] # crack depth
761
+ t = df['t'] # thickness
762
+ b = df['b'] # half width
763
+ P = df['P'] # axial load
764
+ M = df['M'] # bending moment
765
+
766
+ sigma_m = P / (2.0 * b * t)
767
+ sigma_b = 3.0 * M / (b * t**2)
768
+ theta = np.pi * a / (2.0 * t)
769
+ root_term = np.sqrt((2.0 * t) / (np.pi * a) * np.tan(theta))
770
+ cos_term = np.cos(theta)
771
+ Fm = root_term * (0.752 + 2.02 * (a / t) + 0.37 * (1.0 - np.sin(theta))**3) / cos_term
772
+ Fb = root_term * (0.923 + 0.199 * (1.0 - np.sin(theta))**4) / cos_term
773
+
774
+ K = (Fm * sigma_m + Fb * sigma_b) * np.sqrt(np.pi * a)
775
+
776
+ res = {'K': K}
777
+ super().SetRes(res)
778
+ class K_1_c_1(Base):
779
+ def __init__(self):
780
+ super().SetTitle('長い表面き裂(両側) Tada らの解')
781
+ super().SetRefer('Tada, H., Paris, P. C., and Irwin, G. R.: The Stress Analysis of Cracks Handbook, Third edition, ASME, 2000')
782
+
783
+ # Applicable range: 0 < a/t < 0.5
784
+
785
+ def Calc(self):
786
+ df = super().GetData()
787
+
788
+ a = df['a'] # crack depth
789
+ t = df['t'] # thickness
790
+ b = df['b'] # half width
791
+ P = df['P'] # axial load
792
+ M = df['M'] # bending moment
793
+
794
+ sigma_m = P / (2.0 * b * t)
795
+ theta = np.pi * a / t
796
+ Fm = (1.0 + 0.122 * np.cos(theta)**4) * np.sqrt((t / (np.pi * a)) * np.tan(theta))
797
+
798
+ K = Fm * sigma_m * np.sqrt(np.pi * a)
799
+
800
+ res = {'K': K}
801
+ super().SetRes(res)
802
+
803
+ class K_1_d_1(Base):
804
+ def __init__(self):
805
+ super().SetTitle('中央貫通き裂 Shih らの解(き裂が短い場合)')
806
+ 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')
807
+
808
+ # Applicable range: 0 < c/b ≤ 0.15
809
+
810
+ def Calc(self):
811
+ df = super().GetData()
812
+
813
+ c = df['c'] # crack half-length
814
+ t = df['t'] # thickness
815
+ b = df['b'] # half width
816
+ P = df['P'] # axial load
817
+ M = df['M'] # bending moment
818
+
819
+ sigma_m = P/(2.0*b*t)
820
+ sigma_b = 3.0*M/(b*t**2)
821
+
822
+ #開口側の応力拡大係数
823
+
824
+ FmA, FbA = 1.0, 1.0
825
+
826
+ KA = (FmA*sigma_m + FbA*sigma_b)*np.sqrt(np.pi*c)
827
+
828
+ #閉口側の応力拡大係数
829
+
830
+ FmB, FbB = 1.0, -1.0
831
+
832
+ KB = (FmB*sigma_m + FbB*sigma_b)*np.sqrt(np.pi*c)
833
+
834
+ res = {'KA': KA, 'KB': KB}
835
+ super().SetRes(res)
836
+ class K_1_d_2(Base):
837
+ def __init__(self):
838
+ super().SetTitle('中央貫通き裂 Tada らの解(き裂が長い場合)')
839
+ super().SetRefer('Tada, H., Paris, P. C., and Irwin, G. R.: The Stress Analysis of Cracks Handbook, Third edition, ASME, 2000')
840
+
841
+ # Applicable range: 0 < c/b < 1
842
+
843
+ def Calc(self):
844
+ df = super().GetData()
845
+
846
+ c = df['c'] # crack half-length
847
+ t = df['t'] # thickness
848
+ b = df['b'] # half width
849
+ P = df['P'] # axial load
850
+ M = df['M'] # bending moment
851
+
852
+ sigma_m = P/(2.0*b*t)
853
+ ratio = c/b
854
+ theta = np.pi*c/(2.0*b)
855
+ Fm = (1.0 - 0.025*ratio**2 + 0.06*ratio**4) / np.sqrt(np.cos(theta))
856
+
857
+ K = Fm * sigma_m * np.sqrt(np.pi*c)
858
+
859
+ res = {'K': K}
860
+ super().SetRes(res)
861
+ class K_1_e_1(Base):
862
+ def __init__(self):
863
+ super().SetTitle('楕円内部き裂 Ovchinnikov–Vasiltchenko の解')
864
+ 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")
865
+
866
+ # Applicable range: 0 < a/t ≤ 0.45(1 - 2e/t), 0 < a/c ≤ 1, 0 ≤ e/t ≤ 0.5, 0 < c/b ≤ 0.15
867
+
868
+ def Calc(self):
869
+ df = super().GetData()
870
+
871
+ a = df['a'] # crack depth (semi-minor)
872
+ c = df['c'] # crack half-length (semi-major)
873
+ t = df['t'] # thickness
874
+ b = df['b'] # half width
875
+ e = df['e'] # offset from mid-plane
876
+ P = df['P'] # axial load
877
+ M = df['M'] # bending moment
878
+
879
+ sigma_m = P/(2.0*b*t)
880
+ sigma_b = 3.0*M/(b*t**2)
881
+
882
+ ac = a/c
883
+ at = a/t
884
+ et = e/t
885
+ L = (2.0*at)/(1.0 - 2.0*et)
886
+
887
+ #評価点Aにおける応力拡大係数
888
+
889
+ denom_A = (1.0 - (L**1.8)*(1.0 - 0.4*ac - et**2))**0.54
890
+ FmA = (1.01 - 0.37*ac)/denom_A
891
+ FbA = (1.01 - 0.37*ac)*(2.0*et + at + 0.34*ac*at)/denom_A
892
+
893
+ KA = (FmA*sigma_m + FbA*sigma_b)*np.sqrt(np.pi*a)
894
+
895
+ #評価点Bにおける応力拡大係数
896
+
897
+ denom_B = (1.0 - (L**1.8)*(1.0 - 0.4*ac - 0.8*et**2))**0.54
898
+ FmB = (1.01 - 0.37*ac)/denom_B
899
+ FbB = (1.01 - 0.37*ac)*(2.0*et + at + 0.34*ac*at)/denom_B
900
+
901
+ KB = (FmB*sigma_m + FbB*sigma_b)*np.sqrt(np.pi*a)
902
+
903
+ res = {'KA': KA, 'KB': KB}
904
+ super().SetRes(res)
905
+ class K_1_e_2(Base):
906
+ def __init__(self):
907
+ super().SetTitle('楕円内部き裂 ASME Section XI, Appendix A の解')
908
+
909
+ super().SetRefer(
910
+ "ASME Boiler and Pressure Vessel Code, Section XI, Rules for Inservice Inspection of Nuclear Power Plant Components, 2004"
911
+ )
912
+
913
+ # Applicable range: 0.075 < a/t ≤ 0.325, 0 ≤ e/t ≤ 0.35
914
+
915
+ def Calc(self):
916
+ dm = dmanage()
917
+ df = super().GetData()
918
+
919
+ a = df['a'] # crack half-depth (semi-minor axis)
920
+ b = df['b'] # plate half-width
921
+ c = df['c'] # crack half-length (semi-major axis)
922
+ t = df['t'] # thickness
923
+ e = df['e'] # offset from mid-thickness
924
+ P = df['P'] # axial force
925
+ M = df['M'] # bending moment
926
+ Sy = df['Sy'] # yield strength
927
+
928
+ sigma_m = P / (2.0 * b * t)
929
+ sigma_b = 3.0 * M / (b * t**2)
930
+
931
+ data = dm.Finput('K-1-e-2.csv')
932
+ target_point = np.array([[a / t, e / t]])
933
+
934
+ # 1 -> FmA, 2 -> FmB, 3 -> FbA, 4 -> FbB
935
+
936
+ X1, W1 = dm.CSV2XW(data, 1)
937
+ r2_score = dm.KrigCalc(X1, W1)
938
+ FmA, _sigma = dm.Eval(target_point)
939
+ FmA = float(FmA)
940
+
941
+ X2, W2 = dm.CSV2XW(data, 2)
942
+ r2_score = dm.KrigCalc(X2, W2)
943
+ FmB, _sigma = dm.Eval(target_point)
944
+ FmB = float(FmB)
945
+
946
+ X3, W3 = dm.CSV2XW(data, 3)
947
+ r2_score = dm.KrigCalc(X3, W3)
948
+ FbA, _sigma = dm.Eval(target_point)
949
+ FbA = float(FbA)
950
+
951
+ X4, W4 = dm.CSV2XW(data, 4)
952
+ r2_score = dm.KrigCalc(X4, W4)
953
+ FbB, _sigma = dm.Eval(target_point)
954
+ FbB = float(FbB)
955
+
956
+ # 評価点Aにおける応力拡大係数
957
+ SA = FmA * sigma_m + FbA * sigma_b
958
+ qyA = (SA**2) / (6.0 * Sy**2)
959
+ QA = 1.0 + 1.464 * (a / c)**1.65 - qyA
960
+ KA = SA * np.sqrt(np.pi * a / QA)
961
+
962
+ # 評価点Bにおける応力拡大係数
963
+ SB = FmB * sigma_m + FbB * sigma_b
964
+ qyB = (SB**2) / (6.0 * Sy**2)
965
+ QB = 1.0 + 1.464 * (a / c)**1.65 - qyB
966
+ KB = SB * np.sqrt(np.pi * a / QB)
967
+
968
+ super().SetRes({'KA': KA, 'KB': KB})
969
+ class K_1_e_3(Base):
970
+ def __init__(self):
971
+ super().SetTitle('楕円内部き裂 Raju–Newman の解')
972
+ 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')
973
+
974
+ # Applicable range: c/b < 0.5
975
+
976
+ def Calc(self):
977
+ df = super().GetData()
978
+
979
+ a = df['a'] # crack semi-minor (depth)
980
+ c = df['c'] # crack semi-major (half-length)
981
+ t = df['t'] # thickness
982
+ b = df['b'] # half width
983
+ P = df['P'] # axial load
984
+
985
+ sigma_m = P/(2.0*b*t)
986
+
987
+ ac = a/c
988
+ at = a/t
989
+ theta_w = (np.pi*c/(2.0*b))*np.sqrt(at)
990
+ f_w = (1.0/np.cos(theta_w))**0.5
991
+
992
+ if ac <= 1.0:
993
+ Q = 1.0 + 1.464*(ac**1.65)
994
+ base = 1.0 + (0.05/(0.11 + ac**1.5))*(at**2) + (0.29/(0.23 + ac**1.5))*(at**4)
995
+ # Point A
996
+ gA = 1.0
997
+ fphiA = 1.0
998
+ FA = base*gA*fphiA*f_w
999
+ # Point C
1000
+ gC = 1.0 - (at**4)/(1.0 + 4.0*(ac))
1001
+ fphiC = np.sqrt(ac)
1002
+ FC = base*gC*fphiC*f_w
1003
+ else:
1004
+ Q = 1.0 + 1.464*((c/a)**1.65)
1005
+ base = np.sqrt(c/a) + (0.05/(0.11 + ac**1.5))*(at**2) + (0.29/(0.23 + ac**1.5))*(at**4)
1006
+ # Point A
1007
+ gA = 1.0
1008
+ fphiA = np.sqrt(c/a)
1009
+ FA = base*gA*fphiA*f_w
1010
+ # Point C
1011
+ gC = 1.0 - (at**4)/(1.0 + 4.0*(ac))
1012
+ fphiC = 1.0
1013
+ FC = base*gC*fphiC*f_w
1014
+
1015
+ #評価点Aにおける応力拡大係数
1016
+
1017
+ KA = FA*sigma_m*np.sqrt(np.pi*a/Q)
1018
+
1019
+ #評価点Cにおける応力拡大係数
1020
+
1021
+ KC = FC*sigma_m*np.sqrt(np.pi*a/Q)
1022
+
1023
+ res = {'KA': KA, 'KC': KC}
1024
+ super().SetRes(res)
1025
+
1026
+ class K_2_a_1(Base):
1027
+ def __init__(self):
1028
+ super().SetTitle('軸方向内表面半楕円表面き裂 Fett らの解')
1029
+
1030
+ super().SetRefer(
1031
+ "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"
1032
+ "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"
1033
+ )
1034
+
1035
+ # Applicable range: 0 < a/t ≤ 0.8, 0.2 ≤ a/c ≤ 1, 4 ≤ Ri/t ≤ 10
1036
+
1037
+ def Calc(self):
1038
+ dm = dmanage()
1039
+ df = super().GetData()
1040
+
1041
+ a = df['a'] # crack depth
1042
+ t = df['t'] # wall thickness
1043
+ c = df['c'] # half surface length
1044
+ Ri = df['Ri'] # inner radius
1045
+ sigma0 = df['sigma0']
1046
+ sigma1 = df['sigma1']
1047
+ sigma2 = df['sigma2']
1048
+ sigma3 = df['sigma3']
1049
+
1050
+ data = dm.Finput('K-2-a-1.csv')
1051
+ target_point = np.array([[a / t, a / c, Ri / t]])
1052
+
1053
+ FA = np.zeros(4, dtype=float) # F0A..F3A
1054
+ for ith in range(1, 5): # 1,2,3,4 (→ F0A..F3A)
1055
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1056
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1057
+ Fi, _sigma = dm.Eval(target_point)
1058
+ FA[ith - 1] = float(Fi)
1059
+
1060
+ FB = np.zeros(4, dtype=float) # F0B..F3B
1061
+ for ith in range(5, 9): # 5,6,7,8 (→ F0B..F3B)
1062
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1063
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1064
+ Fi, _sigma = dm.Eval(target_point)
1065
+ FB[ith - 5] = float(Fi)
1066
+
1067
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3
1068
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3
1069
+
1070
+ # 最深点の応力拡大係数
1071
+ KA = SA * np.sqrt(np.pi * a)
1072
+
1073
+ # 表面点の応力拡大係数
1074
+ KB = SB * np.sqrt(np.pi * a)
1075
+
1076
+ res = {
1077
+ 'KA': KA, 'KB': KB
1078
+ }
1079
+ super().SetRes(res)
1080
+ class K_2_a_2(Base):
1081
+ def __init__(self):
1082
+ super().SetTitle('軸方向内表面半楕円表面き裂 白鳥の解')
1083
+
1084
+ super().SetRefer(
1085
+ "白鳥: 影響関数法による応力拡大係数の解析, 日本機械学会講習会教材, 表面き裂—その解析と評価—, No.900-2, p. 1, 1990"
1086
+ )
1087
+
1088
+ # Applicable range: 0.1 ≤ a/t ≤ 0.8, 0.2 ≤ a/c ≤ 1, 1/9 ≤ Ri/t ≤ 10
1089
+
1090
+ def Calc(self):
1091
+ dm = dmanage()
1092
+ df = super().GetData()
1093
+
1094
+ a = df['a'] # crack depth
1095
+ t = df['t'] # wall thickness
1096
+ c = df['c'] # half surface crack length
1097
+ Ri = df['Ri'] # inner radius
1098
+ sigma0 = df['sigma0']
1099
+ sigma1 = df['sigma1']
1100
+ sigma2 = df['sigma2']
1101
+ sigma3 = df['sigma3']
1102
+
1103
+ data = dm.Finput('K-2-a-2.csv')
1104
+ target_point = np.array([[a / t, a / c, Ri / t]])
1105
+
1106
+ FA = np.zeros(4, dtype=float) # F0A..F3A
1107
+ for ith in range(1, 5): # 1,2,3,4 (→ F0A..F3A)
1108
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1109
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1110
+ Fi, _sigma = dm.Eval(target_point)
1111
+ FA[ith - 1] = float(Fi)
1112
+
1113
+ FB = np.zeros(4, dtype=float) # F0B..F3B
1114
+ for ith in range(5, 9): # 5,6,7,8 (→ F0B..F3B)
1115
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1116
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1117
+ Fi, _sigma = dm.Eval(target_point)
1118
+ FB[ith - 5] = float(Fi)
1119
+
1120
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3
1121
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3
1122
+
1123
+ Q = 1.0 + 1.464 * (a / c)**1.65
1124
+
1125
+ # 最深点の応力拡大係数
1126
+ KA = SA * np.sqrt(np.pi * a / Q)
1127
+
1128
+ # 表面点の応力拡大係数
1129
+ KB = SB * np.sqrt(np.pi * a / Q)
1130
+
1131
+ res = {
1132
+ 'KA': KA, 'KB': KB
1133
+ }
1134
+ super().SetRes(res)
1135
+
1136
+ class K_2_a_3(Base):
1137
+ # by S.Sakai
1138
+ def __init__(self):
1139
+ super().SetTitle('軸方向無い表面半楕円表面亀裂,Zahoorの解')
1140
+ super().SetRefer('Zahoor,A.:Ductile Fracture Handbook Volume 3,EPRI NP-6301-D,1991')
1141
+ def Calc(self):
1142
+ df=super().GetData()
1143
+ Ro=df['Ro']
1144
+ Ri=df['Ri']
1145
+ p=df['p']
1146
+ Sm=(Ro*Ro+Ri*Ri)/(Ro*Ro-Ri*Ri)*p
1147
+ a=df['a']
1148
+ c=df['c']
1149
+ t=df['t']
1150
+ ar=(a/t)/(a/c)**0.58
1151
+ FA=0.25+(0.4759*ar+0.1262*ar*ar)/(0.102*(Ri/t)-0.02)**0.1
1152
+ KA=FA*Sm*np.sqrt(np.pi*t)
1153
+ FB=FA*(1.06+0.28*(a/t)**2)*(a/c)**0.41
1154
+ KB=FB*Sm*np.sqrt(np.pi*t)
1155
+ res={'KA':KA,
1156
+ 'KB':KB}
1157
+ super().SetRes(res)
1158
+ class K_2_a_3(Base):
1159
+ def __init__(self):
1160
+ super().SetTitle('軸方向内表面半楕円表面き裂 Zahoor の解')
1161
+ super().SetRefer('Zahoor, A.: Ductile Fracture Handbook Volume 3, EPRI NP-6301-D, 1991')
1162
+
1163
+ # Applicable range: 0.05 ≤ a/t ≤ 0.85, 0.1 ≤ a/c ≤ 1, 0.2 ≤ α, 1 ≤ Ri/t ≤ 10
1164
+
1165
+ def Calc(self):
1166
+ df = super().GetData()
1167
+
1168
+ a = df['a'] # crack depth
1169
+ c = df['c'] # half surface crack length
1170
+ t = df['t'] # wall thickness
1171
+ Ri = df['Ri'] # inner radius
1172
+ Ro = df['Ro'] # outer radius
1173
+ p = df['p'] # internal pressure
1174
+
1175
+ sigma_m = ((Ro**2 + Ri**2) / (Ro**2 - Ri**2)) * p
1176
+ alpha = (a/t) / ((a/c)**0.58)
1177
+
1178
+ # 最深点の応力拡大係数
1179
+ denomA = (0.102*(Ri/t) - 0.02)**0.1
1180
+ FA = 0.25 + (0.4759*alpha + 0.1262*alpha**2) / denomA
1181
+ KA = FA * sigma_m * np.sqrt(np.pi * t)
1182
+
1183
+ # 表面点の応力拡大係数
1184
+ FB = FA * (1.06 + 0.28*(a/t)**2) * (a/c)**0.41
1185
+ KB = FB * sigma_m * np.sqrt(np.pi * t)
1186
+
1187
+ res = {'KA': KA, 'KB': KB}
1188
+ super().SetRes(res)
1189
+ class K_2_b_1(Base):
1190
+ def __init__(self):
1191
+ super().SetTitle('軸方向内表面長い表面き裂 Fuhley-Osage の解')
1192
+
1193
+ super().SetRefer(
1194
+ "American Petroleum Institute: Recommended Practice for Fitness-for-Service, "
1195
+ "API RP 579, 2000"
1196
+ )
1197
+
1198
+ # Applicable range: 0 ≤ a/t ≤ 0.8, 2 ≤ Ri/t ≤ 1000
1199
+
1200
+ def Calc(self):
1201
+ dm = dmanage()
1202
+ df = super().GetData()
1203
+
1204
+ a = df['a'] # crack depth
1205
+ t = df['t'] # thickness
1206
+ Ri = df['Ri'] # inner radius
1207
+ sigma0 = df['sigma0']
1208
+ sigma1 = df['sigma1']
1209
+ sigma2 = df['sigma2']
1210
+ sigma3 = df['sigma3']
1211
+ sigma4 = df['sigma4']
1212
+
1213
+ data = dm.Finput('K-2-b-1.csv')
1214
+ target_point = np.array([[a / t, Ri / t]])
1215
+
1216
+ F = np.zeros(5, dtype=float) # F0..F4
1217
+ for ith in range(1, 6): # 1,2,3,4,5 (→ F0..F4)
1218
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1219
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1220
+ Fi, _sigma = dm.Eval(target_point)
1221
+ F[ith - 1] = float(Fi)
1222
+
1223
+ # 応力拡大係数
1224
+ 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
1225
+ K = S * np.sqrt(np.pi * a)
1226
+
1227
+ res = {
1228
+ 'K': K
1229
+ }
1230
+ super().SetRes(res)
1231
+
1232
+ class K_2_b_2(Base):
1233
+ #by S.Sakai
1234
+ def __init__(self):
1235
+ super().SetTitle('軸方向内表面長い表面亀裂,Zahoorの解')
1236
+ 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')
1237
+ def Calc(self):
1238
+ df=super().GetData()
1239
+ Ro=df['Ro']
1240
+ Ri=df['Ri']
1241
+ p=df['p']
1242
+ Sm=2*Ro*Ro/(Ro*Ro-Ri*Ri)*p
1243
+ a=df['a']
1244
+ t=Ro-Ri
1245
+ if Ri/t >=5.0 and Ri/t<10.0:
1246
+ A=(0.125*(Ri/t)-0.25)**0.25
1247
+ if Ri/t >=10.0 and Ri/t<=20.0:
1248
+ A=(0.2*(Ri/t)-1)**0.25
1249
+ F=1.1+A*(4.951*(a/t)**2+1.092*(a/t)**4)
1250
+ K=F*Sm*np.sqrt(np.pi*a)
1251
+ res={'K':K}
1252
+ super().SetRes(res)
1253
+ class K_2_c_1(Base):
1254
+ def __init__(self):
1255
+ super().SetTitle('軸方向外表面半楕円表面き裂 Fett らの解')
1256
+
1257
+ super().SetRefer(
1258
+ "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"
1259
+ "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"
1260
+ )
1261
+
1262
+ # Applicable range: 0 < a/t ≤ 0.8, 0.2 ≤ a/c ≤ 1, 4 ≤ Ri/t ≤ 10
1263
+
1264
+ def Calc(self):
1265
+ dm = dmanage()
1266
+ df = super().GetData()
1267
+
1268
+ a = df['a'] # crack depth
1269
+ t = df['t'] # wall thickness
1270
+ c = df['c'] # half surface crack length
1271
+ Ri = df['Ri'] # inner radius
1272
+ sigma0 = df['sigma0']
1273
+ sigma1 = df['sigma1']
1274
+ sigma2 = df['sigma2']
1275
+ sigma3 = df['sigma3']
1276
+
1277
+ data = dm.Finput('K-2-c-1.csv')
1278
+ target_point = np.array([[a / t, a / c, Ri / t]])
1279
+
1280
+ FA = np.zeros(4, dtype=float) # F0A..F3A
1281
+ for ith in range(1, 5): # 1,2,3,4 (→ F0A..F3A)
1282
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1283
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1284
+ Fi, _sigma = dm.Eval(target_point)
1285
+ FA[ith - 1] = float(Fi)
1286
+
1287
+ FB = np.zeros(4, dtype=float) # F0B..F3B
1288
+ for ith in range(5, 9): # 5,6,7,8 (→ F0B..F3B)
1289
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1290
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1291
+ Fi, _sigma = dm.Eval(target_point)
1292
+ FB[ith - 5] = float(Fi)
1293
+
1294
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3
1295
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3
1296
+
1297
+ # 最深点の応力拡大係数
1298
+ KA = SA * np.sqrt(np.pi * a)
1299
+
1300
+ # 表面点の応力拡大係数
1301
+ KB = SB * np.sqrt(np.pi * a)
1302
+
1303
+ res = {
1304
+ 'KA': KA, 'KB': KB
1305
+ }
1306
+ super().SetRes(res)
1307
+ class K_2_c_2(Base):
1308
+ def __init__(self):
1309
+ super().SetTitle('軸方向外表面半楕円表面き裂 Zahoor の解')
1310
+ super().SetRefer('Zahoor, A.: Ductile Fracture Handbook Volume 3, EPRI NP-6301-D, 1991')
1311
+
1312
+ # Applicable range: 0.05 ≤ a/t ≤ 0.85, 0.1 ≤ a/c ≤ 1, 0.2 ≤ α, 2 ≤ Ri/t ≤ 10
1313
+
1314
+ def Calc(self):
1315
+ df = super().GetData()
1316
+
1317
+ a = df['a'] # crack depth
1318
+ c = df['c'] #half surface crack length
1319
+ t = df['t'] # wall thickness
1320
+ Ri = df['Ri'] # inner radius
1321
+ Ro = df['Ro'] # outer radius
1322
+ p = df['p'] # internal pressure
1323
+
1324
+ # 最深点の応力拡大係数
1325
+ sigma_m = (2.0 * Ri**2 / (Ro**2 - Ri**2)) * p
1326
+ alpha = (a/t) / ((a/c)**0.58)
1327
+ denomA = (0.11*(Ri/t) - 0.1)**0.1
1328
+ FA = 0.25 + (0.42*alpha + 0.21*alpha**2) / denomA
1329
+ KA = FA * sigma_m * np.sqrt(np.pi * t)
1330
+
1331
+ # 表面点の応力拡大係数
1332
+ FB = FA * (1.0 + 0.33*(a/t)**2) * (a/c)**0.47
1333
+ KB = FB * sigma_m * np.sqrt(np.pi * t)
1334
+
1335
+ res = {'KA': KA, 'KB': KB}
1336
+ super().SetRes(res)
1337
+ class K_2_d(Base):
1338
+ def __init__(self):
1339
+ super().SetTitle('軸方向外表面長い表面き裂 Fuhley-Osage の解')
1340
+
1341
+ super().SetRefer(
1342
+ "American Petroleum Institute: Recommended Practice for Fitness-for-Service, "
1343
+ "API RP 579, 2000"
1344
+ )
1345
+
1346
+ # Applicable range: 0 ≤ a/t ≤ 0.8, 2 ≤ Ri/t ≤ 1000
1347
+
1348
+ def Calc(self):
1349
+ dm = dmanage()
1350
+ df = super().GetData()
1351
+
1352
+ a = df['a'] # crack depth
1353
+ t = df['t'] # wall thickness
1354
+ Ri = df['Ri'] # inner radius
1355
+ sigma0 = df['sigma0']
1356
+ sigma1 = df['sigma1']
1357
+ sigma2 = df['sigma2']
1358
+ sigma3 = df['sigma3']
1359
+ sigma4 = df['sigma4']
1360
+
1361
+ data = dm.Finput('K-2-d.csv')
1362
+ target_point = np.array([[a / t, Ri / t]])
1363
+
1364
+ F = np.zeros(5, dtype=float) # F0..F4
1365
+ for ith in range(1, 6): # 1,2,3,4,5 (→ F0..F4)
1366
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1367
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1368
+ Fi, _sigma = dm.Eval(target_point)
1369
+ F[ith - 1] = float(Fi)
1370
+
1371
+ 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
1372
+ K = S * np.sqrt(np.pi * a)
1373
+
1374
+ res = {
1375
+ 'K': K
1376
+ }
1377
+ super().SetRes(res)
1378
+ class K_2_e_1(Base):
1379
+ def __init__(self):
1380
+ super().SetTitle('軸方向貫通き裂 Erdogan-Kibler の解')
1381
+
1382
+ super().SetRefer(
1383
+ "Erdogan, F., and Kibler, J. J.: Cylindrical and Spherical Shells with Cracks, International Journal of Fracture Mechanics, 5, p. 229, 1969"
1384
+ )
1385
+
1386
+ # Applicable range: 0 < c/t ≤ 12.5, 10 ≤ Ri/t ≤ 20
1387
+
1388
+ def Calc(self):
1389
+ dm = dmanage()
1390
+ df = super().GetData()
1391
+
1392
+ c = df['c'] # half crack length
1393
+ t = df['t'] # wall thickness
1394
+ Ri = df['Ri'] # inner radius
1395
+ sigma_m = df['sigma_m']
1396
+ sigma_b = df['sigma_b']
1397
+
1398
+ data = dm.Finput('K-2-e-1.csv')
1399
+ target_point = np.array([[c / t, Ri / t]])
1400
+
1401
+ FA = np.zeros(2, dtype=float) # FmA, FbA
1402
+ for ith in range(1, 3): # 1,2 (→ FmA, FbA)
1403
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1404
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1405
+ Fi, _sigma = dm.Eval(target_point)
1406
+ FA[ith - 1] = float(Fi)
1407
+
1408
+ FB = np.zeros(2, dtype=float) # FmB, FbB
1409
+ for ith in range(3, 5): # 3,4 (→ FmB, FbB)
1410
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1411
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1412
+ Fi, _sigma = dm.Eval(target_point)
1413
+ FB[ith - 3] = float(Fi)
1414
+
1415
+ # 内表面における応力拡大係数
1416
+ KA = (FA[0]*sigma_m + FA[1]*sigma_b) * np.sqrt(np.pi * c)
1417
+
1418
+ # 外表面における応力拡大係数
1419
+ KB = (FB[0]*sigma_m + FB[1]*sigma_b) * np.sqrt(np.pi * c)
1420
+
1421
+ res = {
1422
+ 'KA': KA, 'KB': KB
1423
+ }
1424
+ super().SetRes(res)
1425
+
1426
+ class K_2_e_2(Base):
1427
+ #by S.Sakai
1428
+ def __init__(self):
1429
+ super().SetTitle('軸方向貫通亀裂,ASME Code Case N-513の解')
1430
+ super().SetRefer('ASME Boiler and Pressure Vessel Code, Code Case N-513, Evaluation Criteria for Temporary Acceptance of Flaws in Calss 3 Piping, 1997')
1431
+ def Calc(self):
1432
+ df=super().GetData()
1433
+ p=df['p']
1434
+ R=df['R']
1435
+ t=df['t']
1436
+ Sm=p*R/t
1437
+ c=df['c']
1438
+ l=c/np.sqrt(R*t)
1439
+ F=1+0.072449*l+0.64856*l*l-0.2327*l*l*l+0.038154*l**4-0.0023487*l**5
1440
+ K=F*Sm*np.sqrt(np.pi*c)
1441
+ res={'K':K}
1442
+ super().SetRes(res)
1443
+ class K_2_e_3(Base):
1444
+ def __init__(self):
1445
+ super().SetTitle('軸方向貫通き裂 Zang の解')
1446
+
1447
+ super().SetRefer(
1448
+ "Zang, W.: Stress Intensity Factor Solutions for Axial and Circumferential Through-Wall Cracks in Cylinders, "
1449
+ "SINTAP/SAQ/02, SAQ Control AB, 1997"
1450
+ )
1451
+
1452
+ # Applicable range: 0.5 ≤ c/t ≤ 25, 5 ≤ Ri/t ≤ 100
1453
+
1454
+ def Calc(self):
1455
+ dm = dmanage()
1456
+ df = super().GetData()
1457
+
1458
+ c = df['c'] # half crack length
1459
+ t = df['t'] # wall thickness
1460
+ Ri = df['Ri'] # inner radius
1461
+ sigma0 = df['sigma0']
1462
+ sigma1 = df['sigma1']
1463
+ sigma2 = df['sigma2']
1464
+ sigma3 = df['sigma3']
1465
+ sigma4 = df['sigma4']
1466
+
1467
+ data = dm.Finput('K-2-e-3.csv')
1468
+ target_point = np.array([[c / t, Ri / t]])
1469
+
1470
+ FA = np.zeros(5, dtype=float) # F0A..F4A
1471
+ for ith in range(1, 6): # 1..5 -> F0A..F4A
1472
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1473
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1474
+ Fi, _sigma = dm.Eval(target_point)
1475
+ FA[ith - 1] = float(Fi)
1476
+
1477
+ FB = np.zeros(5, dtype=float) # F0B..F4B
1478
+ for ith in range(6, 11): # 6..10 -> F0B..F4B
1479
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1480
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1481
+ Fi, _sigma = dm.Eval(target_point)
1482
+ FB[ith - 6] = float(Fi)
1483
+
1484
+ SA = FA[0]*sigma0 + FA[1]*sigma1 + FA[2]*sigma2 + FA[3]*sigma3 + FA[4]*sigma4
1485
+ SB = FB[0]*sigma0 + FB[1]*sigma1 + FB[2]*sigma2 + FB[3]*sigma3 + FB[4]*sigma4
1486
+
1487
+ # 内表面における応力拡大係数
1488
+ KA = SA * np.sqrt(np.pi * c)
1489
+
1490
+ # 外表面における応力拡大係数
1491
+ KB = SB * np.sqrt(np.pi * c)
1492
+
1493
+ res = {
1494
+ 'KA': KA, 'KB': KB
1495
+ }
1496
+ super().SetRes(res)
1497
+ class K_2_f_1(Base):
1498
+ def __init__(self):
1499
+ super().SetTitle('周方向内表面半楕円表面き裂 Chapuliot らの解')
1500
+ super().SetRefer(
1501
+ "Chapuliot, S.: Formulaire de KI Pour les Tubes Comportant un Defaut de Surface Semi-elliptique "
1502
+ "Longitudinal ou Circonférentiel, interne ou externe, Rapport CEA-R-5900, 2000"
1503
+ )
1504
+ # Applicable range: 0 < a/t ≤ 0.8, 0 < a/c ≤ 1, 1 ≤ Ri/t < ∞
1505
+
1506
+ def Calc(self):
1507
+ dm = dmanage()
1508
+ df = super().GetData()
1509
+
1510
+ a = df['a'] # crack depth
1511
+ t = df['t'] # wall thickness
1512
+ c = df['c'] # half surface crack length
1513
+ Ri = df['Ri'] # inner radius
1514
+ sigma0 = df['sigma0']
1515
+ sigma1 = df['sigma1']
1516
+ sigma2 = df['sigma2']
1517
+ sigma3 = df['sigma3']
1518
+ sigma_bg = df['sigma_bg']
1519
+
1520
+ data = dm.Finput('K-2-f-1.csv')
1521
+ target_point = np.array([[a / c, a / t, Ri / t]])
1522
+
1523
+ FA = np.zeros(5, dtype=float)
1524
+ for ith in range(1, 5 + 1):
1525
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1526
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1527
+ Fi, _sigma = dm.Eval(target_point)
1528
+ FA[ith - 1] = float(Fi)
1529
+
1530
+ FB = np.zeros(5, dtype=float)
1531
+ for ith in range(6, 10 + 1):
1532
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1533
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1534
+ Fi, _sigma = dm.Eval(target_point)
1535
+ FB[ith - 6] = float(Fi)
1536
+
1537
+ 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
1538
+ 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
1539
+
1540
+ # 最深点の応力拡大係数
1541
+ KA = SA * np.sqrt(np.pi * a)
1542
+
1543
+ # 表面点の応力拡大係数
1544
+ KB = SB * np.sqrt(np.pi * a)
1545
+
1546
+ res = {'KA': KA, 'KB': KB}
1547
+ super().SetRes(res)
1548
+ class K_2_f_2(Base):
1549
+ def __init__(self):
1550
+ super().SetTitle('周方向内表面半楕円表面き裂 白鳥の解')
1551
+
1552
+ super().SetRefer(
1553
+ "白鳥: 影響関数法による応力拡大係数の解析, 日本機械学会講習会教材, "
1554
+ "表面き裂―その解析と評価―, No. 900-2, p. 1, 1990"
1555
+ )
1556
+
1557
+ # Applicable range: 0.1 ≤ a/t ≤ 0.8, 0.2 ≤ a/c ≤ 1, 1.25 ≤ Ri/t ≤ 10
1558
+
1559
+ def Calc(self):
1560
+ dm = dmanage()
1561
+ df = super().GetData()
1562
+
1563
+ a = df['a'] # crack depth
1564
+ t = df['t'] # wall thickness
1565
+ c = df['c'] # half surface crack length
1566
+ Ri = df['Ri'] # inner radius
1567
+ sigma_m = df['sigma_m']
1568
+ sigma_bg = df['sigma_bg']
1569
+
1570
+ data = dm.Finput('K-2-f-2.csv')
1571
+ target_point = np.array([[a / t, a / c, Ri / t]])
1572
+
1573
+ FA = np.zeros(2, dtype=float) # FmA, FbgA
1574
+ for ith in range(1, 3): # 1,2 (→ FmA, FbgA)
1575
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1576
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1577
+ Fi, _sigma = dm.Eval(target_point)
1578
+ FA[ith - 1] = float(Fi)
1579
+
1580
+ FB = np.zeros(2, dtype=float) # FmB, FbgB
1581
+ for ith in range(3, 5): # 3,4 (→ FmB, FbgB)
1582
+ X_ith, W_ith = dm.CSV2XW(data, ith)
1583
+ r2_score = dm.KrigCalc(X_ith, W_ith)
1584
+ Fi, _sigma = dm.Eval(target_point)
1585
+ FB[ith - 3] = float(Fi)
1586
+
1587
+ Q = 1.0 + 1.464 * (a / c)**1.65
1588
+
1589
+ # 最深点の応力拡大係数
1590
+ SA = FA[0]*sigma_m + FA[1]*sigma_bg
1591
+ KA = SA * np.sqrt(np.pi * a / Q)
1592
+
1593
+ # 表面点の応力拡大係数
1594
+ SB = FB[0]*sigma_m + FB[1]*sigma_bg
1595
+ KB = SB * np.sqrt(np.pi * a / Q)
1596
+
1597
+ res = {
1598
+ 'KA': KA, 'KB': KB
1599
+ }
1600
+ super().SetRes(res)
1601
+ class K_2_f_3(Base):
1602
+ def __init__(self):
1603
+ super().SetTitle('周方向内表面半楕円表面き裂 Zahoor の解')
1604
+
1605
+ super().SetRefer(
1606
+ "Zahoor, A.: Closed Form Expressions for Fracture Mechanics Analysis of Cracked Pipes, "
1607
+ "Trans. ASME, J. of Pressure Vessel Technology, 107, p. 203, 1985\n"
1608
+ "Zahoor, A.: Ductile Fracture Handbook Volume 2, EPRI NP-6301-D, 1990"
1609
+ )
1610
+
1611
+ # Applicable range (軸方向荷重に対して):
1612
+ # 0.05 ≤ a/t ≤ 0.8, 1/6 ≤ a/c ≤ 2/3, 5 ≤ R/t ≤ 20
1613
+ # (曲げモーメントに対して):
1614
+ # 0.05 ≤ a/t ≤ 0.8, a/c ≤ 2/3, 5 ≤ R/t ≤ 160
1615
+
1616
+ def Calc(self):
1617
+ dm = dmanage()
1618
+ df = super().GetData()
1619
+
1620
+ a = df['a'] # crack depth
1621
+ t = df['t'] # wall thickness
1622
+ c = df['c'] # half surface crack length
1623
+ Ri = df['Ri'] # inner radius
1624
+ P = df['P'] # axial load
1625
+ M = df['M'] # bending moment
1626
+
1627
+ data = dm.Finput('K-2-f-3.csv')
1628
+ target_point = np.array([[a / t, a / c, Ri / t]])
1629
+
1630
+ X_1, W_1 = dm.CSV2XW(data, 1) # 1列目 → F_bg^A
1631
+ r2_score = dm.KrigCalc(X_1, W_1)
1632
+ FbgA, _sigma = dm.Eval(target_point)
1633
+ FbgA = float(FbgA)
1634
+
1635
+ sigma_m = P/(2.0*np.pi*Ri*t)
1636
+ sigma_bg = M/(np.pi*Ri**2*t)
1637
+ Q = 1.0 + 1.464 * (a / c)**1.65
1638
+ alpha = 2.0 * c / t
1639
+ 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
1640
+
1641
+ # 最深点の応力拡大係数
1642
+ K = FmA*sigma_m * np.sqrt(np.pi * a) + FbgA*sigma_bg * np.sqrt(np.pi * t)
1643
+
1644
+ res = {
1645
+ 'K': K
1646
+ }
1647
+ super().SetRes(res)
1648
+ class K_2_g(Base):
1649
+ def __init__(self):
1650
+ super().SetTitle('周方向内表面扇形表面き裂 ASME Section XI, Appendix C の解')
1651
+ super().SetRefer('ASME Boiler and Pressure Vessel Code, Section XI, Rules for Inservice Inspection of Nuclear Power Plant Components, 2004')
1652
+
1653
+ # Applicable range: 0.08 ≤ a/t ≤ 0.8, 0 < a/c ≤ 1, 0.05 ≤ c/(πRi) ≤ 1
1654
+
1655
+ def Calc(self):
1656
+ df = super().GetData()
1657
+
1658
+ a = df['a'] # crack depth
1659
+ c = df['c'] # half surface crack length
1660
+ t = df['t'] # wall thickness
1661
+ Ri = df['Ri'] # inner radius
1662
+ R = df['R'] # mean radius
1663
+ P = df['P'] # axial load
1664
+ M = df['M'] # bending moment
1665
+
1666
+ sigma_m = P/(2.0*np.pi*R*t)
1667
+ sigma_bg = M/(np.pi*R**2*t)
1668
+
1669
+ cp = c/(np.pi*Ri)
1670
+ if 0.5 <= cp <= 1.0:
1671
+ cp = 0.5
1672
+
1673
+ x = (a/t)*cp
1674
+
1675
+ # 最深点の応力拡大係数
1676
+ FmA = 1.1 + (a/t)*(0.15241 + 16.722*x**0.855 - 14.944*x)
1677
+ FbgA = 1.1 + (a/t)*(-0.09967 + 5.0057*x**0.565 - 2.8329*x)
1678
+ KA = (FmA*sigma_m + FbgA*sigma_bg)*np.sqrt(np.pi*a)
1679
+
1680
+ res = {'KA': KA}
1681
+ super().SetRes(res)
1682
+
1683
+ class K_2_k_2(Base):
1684
+ def __init__(self):
1685
+ super().SetTitle('周方向貫通亀裂,ASME Code Case N-513の解')
1686
+ super().SetRefer('ASME Boiler and Pressure Vessel Code, Code Cae N-513,Evaluation Criteria for Temporary Acceptance of Flaws in Class 3 Piping,1997')
1687
+ def Calc(self):
1688
+ df=super().GetData()
1689
+ R=df['R']
1690
+ c=df['c']
1691
+ P=df['P']
1692
+ M=df['M']
1693
+ t=df['t']
1694
+ Sm=P/(2*np.pi*R*t)
1695
+ Sbg=M/(np.pi*R*R*t)
1696
+ evaluate_cubic = lambda x, c: c[0] + c[1]*x + c[2]*x**2 + c[3]*x**3
1697
+ x=R/t
1698
+ coeffs=[-2.02917,1.67763,-0.07987,0.00176]
1699
+ Am=evaluate_cubic(x,coeffs)
1700
+ coeffs=[7.09987,-4.42394,0.21036,-0.00463]
1701
+ Bm=evaluate_cubic(x,coeffs)
1702
+ coeffs=[7.79661,5.16676,-0.24577,0.00541]
1703
+ Cm=evaluate_cubic(x,coeffs)
1704
+ coeffs=[-3.26543,1.52784,-0.072698,0.0016011]
1705
+ Abg=evaluate_cubic(x,coeffs)
1706
+ coeffs=[11.36322,-3.91412,0.18619,-0.004099]
1707
+ Bbg=evaluate_cubic(x,coeffs)
1708
+ coeffs=[-3.18609,3.84763,-0.18304,0.00403]
1709
+ Cbg=evaluate_cubic(x,coeffs)
1710
+ evaluate_F = lambda x, c: c[0] + c[1]*x**1.5 + c[2]*x**2.5 + c[3]*x**3.5
1711
+ x=c/(np.pi*R)
1712
+ coeffs=[1,Am,Bm,Cm]
1713
+ Fm=evaluate_F(x,coeffs)
1714
+ coeffs=[1,Abg,Bbg,Cbg]
1715
+ Fbg=evaluate_F(x,coeffs)
1716
+ K=(Fm*Sm+Fbg*Sbg)*np.sqrt(np.pi*c)
1717
+ res={'K':K
1718
+ }
1719
+ super().SetRes(res)
1720
+
1721
+
1722
+ class L_1_a(Base):
1723
+ def __init__(self):
1724
+ super().SetTitle('平板の亀裂,半楕円表面亀裂')
1725
+ 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')
1726
+ def Calc(self):
1727
+ df=super().GetData()
1728
+ w=df['b']
1729
+ a=df['a']
1730
+ t=df['t']
1731
+ P=df['P']
1732
+ M=df['M']
1733
+ l=df['c']*2
1734
+ Sy=df['Sy']
1735
+ Sm=P/(2*w*t)
1736
+ Sb=3*M/(w*t*t)
1737
+ z=a*l/(t*(l+2*t))
1738
+ 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)
1739
+ res={'Lr':Lr}
1740
+ super().SetRes(res)
1741
+
1742
+
1743
+
1744
+ class L_2_b(Base):
1745
+ def __init__(self):
1746
+ super().SetTitle('軸方向内表面長い表面亀裂')
1747
+ super().SetRefer('Kumar V.,German M.D. and Shih C.F.:EPRI NP-1931,Electric Power Research Institute, Palo Alto,CA,July 1981')
1748
+ def Calc(self):
1749
+ df=super().GetData()
1750
+ a=df['a']
1751
+ t=df['t']
1752
+ Sy=df['Sy']
1753
+ Ri=df['Ri']
1754
+ p=df['p']
1755
+ z=a/t
1756
+ p0=(2/np.sqrt(3))*Sy*(t/Ri)
1757
+ pc=p0*((1-z)/(1+z/(Ri/t)))
1758
+ Lr=p/pc
1759
+ res={'Lr':Lr,
1760
+ 'pc':pc}
1761
+ super().SetRes(res)
1762
+
1763
+
1764
+
1765
+