-
Notifications
You must be signed in to change notification settings - Fork 3
/
FailureCriteria.py
executable file
·287 lines (249 loc) · 12.8 KB
/
FailureCriteria.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# -*- coding: utf-8 -*-
import numpy as np
import logging
from failureCriteriaGraph import plot_failure_criteria
class FailureCriteria:
def __init__(self, ro_init, id):
self.roFailureCoulombPrev = ro_init
self.roFailureCoulomb = ro_init
self.roFailureTresk = ro_init
self.roFailureMises = ro_init
self.roCoulombMohr = ro_init
self.roDruckerPragerInnerCircle = ro_init
self.roDruckerPragerMiddleCircle = ro_init
self.roDruckerPragerOuterCircle = ro_init
self.ro_max = ro_init
self.id = id
def get_ro(self):
roAsText = ""
roAsText += "roFailureCoulombPrev =" + str(self.roFailureCoulombPrev)+"\n"
roAsText += "roFailureCoulomb =" + str(self.roFailureCoulomb)+"\n"
roAsText += "roFailureTresk =" + str(self.roFailureTresk)+"\n"
roAsText += "roFailureMises =" + str(self.roFailureMises)+"\n"
roAsText += "roCoulombMohr =" + str(self.roCoulombMohr)+"\n"
roAsText += "roDruckerPragerInnerCircle =" + str(self.roDruckerPragerInnerCircle)+"\n"
roAsText += "roDruckerPragerMiddleCircle =" + str(self.roDruckerPragerMiddleCircle)+"\n"
roAsText += "roDruckerPragerOuterCircle =" + str(self.roDruckerPragerOuterCircle)+"\n"
return roAsText
def getRoList(self):
return [
self.id,
self.roFailureCoulombPrev,
self.roFailureCoulomb,
self.roFailureTresk,
self.roFailureMises,
self.roCoulombMohr,
self.roDruckerPragerInnerCircle,
self.roDruckerPragerMiddleCircle,
self.roDruckerPragerOuterCircle
]
def checkIsFailureCoulombPrev(self,j, sigma3, sigma2, sigma1, phi, C0):
# sigma3>sigma2>sigma1
# C0 прочность на одноосное сжатие
if sigma3 == 0 and sigma2 == 0 and sigma1 == 0:
# logging.info("all sigma equals zero")
return False
r = (sigma3 - sigma1) / 2
x0 = sigma1 + r
y0 = 0
# Ax+By+C=0
# logging.info("Coulomb checking " + str(j) + "phi: " + str(phi) + " C0: " + str(C0))
A = -np.tan(phi)
B = 1
C = -C0
# logging.info(str(A) + "x+" + str(B) + "y+" + str(C))
# расстояние между центром окружоности и прямой
dist = np.abs(A * x0 + B * y0 + C) / (A * A + B * B) ** 0.5
# logging.info("dist=" + str(dist))
if dist <= r:
# logging.info("failure criteria plotting")
# plotFailureCriteria(j, sigma3, sigma2, sigma1, phi, C0)
return True
else:
return False
def checkIsFailureCoulomb(self,j, sigma3, sigma2, sigma1, phi, C0):
# sigma3>sigma2>sigma1
# C0 прочность на одноосное сжатие
# #phi угол внутреннего трения
# phi = i*np.pi/180
q = (1 + np.sin(phi)) / (1 - np.sin(phi))
# ?
ans = (sigma1 >= C0 + sigma3 * q)
if ans:
return True
else:
return False
def checkIsFailureTresk(self,j, sigma3, sigma2, sigma1, phi, C0):
# sigma3>sigma2>sigma1
# C_0 прочность на одноосное сжатие
# phi угол внутреннего трения
phi = 0
# ?
q = (1 + np.sin(phi)) / (1 - np.sin(phi))
ans = (sigma1 >= C0 + sigma3 * q)
if ans:
return True
else:
return False
def checkIsFailureMises(self,j, sigma3, sigma2, sigma1, phi, C0):
# sigma3>sigma2>sigma1
# sigma_0 прочность на одноосное сжатие
# #phi угол внутреннего трения
J2 = 1 / 6 * ((sigma1 - sigma2) ** 2 + (sigma1 - sigma3) ** 2 + (sigma2 - sigma3) ** 2)
ans = (J2 ** 0.5 - C0 / 3 > 0)
# ans=(J2**0.5-C0/3>0)
# условие разрушения
if ans:
return True
else:
return False
def checkCoulombMohr(self,j, sigma3, sigma2, sigma1, phi, C0):
# return True if the failure occurs
A = (1 + np.sin(phi)) / (1 - np.sin(phi))
B = 2 * C0 * np.cos(phi) / (1 - np.sin(phi))
f = A * sigma3 + B - sigma1
# plotFailureCriteria(j, sigma3, sigma2, sigma1, phi, C0)
if (f < 0):
return True
return False
def checkDruckerPragerInnerCircle(self,j, sigma3, sigma2, sigma1, phi, C0):
# return True if the failure occurs
A = 6 ** 0.5 * np.sin(phi) / (9 + 3 * np.sin(phi) ** 2) ** 0.5
B = 6 ** 0.5 * C0 * np.sin(phi) / (9 + 3 * np.sin(phi) ** 2) ** 0.5
J1 = sigma1 + sigma2 + sigma3
J2 = sigma2 * sigma3 + sigma1 * sigma3 + sigma1 * sigma2
f = A * J1 + B - J2 ** 2
if (f < 0):
return True
return False
def checkDruckerPragerMiddleCircle(self,j, sigma3, sigma2, sigma1, phi, C0):
# return True if the failure occurs
A = 2 * 2 ** 2 * np.sin(phi) / (3 + np.sin(phi))
B = 2 * 2 ** 2 * np.cos(phi) / (3 + np.sin(phi))
J1 = sigma1 + sigma2 + sigma3
J2 = sigma2 * sigma3 + sigma1 * sigma3 + sigma1 * sigma2
f = A * J1 + B - J2 ** 2
if (f < 0):
return True
return False
def checkDruckerPragerOuterCircle(self,j, sigma3, sigma2, sigma1, phi, C0):
# return True if the failure occurs
A = 2 * 2 ** 2 * np.sin(phi) / (3 - np.sin(phi))
B = 2 * 2 ** 2 * np.cos(phi) / (3 - np.sin(phi))
J1 = sigma1 + sigma2 + sigma3
J2 = sigma2 * sigma3 + sigma1 * sigma3 + sigma1 * sigma2
f = A * J1 + B - J2 ** 2
if (f < 0):
return True
return False
def checkDruckerPragerPlainStrainState(self,j, sigma3, sigma2, sigma1, phi, C0):
# return True if the failure occurs
A = 2 * np.sin(phi) / (9 - 3 * np.sin(phi)) ** 0.5
B = 6 * C0 * np.sin(phi) / (9 - 3 * np.sin(phi)) ** 0.5
J1 = sigma1 + sigma2 + sigma3
J2 = sigma2 * sigma3 + sigma1 * sigma3 + sigma1 * sigma2
f = A * J1 + B - J2 ** 2
if f < 0:
return True
return False
def checkDruckerPragerTriaxialCompression(self,j, sigma3, sigma2, sigma1, phi, C0):
# return True if the failure occurs
A = np.tan(phi) / (9 + 12 * np.tan(phi) ** 2) ** 0.5
B = 3 * C0 / (9 + 12 * np.tan(phi) ** 2) ** 0.5
J1 = sigma1 + sigma2 + sigma3
J2 = sigma2 * sigma3 + sigma1 * sigma3 + sigma1 * sigma2
f = A * J1 + B - J2 ** 2
if (f < 0):
return True
return False
def checkSection(self, stressAtWell, ro, j, C0, phi):
# главные напряжения в этой точке
# sigma3>sigma2>sigma1
# phi = 45.0 * np.pi / 180
# C0 = 25 * 1000000
# по умолчанию все критерии не выполняются
isCheckIsFailureCoulombPrev = False
isCheckIsFailureCoulomb = False
isCheckIsFailureTresk = False
isCheckIsFailureMises = False
isCheckCoulombMohr = False
isCheckDruckerPragerInnerCircle = False
isCheckDruckerPragerMiddleCircle = False
isCheckDruckerPragerOuterCircle = False
isCheckDruckerPragerPlainStrainState = False
# print("checkSection started\n")
# print stressAtWell.__sizeof__()
# print("===========================================")
for curNumber, currentStressCyl in enumerate(stressAtWell):
# print(str(curNumber) + ":")
# print(currentStressCyl.getMtx33Str())
sigma3, sigma2, sigma1 = currentStressCyl.getGeneralStress()
# print(sigma3>sigma2, sigma2>sigma1, sigma3>sigma1)
# print("\ts3=" + str(sigma3) + "\ts2=" + str(sigma2) + "\ts1=" + str(sigma1))
if isCheckIsFailureCoulombPrev != True:
isCheckIsFailureCoulombPrev = self.checkIsFailureCoulombPrev(curNumber, sigma3, sigma2, sigma1, phi, C0)
if isCheckIsFailureCoulomb != True:
isCheckIsFailureCoulomb = self.checkIsFailureCoulomb(curNumber, sigma3, sigma2, sigma1, phi, C0)
if isCheckIsFailureTresk != True:
isCheckIsFailureTresk = self.checkIsFailureTresk(curNumber, sigma3, sigma2, sigma1, phi, C0)
if isCheckIsFailureMises != True:
isCheckIsFailureMises = self.checkIsFailureMises(curNumber, sigma3, sigma2, sigma1, phi, C0)
if isCheckCoulombMohr != True:
isCheckCoulombMohr = self.checkCoulombMohr(curNumber, sigma3, sigma2, sigma1, phi, C0)
if isCheckDruckerPragerInnerCircle != True:
isCheckDruckerPragerInnerCircle = self.checkDruckerPragerInnerCircle(curNumber, sigma3, sigma2, sigma1,
phi,
C0)
if isCheckDruckerPragerMiddleCircle != True:
isCheckDruckerPragerMiddleCircle = self.checkDruckerPragerMiddleCircle(curNumber, sigma3, sigma2,
sigma1,
phi, C0)
if isCheckDruckerPragerOuterCircle != True:
isCheckDruckerPragerOuterCircle = self.checkDruckerPragerOuterCircle(curNumber, sigma3, sigma2, sigma1,
phi, C0)
if isCheckDruckerPragerPlainStrainState != True:
isCheckDruckerPragerPlainStrainState = self.checkDruckerPragerPlainStrainState(curNumber, sigma3,
sigma2,
sigma1,
phi, C0)
if isCheckIsFailureCoulombPrev == False:
if ro < self.roFailureCoulombPrev:
self.roFailureCoulombPrev = ro
if isCheckIsFailureCoulomb == False:
if ro < self.roFailureCoulomb:
self.roFailureCoulomb = ro
if isCheckIsFailureTresk == False:
if ro < self.roFailureTresk:
self.roFailureTresk = ro
if isCheckIsFailureMises == False:
if ro < self.roFailureMises:
self.roFailureMises = ro
if isCheckCoulombMohr == False:
if ro < self.roCoulombMohr:
self.roCoulombMohr = ro
if isCheckDruckerPragerInnerCircle == False:
if ro < self.roDruckerPragerInnerCircle:
self.roDruckerPragerInnerCircle = ro
if isCheckDruckerPragerMiddleCircle == False:
if ro < self.roDruckerPragerMiddleCircle:
self.roDruckerPragerMiddleCircle = ro
if isCheckDruckerPragerOuterCircle == False:
if ro < self.roDruckerPragerOuterCircle:
self.roDruckerPragerOuterCircle = ro
# print('checkIsFailureCoulombPrev ' + str(isCheckIsFailureCoulombPrev))
# print('checkIsFailureCoulomb ' + str(isCheckIsFailureCoulomb))
# print('checkIsFailureTresk ' + str(isCheckIsFailureTresk))
# print('checkIsFailureMises ' + str(isCheckIsFailureMises))
# print('checkCoulombMohr ' + str(isCheckCoulombMohr))
# print('checkDruckerPragerInnerCircle ' + str(isCheckDruckerPragerInnerCircle))
# print('checkDruckerPragerMiddleCircle ' + str(isCheckDruckerPragerMiddleCircle))
# print('checkDruckerPragerOuterCircle ' + str(isCheckDruckerPragerOuterCircle))
# print("---------------------------------------------------------------------------")
# logging.info('checkIsFailureCoulombPrev ' + str(isCheckIsFailureCoulombPrev))
# logging.info('checkIsFailureCoulomb ' + str(isCheckIsFailureCoulomb))
# logging.info('checkIsFailureTresk ' + str(isCheckIsFailureTresk))
# logging.info('checkIsFailureMises ' + str(isCheckIsFailureMises))
# logging.info('checkCoulombMohr ' + str(isCheckCoulombMohr))
# logging.info('checkDruckerPragerInnerCircle ' + str(isCheckDruckerPragerInnerCircle))
# logging.info('checkDruckerPragerMiddleCircle ' + str(isCheckDruckerPragerMiddleCircle))
# logging.info('checkDruckerPragerOuterCircle ' + str(isCheckDruckerPragerOuterCircle))