Skip to content

Commit 0442efa

Browse files
committed
update
1 parent 5c5e4da commit 0442efa

File tree

3 files changed

+53
-32
lines changed

3 files changed

+53
-32
lines changed
Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from opensees import openseespy as ops
1+
from opensees import openseespy as _ops
22
import numpy as np
33
from math import pi, sin, cos
44
from matplotlib import pyplot as plt
@@ -8,14 +8,11 @@
88
pass
99

1010

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
1713
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)
1916

2017
ops.nDMaterial(*material)
2118

@@ -26,20 +23,30 @@ def analyze_dir(material, dX, dY, sig0):
2623
ops.node(1, 0, 0)
2724
ops.node(2, 1, 0)
2825
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)
3027

3128
# Create fixities
3229
ops.fix(1, 1, 1)
3330
ops.fix(2, 0, 1)
3431
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
3542

3643
# Define a simple ramp time series
3744
ops.timeSeries('Linear', 1, '-factor', 2.0*sig0)
3845

3946
# Define load pattern for imposed stresses in the given direction
4047
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)
4350

4451
# analyze
4552
ops.constraints('Transformation')
@@ -48,8 +55,6 @@ def analyze_dir(material, dX, dY, sig0):
4855
ops.test('NormDispIncr', 1.0e-6, 10, 0)
4956
ops.algorithm('Newton')
5057

51-
dLambda = 0.1
52-
dLambdaMin = 0.0001
5358
Lambda = 0.0
5459
sX = 0.0
5560
sY = 0.0
@@ -62,16 +67,16 @@ def analyze_dir(material, dX, dY, sig0):
6267
sX = stress[0]
6368
sY = stress[1]
6469
Lambda += dLambda
65-
if Lambda > 0.9999:
70+
if Lambda > 1.4999: # 0.9999:
6671
break
6772
else:
6873
dLambda /= 2.0
6974
if dLambda < dLambdaMin:
75+
print(Lambda)
7076
break
7177

7278
return sX, sY
7379

74-
7580
def plot_surface(material, sig0):
7681
# number of subdivisions
7782
NDiv = 80
@@ -84,21 +89,28 @@ def plot_surface(material, sig0):
8489
angle = float(i)*dAngle
8590
dX = cos(angle)
8691
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
9098

9199
#
92100
#
93101
#
94102
plt.ion()
103+
95104
fig, ax = plt.subplots(1,1)
96-
ax.set(xlim=[-45, 10], ylim=[-45, 10])
105+
# ax.set(xlim=[-45, 10], ylim=[-45, 10])
97106
ax.axhline(y=0, color='black', linestyle='--', linewidth=0.5)
98107
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$")
99110
ax.grid(linestyle=':')
100111
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)])
102114

103115
the_line, = ax.plot(SX, SY, '-k', linewidth=2.0)
104116

@@ -109,29 +121,38 @@ def plot_surface(material, sig0):
109121
fig.canvas.flush_events()
110122

111123
plt.ioff()
112-
plt.show()
124+
113125

114126
if __name__ == "__main__":
115-
# the isotropic material
127+
#
116128
E = 30e3
117129
v = 0.2
118130
sig0 = 30.0
119-
# define a perfect bilinear behavior in tension and compression to record the failure surface
120131
fc = sig0
121132
ec = fc/E
122133
ft = fc/10.0
123134
et = ft/E
124135

125136
# Collect arguments for defining the material
126137
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
134139
]
135140

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()
137158

content/en/examples/Example3/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Inelastic Plane Frame"
2+
title: "Concrete Portal Frame"
33
weight: 20
44
tags: ["Frame", "Python", "Tcl", "Concrete"]
55
categories: ["Basic", "Inelastic"]
27.7 KB
Loading

0 commit comments

Comments
 (0)