Skip to content

Commit f884bb6

Browse files
committed
cmp
1 parent 923adbe commit f884bb6

File tree

8 files changed

+243
-129
lines changed

8 files changed

+243
-129
lines changed

content/en/examples/Example2/Example2.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,4 @@ set numIncr 100; # Number of analysis increments
7575
source MomentCurvature.tcl
7676
MomentCurvature 1 $P [expr $Ky*$mu] $numIncr
7777

78+
puts "[nodeDisp 2 3]"

content/en/examples/Example2/MomentCurvature.tcl

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,65 @@
55
#
66
# ===----------------------------------------------------------------------===//
77

8-
# A procedure for performing section analysis (only does
9-
# moment-curvature, but can be easily modified to do any mode
10-
# of section response.
8+
# A procedure for performing section analysis
119
#
1210
# MHS
1311
# October 2000
1412
#
1513
# Arguments
16-
# secTag -- tag identifying section to be analyzed
17-
# axialLoad -- axial load applied to section (negative is compression)
18-
# maxK -- maximum curvature reached during analysis
19-
# numIncr -- number of increments used to reach maxK (default 100)
14+
# secTag -- tag identifying section to be analyzed
15+
# axialLoad -- axial load applied to section (negative is compression)
16+
# maxK -- maximum curvature reached during analysis
17+
# numIncr -- number of increments used to reach maxK (default 100)
2018
#
2119
# Sets up a recorder which writes moment-curvature results to file
2220
# section$secTag.out ... the moment is in column 1, and curvature in column 2
2321

