-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstressupdate_strain.py
More file actions
138 lines (117 loc) · 3.66 KB
/
Copy pathstressupdate_strain.py
File metadata and controls
138 lines (117 loc) · 3.66 KB
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
#
import numpy as np
import matplotlib.pyplot as plt
#**********************
#C Stop program if neither plane strain nor axisymmetric state
def sy(ep):
a = 200
b = 100
c = .9
syield = a + b *ep#*(1-np.exp(-c*ep))
dsyield = b#*c*np.exp(-c*ep)
return syield, dsyield
R1, R2 , R3 =1.0, 2.0, 3.0
#C Initialise some algorithmic and internal variables
#C Set some material properties
YOUNG=300*1000
POISS=.3
#NHARD=I
#C Shear and bulk moduli and other necessary constants
GMODU=YOUNG/(R2*(R1+POISS))
BULK=YOUNG/(R3*(R1-R2*POISS))
R2G=R2*GMODU
R3G=R3*GMODU
STRAT = np.zeros(4)
RSTAVA = np.zeros(4)
PSTAVA = np.zeros(4)
EET = np.zeros(4)
STRES = np.zeros(4)
epn = 0
#C Elastic predictor: Compute elastic trial state
#C ----------------------------------------------
#C Volumetric strain and pressure stress
sarray = np.array([])
earray = np.array([])
E11 = 0
DGAMA = 0
for i in range(100):
DELE = 0.00001
E11 = E11 +DELE
STRAT[0] = STRAT[0] + DELE #DELSTR[0]
STRAT[1] = STRAT[1] #- POISS*DELE#DELSTR[1]
STRAT[2] = STRAT[2] + 0#DELSTR[2]
STRAT[3] = STRAT[3] #DELSTR[3]
EEV=STRAT[0]+STRAT[1]+STRAT[3]
P=BULK*EEV
EEVD3=EEV/R3
EET[0]=STRAT[0]-EEVD3
EET[1]=STRAT[1]-EEVD3
EET[3]=STRAT[3]-EEVD3
EET[2]=STRAT[2]/R2
VARJ2T=R2G*R2G*(EET[2]**2+0.5*(EET[0]**2+\
EET[1]**2+EET[3]**2))
QTRIAL=(R3*VARJ2T)**(1/2)
SIGMAY= 200#sy(epn)[0]
TOL = 1*10**-6
#C -------------------------------
PHI=QTRIAL-SIGMAY
if PHI/SIGMAY <= TOL:
STRES[0]=R2G*EET[0]+P
STRES[1]=R2G*EET[1]+P
STRES[2]=R2G*EET[2]
STRES[3]=R2G*EET[3]+P
RSTAVA[0]=STRAT[0]
RSTAVA[1]=STRAT[1]
RSTAVA[2]=STRAT[2]
RSTAVA[3]=STRAT[3]
else:
SIGMAY, DSIGMAY = 200, 100
DGAMA = 0
DENOM = -R3G-DSIGMAY
epnn = epn
#for i in range(100):
#C Compute residual derivative
#C Compute Newton-Raphson increment and update variable DGAMA
DGAMA = -PHI/DENOM
#DGAMA=DGAMA+DDGAMA
#C Compute new residual
epnn=epnn+DGAMA
#SIGMAY, DSIGMAY = sy(epnn)
# PHI=QTRIAL-R3G*DGAMA-SIGMAY
# DENOM = -R3G-DSIGMAY
#C Check convergence
# RESNOR=abs(PHI/SIGMAY)
# if (RESNOR<=TOL):
# break
#else:
# print('convergence failed')
# print(RESNOR)
#C update accumulated plastic strain
#epn = EPBAR
#C update stress components
epn = epnn
FACTOR=R2G*(R1-R3G*DGAMA/QTRIAL)
STRES[0]=FACTOR*EET[0]+P
STRES[1]=FACTOR*EET[1]+P
STRES[2]=FACTOR*EET[2]
STRES[3]=FACTOR*EET[3]+P
#C compute converged elastic (engineering) strain components
FACTOR1=FACTOR/R2G
RSTAVA[0]=FACTOR1*EET[0]+EEVD3
RSTAVA[1]=FACTOR1*EET[1]+EEVD3
RSTAVA[2]=FACTOR1*EET[2]*R2
RSTAVA[3]=FACTOR1*EET[3]+EEVD3
ed1, ed2, ed3, ed4 = FACTOR*EET[0],FACTOR*EET[1],FACTOR*EET[2],FACTOR*EET[3]
ednorm = (ed1**2 + ed2**2 + ed4**2 + 2*ed3**2)**(1/2)
PSTAVA[0]= PSTAVA[0] + (3/2.0)**(1/2)*DGAMA*ed1/ednorm
PSTAVA[1]= PSTAVA[1] + (3/2.0)**(1/2)*DGAMA*ed2/ednorm
PSTAVA[2]= PSTAVA[2] + (3/2.0)**(1/2)*DGAMA*ed3/ednorm
PSTAVA[3]= PSTAVA[3] +(3/2.0)**(1/2)*DGAMA*ed4/ednorm
START = RSTAVA
sarray = np.append(sarray , STRES[0])
earray = np.append(earray , E11)
plt.plot(earray, sarray)
print('RSTAVA', RSTAVA)
print('PSTAVA', PSTAVA)
print('E11', E11)
print(' SUM', RSTAVA + PSTAVA)