diff --git a/examples/SpaceTruss/space_truss.py b/examples/SpaceTruss/space_truss.py new file mode 100644 index 0000000..fd0ec8a --- /dev/null +++ b/examples/SpaceTruss/space_truss.py @@ -0,0 +1,52 @@ +import numpy as np +import opensees.openseespy as ops + +def space_truss(ns, Ro, Ri, H): + """Generate a 3D truss""" + + model = ops.Model(3,3) + m1 = model.material('default', 1.0) + s1 = model.xsection('default', 1.0, 1.0) + + # Specify node coordinates for support points + # angle for supports + phi = np.arange(ns)/ns*2*np.pi + + # Coordinates for support points + X = np.cos(phi)*Ro + Y = np.sin(phi)*Ro + # Generate support points with height Z of 0 + for i in range(ns): + model.node(i+1, X[i], Y[i], 0.0) + + # Angles for upper ring (offset by pi/ns degrees from supports) + phi = phi+np.pi/ns + + # Coordinates for upper ring + X = np.append(X, np.cos(phi)*Ri) + Y = np.append(Y, np.sin(phi)*Ri) + + # Generate coordinates for upper ring with height H + for i in np.arange(ns, 2*ns): + model.node(i+1, X[i], Y[i], H) + + for i, j, k in zip(np.arange(ns), np.arange(0, ns), np.arange(ns, 2*ns)): + model.element("Truss", i+1, j, k, m1, s1) + + model.element("Truss", alpha[ns+1], 0, 2*ns-1, m1, s1) + + for i, j, k in zip(np.arange(ns+1, 2*ns), np.arange(1, ns), np.arange(ns, 2*ns-1)): + model.element("Truss", i+1, j, k, m1, s1) + + for i, j, k in zip(np.arange(2*ns, 3*ns-1), np.arange(ns, 2*ns-1), np.arange(ns+1, 2*ns)): + model.element("Truss", i+1, j, k, m1, s1) + + model.element("Truss", 3*ns, ns, 2*ns-1, m1, s1) + + + # boundary conditions + for node in range(ns): + model.fix(node, (1, 1, 1)) + + + return model diff --git a/examples/chopra-10.4/index.html b/examples/chopra-10.4/index.html index cb011b9..31b1c20 100644 --- a/examples/chopra-10.4/index.html +++ b/examples/chopra-10.4/index.html @@ -389,13 +389,13 @@
python EigenAnal_twoStoryShearFrame8.py
python -m opensees EigenAnal_twoStoryShearFrame8.tcl
import opensees.openseespy as ops
@@ -487,7 +487,7 @@ Create the model
-
+
model BasicBuilder -ndm 2 -ndf 3
@@ -515,13 +515,13 @@ Create the model
Python
Tcl
@@ -537,7 +537,7 @@ Create the model
-
+
model.node(1, 0., 0.)
model.node(2, L , 0.)
@@ -554,7 +554,7 @@ Create the model
-
+
node 1 0. 0. ;
node 2 $L 0. ;
@@ -584,13 +584,13 @@ Create the model
Python
Tcl
@@ -606,7 +606,7 @@ Create the model
-
+
model.fix(1, 1, 1, 1)
model.fix(2, 1, 1, 1)
@@ -619,7 +619,7 @@ Create the model
-
+
fix 1 1 1 1;
fix 2 1 1 1;
@@ -647,13 +647,13 @@ Create the model
Python
Tcl
@@ -669,7 +669,7 @@ Create the model
-
+
model.mass(3, m , 0., 0. )
model.mass(4, m , 0., 0. )
@@ -684,7 +684,7 @@ Create the model
-
+
mass 3 $m 0. 0. ;
mass 4 $m 0. 0. ;
@@ -717,13 +717,13 @@ Create the model
Python
Tcl
@@ -739,7 +739,7 @@ Create the model
-
+
model.element("ElasticBeamColumn", 1, 1, 3, Ac, Ec, 2.*Ic, TransfTag)
model.element("ElasticBeamColumn", 2, 3, 5, Ac, Ec, Ic, TransfTag)
@@ -756,7 +756,7 @@ Create the model
-
+
element elasticBeamColumn 1 1 3 $Ac $Ec [expr 2.*$Ic] $TransfTag;
element elasticBeamColumn 2 3 5 $Ac $Ec $Ic $TransfTag;
@@ -794,13 +794,13 @@ Create the model
Python
Tcl
@@ -816,7 +816,7 @@ Create the model
-
+
for k in range(numModes):
model.recorder("Node", f"eigen {k}", file=f"modes/mode{k}.out", nodeRange=[1, 6], dof=[1, 2, 3])
@@ -829,7 +829,7 @@ Create the model
-
+
foreach k [range $numModes] {
recorder Node -file [format "modes/mode%i.out" $k] -nodeRange 1 6 -dof 1 2 3 "eigen $k"
diff --git a/examples/example1/index.html b/examples/example1/index.html
index c1dab1f..9b6e29a 100644
--- a/examples/example1/index.html
+++ b/examples/example1/index.html
@@ -373,13 +373,13 @@ Model
Python
Tcl
@@ -395,7 +395,7 @@ Model
-
+
import opensees.openseespy as ops
@@ -409,7 +409,7 @@ Model
-
+
model -ndm 2 -ndf 2
@@ -436,13 +436,13 @@ Model
Python
Tcl
@@ -458,7 +458,7 @@ Model
-
+
# Create nodes
# tag X Y
@@ -475,7 +475,7 @@ Model
-
+
# Create nodes & add to domain
# tag X Y
@@ -504,13 +504,13 @@ Model
Python
Tcl
@@ -526,7 +526,7 @@ Model
-
+
# set the boundary conditions
# nodeID xRestrnt? yRestrnt?
@@ -542,7 +542,7 @@ Model
-
+
# Set the boundary conditions
# tag X Y
@@ -572,13 +572,13 @@ Model
Python
Tcl
@@ -594,7 +594,7 @@ Model
-
+
# Create Elastic material prototype
model.uniaxialMaterial("Elastic", 1, 3000)
@@ -607,7 +607,7 @@ Model
-
+
# Create Elastic material prototype
uniaxialMaterial Elastic 1 3000;
@@ -639,13 +639,13 @@ Model
Python
Tcl
@@ -661,7 +661,7 @@ Model
-
+
# Type tag nodes Area material
model.element("Truss", 1, (1, 4), 10.0, 1 )
@@ -676,7 +676,7 @@ Model
-
+
element Truss 1 1 4 10.0 1;
element Truss 2 2 4 5.0 1;
@@ -710,13 +710,13 @@ Loads
Python
Tcl
@@ -732,7 +732,7 @@ Loads
-
+
loads = {4: [100, -50]}
@@ -744,7 +744,7 @@ Loads
-
+
set loads {4 100 -50}
@@ -769,13 +769,13 @@ Loads
Python
Tcl
@@ -791,7 +791,7 @@ Loads
-
+
model.pattern("Plain", 1, "Linear", load=loads)
@@ -803,7 +803,7 @@ Loads
-
+
pattern Plain 1 "Linear" "load $loads"
@@ -828,13 +828,13 @@ Loads
Python
Tcl
@@ -850,7 +850,7 @@ Loads
-
+
model.pattern("Plain", 1, "Linear", load={
4: [100, -50]
@@ -864,7 +864,7 @@ Loads
-
+
pattern Plain 1 "Linear" {
load 4 100 -50
@@ -892,13 +892,13 @@ Analysis
Python
Tcl
@@ -914,7 +914,7 @@ Analysis
-
+
model.algorithm("Linear")
@@ -926,7 +926,7 @@ Analysis
-
+
algorithm Linear;
@@ -953,13 +953,13 @@ Analysis
Python
Tcl
@@ -975,7 +975,7 @@ Analysis
-
+
model.integrator("LoadControl", 1.0)
@@ -987,7 +987,7 @@ Analysis
-
+
integrator LoadControl 1.0;
@@ -1017,13 +1017,13 @@ Analysis
Python
Tcl
@@ -1039,7 +1039,7 @@ Analysis
-
+
model.analysis("Static")
@@ -1051,7 +1051,7 @@ Analysis
-
+
analysis Static;
@@ -1074,13 +1074,13 @@ Analysis
Python
Tcl
@@ -1096,7 +1096,7 @@ Analysis
-
+
model.analyze(1)
@@ -1108,7 +1108,7 @@ Analysis
-
+
analyze 1
@@ -1132,13 +1132,13 @@ Analysis
Python
Tcl
@@ -1154,7 +1154,7 @@ Analysis
-
+
model.print(node=4)
model.print("ele")
@@ -1167,7 +1167,7 @@ Analysis
-
+
print node 4
print ele
diff --git a/examples/example2/index.html b/examples/example2/index.html
index 143201c..daa676b 100644
--- a/examples/example2/index.html
+++ b/examples/example2/index.html
@@ -370,13 +370,13 @@ Modeling
Python
Tcl
@@ -392,7 +392,7 @@ Modeling
-
+
Example2.py
@@ -406,7 +406,7 @@ Modeling
-
+
Example2.tcl
@@ -445,13 +445,13 @@ Modeling
Python
Tcl
@@ -467,7 +467,7 @@ Modeling
-
+
model.section("Fiber", 1)
# Create the concrete core fibers
@@ -490,7 +490,7 @@ Modeling
-
+
section Fiber 1 {
diff --git a/examples/example3/index.html b/examples/example3/index.html
index 6da27ef..a91af75 100644
--- a/examples/example3/index.html
+++ b/examples/example3/index.html
@@ -368,13 +368,13 @@
Python
Tcl
@@ -390,7 +390,7 @@
-
+
portal.py
@@ -404,7 +404,7 @@
-
+
portal.tcl
@@ -466,13 +466,13 @@ create_portal
Python
Tcl
@@ -488,7 +488,7 @@ create_portal
-