2422
proc MomentCurvature {secTag axialLoad maxK {numIncr 100} } {
25-
# Define two nodes at (0,0)
26-
node 1 0.0 0.0
27-
node 2 0.0 0.0
23+
# Define two nodes at (0,0)
24+
node 1 0.0 0.0
25+
node 2 0.0 0.0
2826

29-
# Fix all degrees of freedom except axial and bending
30-
fix 1 1 1 1
31-
fix 2 0 1 0
27+
# Fix all degrees of freedom except axial and bending
28+
fix 1 1 1 1
29+
fix 2 0 1 0
3230

33-
# Define element
34-
# tag ndI ndJ secTag
35-
element zeroLengthSection 1 1 2 $secTag
31+
# Define element
32+
# tag ndI ndJ secTag
33+
element zeroLengthSection 1 1 2 $secTag
3634

37-
# Create recorder
38-
recorder Node -file section$secTag.out -time -node 2 -dof 3 disp
35+
# Create recorder
36+
recorder Node -file section$secTag.out -time -node 2 -dof 3 disp
3937

40-
# Define constant axial load
41-
pattern Plain 1 "Constant" {
42-
load 2 $axialLoad 0.0 0.0
43-
}
38+
# Define constant axial load
39+
pattern Plain 1 "Constant" {
40+
load 2 $axialLoad 0.0 0.0
41+
}
4442

45-
# Define analysis parameters
46-
integrator LoadControl 0.0
47-
system SparseGeneral -piv; # Overkill, but may need the pivoting!
48-
test NormUnbalance 1.0e-9 10
49-
numberer Plain
50-
constraints Plain
51-
algorithm Newton
52-
analysis Static
43+
# Define analysis parameters
44+
integrator LoadControl 0.0
45+
system SparseGeneral -piv; # Overkill, but may need the pivoting!
46+
test NormUnbalance 1.0e-9 10
47+
numberer Plain
48+
constraints Plain
49+
algorithm Newton
50+
analysis Static
5351

54-
# Do one analysis for constant axial load
55-
analyze 1
52+
# Do one analysis for constant axial load
53+
analyze 1
5654

57-
# Define reference moment
58-
pattern Plain 2 "Linear" {
59-
load 2 0.0 0.0 1.0
60-
}
55+
# Define reference moment
56+
pattern Plain 2 "Linear" {
57+
load 2 0.0 0.0 1.0
58+
}
6159

62-
# Compute curvature increment
63-
set dK [expr $maxK/$numIncr]
60+
# Compute curvature increment
61+
set dK [expr $maxK/$numIncr]
6462

65-
# Use displacement control at node 2 for section analysis
66-
integrator DisplacementControl 2 3 $dK 1 $dK $dK
63+
# Use displacement control at node 2 for section analysis
64+
integrator DisplacementControl 2 3 $dK 1 $dK $dK
6765

68-
# Do the section analysis
69-
analyze $numIncr
66+
# Do the section analysis
67+
analyze $numIncr
7068
}
69+
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import numpy as np
2+
3+
import xara
4+
import xara.units.fks as units
5+
from xara.units.fks import kip, ksi
6+
7+
from xsection.library import from_aisc
8+
from xsection.analysis import SectionInteraction
9+
10+
import matplotlib.pyplot as plt
11+
12+
13+
14+
def section_interaction(shape, mat, axial):
15+
fig, ax = plt.subplots(1, 1, figsize=(6, 4))
16+
17+
# test = lambda m: m.eleResponse(1, "section", "fiber", (0.0, 0.0), "stress")[0] < 0.9*50*ksi
18+
for N in axial:
19+
M, k = zip(*moment_curvature(shape, mat, N, 0.01, 100))
20+
ax.plot(k, M, label=f"{N/kip:.0f} kip")
21+
plt.show()
22+
23+
24+
def moment_curvature(shape, mat, axialLoad, maxK, numIncr):
25+
"""
26+
A procedure for performing section analysis
27+
28+
Arguments
29+
secTag -- tag identifying section to be analyzed
30+
axialLoad -- axial load applied to section (negative is compression)
31+
maxK -- maximum curvature reached during analysis
32+
numIncr -- number of increments used to reach maxK (default 100)
33+
"""
34+
35+
model = xara.Model(ndm=3, ndf=6)
36+
m = mat
37+
model.nDMaterial(m["type"], 1, **{k: v for k, v in m.items() if k != "type"})
38+
39+
model.section("ShearFiber", 1)
40+
41+
for fiber in shape.create_fibers():
42+
model.fiber(**fiber, material=1, section=1)
43+
44+
45+
# Define two nodes at (0,0)
46+
model.node(1, (0, 0, 0))
47+
model.node(2, (0, 0, 0))
48+
49+
# Fix all degrees of freedom except axial and bending
50+
model.fix(1, (1, 1, 1, 1, 1, 1))
51+
model.fix(2, (0, 1, 1, 1, 1, 0))
52+
53+
# Create element
54+
model.element("zeroLengthSection", 1, (1, 2), 1)
55+
56+
# Define constant axial load
57+
model.pattern("Plain", 1, "Constant", loads={2: [axialLoad, 0, 0, 0,0,0]})
58+
59+
# Define analysis
60+
model.system("BandGeneral")
61+
model.numberer("Plain")
62+
model.constraints("Plain")
63+
model.test("NormUnbalance", 1.0e-8, 20)
64+
model.algorithm("Newton")
65+
model.integrator("LoadControl", 0.0)
66+
model.analysis("Static")
67+
68+
# Do one analysis for constant axial load
69+
model.analyze(1)
70+
71+
# Define reference moment
72+
model.pattern("Plain", 2, "Linear")
73+
model.load(2, (0, 0, 0, 0,0,1), pattern=2)
74+
75+
# Compute curvature increment
76+
dK = maxK/numIncr
77+
78+
# Use displacement control at node 2 for section analysis
79+
model.integrator("DisplacementControl", 2, 6, dK, 1, dK, dK)
80+
81+
MK = []
82+
for i in range(numIncr):
83+
# Evaluate step
84+
if model.analyze(1) != 0:
85+
break
86+
87+
# Get moment and curvature
88+
M = model.eleResponse(1, "force")[5]
89+
k = model.nodeDisp(2, 6)
90+
91+
MK.append([-M, k])
92+
return MK
93+
94+
95+
if __name__ == "__main__":
96+
shape = from_aisc("W14x426", units=units)
97+
98+
mat = {
99+
"type": "J2",
100+
"nu": 0.3,
101+
"E": 29000*ksi,
102+
"Fy": 50*ksi,
103+
"Hiso": 0.003*29e3*ksi,
104+
"Fs": 0, "Fo": 0, "Hsat": 0
105+
}
106+
107+
axial = np.linspace(5e3*kip, -5e3*kip, 10)
108+
SectionInteraction((shape, mat), axial=axial).analyze(nstep=200, incr=1e-4)
109+
110+
section_interaction(shape, mat, axial)
15.9 KB
Loading

content/en/examples/FrameHinges/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ $$
1212
u = -\frac{M_p L^2}{4 EI}
1313
$$
1414

15+
![](img/curvature.png)

0 commit comments

Comments
 (0)