Skip to content

Commit 764e6d2

Browse files
committed
use literal 0 to check analysis
1 parent 3d096fb commit 764e6d2

File tree

32 files changed

+5833
-7551
lines changed

32 files changed

+5833
-7551
lines changed
-1.82 MB
Binary file not shown.

content/en/benchmarks/frame-0003/test-legacy-3d.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ set wx 2.0
2929

3030
set nIP 5
3131

32-
set elements {1 2 3 5 7} ; # 6 4 (TODO)
32+
set elements {1 2 3 5 6 7} ; # 6 4 (TODO)
3333

3434
proc printRow {quantity expected computed} {
3535
verify error $computed $expected 2e-2 $quantity

content/en/benchmarks/frame-0004/aisc25.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import numpy as np
2+
import aisc25
23

34
class Column:
45
def __init__(self, E, I, L, H, Pr, w=None):
@@ -13,13 +14,17 @@ def create_model():
1314
pass
1415

1516
class Case1:
17+
# Cantilever with tip loads
1618
def __init__(self, E, I, L, H, Pr):
17-
lam = (np.pi / 2) * np.sqrt(Pr / ((np.pi**2 * E * I) / L**2))
19+
Pe = (np.pi**2 * E * I) / L**2
20+
self.Pe = Pe
21+
lam = (np.pi / 2) * np.sqrt(Pr / Pe)
1822
self.u = (H * L**3 / (3 * E * I)) * (3 * (np.tan(2 * lam) - 2 * lam) / (2 * lam)**3)
1923
self.M = H * L * (np.tan(2 * lam) / (2 * lam))
2024
self.xu = L
2125

2226
class Case2:
27+
#
2328
def __init__(self, E, I, L, H, Pr):
2429
lam = (np.pi / 2) * np.sqrt(Pr / ((np.pi**2 * E * I) / L**2))
2530
self.u = (H * L**3 / (12 * E * I)) * (3 * (np.tan(lam) - lam) / lam**3)
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Jun 2 2025
2+
import xara
3+
import xara.units.iks as units
4+
from xara.units.iks import inch, ksi, ft, kip
5+
import os
6+
import aisc25
7+
from xsection.library import from_aisc, Rectangle
8+
import numpy as np
9+
10+
def create_cantilever(shape, length, element, material,
11+
transform="Linear",
12+
shear=0,
13+
section="ShearFiber", ne=1, nen=2):
14+
15+
model = xara.Model(ndm=3, ndf=6, echo_file=open(f"test-{element}-{'shear' if shear else 'euler'}.tcl", "w+"))
16+
L = length
17+
nn = ne*(nen-1)+1
18+
19+
20+
E = material["E"]
21+
G = material["G"]
22+
nu = E / (2*G) - 1
23+
24+
if section == "Elastic":
25+
cmm = shape.torsion.cmm()
26+
cnn = shape.torsion.cnn()
27+
cnv = shape.torsion.cnv()
28+
cnm = shape.torsion.cnm()
29+
cmw = shape.torsion.cmw()
30+
A = cnn[0,0]
31+
model.section("ElasticFrame", 1,
32+
E=E,
33+
G=G,
34+
A=A,
35+
Ay=1*A,
36+
Az=1*A,
37+
Qy=cnm[0,1],
38+
Qz=cnm[2,0],
39+
Iy=cmm[1,1],
40+
Iz=cmm[2,2],
41+
J =shape.torsion.torsion_constant(),
42+
Ry= cnv[1,0],
43+
Rz=-cnv[2,0],
44+
Sy= cmw[1,0],
45+
Sz=-cmw[2,0]
46+
)
47+
else:
48+
model.nDMaterial('ElasticIsotropic', 1, E, nu)
49+
model.section("ShearFiber", 1)
50+
for fiber in shape.create_fibers():
51+
model.fiber(**fiber, material=1, section=1)
52+
53+
54+
model.geomTransf(transform, 1, (0,0,1))
55+
56+
for i,x in enumerate(np.linspace(0, L, nn)):
57+
model.node(i, (x,0,0))
58+
59+
for i in range(ne):
60+
start = i * (nen - 1)
61+
nodes = tuple(range(start, start + nen))
62+
model.element(element,
63+
i+1,
64+
nodes,
65+
section=1,
66+
transform=1,
67+
shear=shear,
68+
order=0)
69+
70+
71+
model.fix(0, (1,1,1, 1,1,1)) # Fixed at the root
72+
return model
73+
74+
75+
76+
def analyze(model, P, Pr):
77+
nn = len(model.getNodeTags())
78+
79+
model.pattern("Plain", 1, "Linear", load={nn-1: [Pr,0,0, 0,0,0]})
80+
model.integrator("LoadControl", 1/10)
81+
model.analysis("Static")#, pattern=1, integrator=1)
82+
model.test("Residual", 1e-9, 5)
83+
84+
assert model.analyze(10) == 0
85+
86+
model.loadConst(time=0)
87+
model.pattern("Plain", 2, "Linear", load={nn-1: [0,0,P, 0,0,0]})
88+
model.integrator("LoadControl", 1/10)
89+
model.analysis("Static")#, pattern=1, integrator=1)
90+
model.test("Residual", 1e-9, 5)
91+
92+
assert model.analyze(10) == 0
93+
94+
95+
96+
if __name__ == "__main__":
97+
# shape = Rectangle(d=14, b=10, mesh_scale=1/100) #
98+
shape = from_aisc("W14x48", units=units, mesh_scale=1/100)
99+
100+
E = 29e3*units.ksi
101+
G = 11.2e3*units.ksi # * 4/5
102+
103+
EI = E*shape.cmm()[1,1]
104+
105+
L = shape.d*40
106+
for shear in [0,]:
107+
model = create_cantilever(shape,
108+
length=L,
109+
material={
110+
"name": "ElasticIsotropic",
111+
"E": E, "G": G
112+
},
113+
element=os.environ.get("Element",
114+
"PrismFrame"),
115+
section="ShearFiber",
116+
transform="Corotational",
117+
shear=shear,
118+
ne =2,
119+
nen=2
120+
)
121+
122+
H = 1*kip
123+
Pr = 15*kip
124+
analyze(model, H, Pr)
125+
# model.print(json=True)
126+
# print(f"I = {EI/E}")
127+
128+
end = len(model.getNodeTags()) - 1
129+
uz = model.nodeDisp(end, 3)
130+
131+
section = dict(
132+
E = E,
133+
I = EI/E, #484.0*inch**4
134+
)
135+
136+
u_theory = aisc25.Case1(**section,L=L,H=H,Pr=Pr).u
137+
print((H * L**3 / (3 * EI)))
138+
139+
print(f"Uz = {uz:.6f}, Uz theory = {u_theory:.6f}")
140+
141+
# model.eval(f"verify value [nodeDisp {end} 3] {u_theory:.12f} 1e-6")

content/en/benchmarks/frame-0010/test.tcl renamed to content/en/benchmarks/frame-0010/test-2d.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ proc euler_buckling {
9494
}
9595
}
9696

97-
euler_buckling
97+
euler_buckling forceBeamColumn Corotational
9898
# euler_buckling PrismFrame
9999

0 commit comments

Comments
 (0)