1
- from opensees import openseespy as ops
1
+ from opensees import openseespy as _ops
2
2
import numpy as np
3
3
from math import pi , sin , cos
4
4
from matplotlib import pyplot as plt
8
8
pass
9
9
10
10
11
- def analyze_dir (material , dX , dY , sig0 ):
12
-
13
- # info
14
- print ("Analyze direction ({:8.3g}, {:8.3g})" .format (dX , dY ))
15
-
16
- # the 2D model
11
+ def create_model (material ):
12
+ ops = _ops
17
13
ops .wipe ()
18
- ops .model ('basic' , '-ndm' , 2 , '-ndf' , 2 )
14
+ ops .model ('basic' , ndm = 2 , ndf = 2 )
15
+ # ops = _ops.Model(ndm=2, ndf=2)
19
16
20
17
ops .nDMaterial (* material )
21
18
@@ -26,20 +23,30 @@ def analyze_dir(material, dX, dY, sig0):
26
23
ops .node (1 , 0 , 0 )
27
24
ops .node (2 , 1 , 0 )
28
25
ops .node (3 , 0 , 1 )
29
- ops .element ('tri31' , 1 , (1 , 2 , 3 ), section = 1 )
26
+ ops .element ('tri31' , 1 , (1 , 2 , 3 ), section = 1 ) #1.0, 'PlaneStress', 2)
30
27
31
28
# Create fixities
32
29
ops .fix (1 , 1 , 1 )
33
30
ops .fix (2 , 0 , 1 )
34
31
ops .fix (3 , 1 , 0 )
32
+ return ops
33
+
34
+ def analyze_dir (ops , dX , dY , sig0 ):
35
+ dLambda = 0.02
36
+ dLambdaMin = 0.0001
37
+
38
+ # info
39
+ print ("Analyze direction ({:8.3g}, {:8.3g})" .format (dX , dY ))
40
+
41
+ # the 2D model
35
42
36
43
# Define a simple ramp time series
37
44
ops .timeSeries ('Linear' , 1 , '-factor' , 2.0 * sig0 )
38
45
39
46
# Define load pattern for imposed stresses in the given direction
40
47
ops .pattern ('Plain' , 1 , 1 )
41
- ops .load (2 , ( dX , 0.0 ) , pattern = 1 )
42
- ops .load (3 , ( 0.0 , dY ) , pattern = 1 )
48
+ ops .load (2 , dX , 0.0 , pattern = 1 )
49
+ ops .load (3 , 0.0 , dY , pattern = 1 )
43
50
44
51
# analyze
45
52
ops .constraints ('Transformation' )
@@ -48,8 +55,6 @@ def analyze_dir(material, dX, dY, sig0):
48
55
ops .test ('NormDispIncr' , 1.0e-6 , 10 , 0 )
49
56
ops .algorithm ('Newton' )
50
57
51
- dLambda = 0.1
52
- dLambdaMin = 0.0001
53
58
Lambda = 0.0
54
59
sX = 0.0
55
60
sY = 0.0
@@ -62,16 +67,16 @@ def analyze_dir(material, dX, dY, sig0):
62
67
sX = stress [0 ]
63
68
sY = stress [1 ]
64
69
Lambda += dLambda
65
- if Lambda > 0.9999 :
70
+ if Lambda > 1.4999 : # 0.9999:
66
71
break
67
72
else :
68
73
dLambda /= 2.0
69
74
if dLambda < dLambdaMin :
75
+ print (Lambda )
70
76
break
71
77
72
78
return sX , sY
73
79
74
-
75
80
def plot_surface (material , sig0 ):
76
81
# number of subdivisions
77
82
NDiv = 80
@@ -84,21 +89,28 @@ def plot_surface(material, sig0):
84
89
angle = float (i )* dAngle
85
90
dX = cos (angle )
86
91
dY = sin (angle )
87
- a ,b = analyze_dir (material , dX , dY , sig0 )
88
- SX [i ] = a
89
- SY [i ] = b
92
+ model = create_model (material )
93
+ a ,b = analyze_dir (model , dX , dY , sig0 )
94
+ SX [i ] = a / sig0
95
+ SY [i ] = b / sig0
96
+ # if abs(a/sig0) > 4 or abs(b/sig0) > 4:
97
+ # return model
90
98
91
99
#
92
100
#
93
101
#
94
102
plt .ion ()
103
+
95
104
fig , ax = plt .subplots (1 ,1 )
96
- ax .set (xlim = [- 45 , 10 ], ylim = [- 45 , 10 ])
105
+ # ax.set(xlim=[-45, 10], ylim=[-45, 10])
97
106
ax .axhline (y = 0 , color = 'black' , linestyle = '--' , linewidth = 0.5 )
98
107
ax .axvline (x = 0 , color = 'black' , linestyle = '--' , linewidth = 0.5 )
108
+ ax .set_xlabel (r"$\sigma_1 / F_c$" )
109
+ ax .set_ylabel (r"$\sigma_2 / F_c$" )
99
110
ax .grid (linestyle = ':' )
100
111
ax .set_aspect ('equal' , 'box' )
101
- ax .set (xlim = [min (1.1 * SX ), max (1.1 * SX )], ylim = [min (1.1 * SY ), max (1.1 * SY )])
112
+ ax .set (xlim = [min (1.1 * SX ), max (1.1 * SX )],
113
+ ylim = [min (1.1 * SY ), max (1.1 * SY )])
102
114
103
115
the_line , = ax .plot (SX , SY , '-k' , linewidth = 2.0 )
104
116
@@ -109,29 +121,38 @@ def plot_surface(material, sig0):
109
121
fig .canvas .flush_events ()
110
122
111
123
plt .ioff ()
112
- plt . show ()
124
+
113
125
114
126
if __name__ == "__main__" :
115
- # the isotropic material
127
+ #
116
128
E = 30e3
117
129
v = 0.2
118
130
sig0 = 30.0
119
- # define a perfect bilinear behavior in tension and compression to record the failure surface
120
131
fc = sig0
121
132
ec = fc / E
122
133
ft = fc / 10.0
123
134
et = ft / E
124
135
125
136
# Collect arguments for defining the material
126
137
material = [
127
- 'ASDConcrete3D' , 1 , E , v ,
128
- '-Ce' , 0.0 , ec , ec + 1 ,
129
- '-Cs' , 0.0 , fc , fc ,
130
- '-Cd' , 0.0 , 0.0 , 0.0 ,
131
- '-Te' , 0.0 , et , et + 1 ,
132
- '-Ts' , 0.0 , ft , ft ,
133
- '-Td' , 0.0 , 0.0 , 0.0
138
+ 'FariaPlasticDamage' , 1 , E , v , ft , fc
134
139
]
135
140
136
- plot_surface (material , sig0 )
141
+ m = plot_surface (material , sig0 )
142
+ if not m :
143
+ plt .show ()
144
+
145
+ if True :
146
+ material = [
147
+ 'ASDConcrete3D' , 1 , E , v ,
148
+ '-Ce' , 0.0 , ec , ec + 1 ,
149
+ '-Cs' , 0.0 , fc , fc ,
150
+ '-Cd' , 0.0 , 0.0 , 0.0 ,
151
+ '-Te' , 0.0 , et , et + 1 ,
152
+ '-Ts' , 0.0 , ft , ft ,
153
+ '-Td' , 0.0 , 0.0 , 0.0
154
+ ]
155
+
156
+ plot_surface (material , sig0 )
157
+ plt .show ()
137
158
0 commit comments