Skip to main content

StructuralAnalysis

Library to perfrom framed structures analysis

Installation

Use the package manager pip to install StructuralAnalysis.

pip install StructuralAnalysis

Requirements

The following packages must be installed first:

pip install numpy==1.19.5
pip install PyOpenGL==3.1.5
pip install PyQt5==5.15.2
pip install pyqtgraph==0.11.1

Usage

# Two_Story_Frame.py

from StructuralAnalysis import Node, Structure, Section, Material, Solver, Visualization
from StructuralAnalysis.FrameElements import *

# General considerations:
#    - y-axis is upward
#    - use consistent units
#    - each node has 6 degrees of freedom dx: dof_1, dy: dof_2, dz: dof_3, rx: dof_4, ry: dof_5, rz: dof_6

# create node objects <Node(x, y, z)>
n1 = Node(0, 0, 0)
n2 = Node(6000, 0, 0)
n3 = Node(0, 0, 6000)
n4 = Node(6000, 0, 6000)

n5 = Node(0, 6000, 0)
n6 = Node(6000, 6000, 0)
n7 = Node(0, 6000, 6000)
n8 = Node(6000, 6000, 6000)

n9 = Node(0, 12000, 0)
n10 = Node(6000, 12000, 0)
n11 = Node(0, 12000, 6000)
n12 = Node(6000, 12000, 6000)

# create section object
user_defined_section = Section.ArbitrarySection(area=3000, inertia_y=180 * 10 ** 6, inertia_z=180 * 10 ** 6,
                                                polar_inertia=360*10**6, warping_rigidity=0)

rectangular_section = Section.Rectangle(breadth=150, depth=300)

# create material object
steel = Material.Steel(yield_strength=250, ultimate_strength=400, elasticity_modulus=200000, poissons_ratio=0.2)

# create frame element objects <FrameElement(start_node: Node, end_node: Node, section: Section, material: Material)>
e15 = FrameElement(n1, n5, user_defined_section, steel)
e26 = FrameElement(n2, n6, user_defined_section, steel)
e37 = FrameElement(n3, n7, rectangular_section, steel)
e48 = FrameElement(n4, n8, rectangular_section, steel)

e56 = FrameElement(n5, n6, user_defined_section, steel)
e68 = FrameElement(n6, n8, user_defined_section, steel)
e87 = FrameElement(n8, n7, rectangular_section, steel)
e57 = FrameElement(n5, n7, rectangular_section, steel)

e59 = FrameElement(n5, n9, user_defined_section, steel)
e610 = FrameElement(n10, n6, user_defined_section, steel)
e711 = FrameElement(n11, n7, rectangular_section, steel)
e812 = FrameElement(n8, n12, rectangular_section, steel)

e910 = FrameElement(n9, n10, rectangular_section, steel)
e1112 = FrameElement(n11, n12, rectangular_section, steel)
e911 = FrameElement(n11, n9, user_defined_section, steel)
e1012 = FrameElement(n10, n12, user_defined_section, steel)

# create truss element object
e16 = TrussElement(n1, n6, rectangular_section, steel)

# assign boundary conditions; node_1 is hinged, node_2, 3, 4 are fixed
n1.dof_1.restrained = True
n1.dof_2.restrained = True
n1.dof_3.restrained = True

n2.dof_1.restrained = True
n2.dof_2.restrained = True
n2.dof_3.restrained = True
n2.dof_4.restrained = True
n2.dof_5.restrained = True
n2.dof_6.restrained = True

n3.dof_1.restrained = True
n3.dof_2.restrained = True
n3.dof_3.restrained = True
n3.dof_4.restrained = True
n3.dof_5.restrained = True
n3.dof_6.restrained = True

n4.dof_1.restrained = True
n4.dof_2.restrained = True
n4.dof_3.restrained = True
n4.dof_4.restrained = True
n4.dof_5.restrained = True
n4.dof_6.restrained = True

# assign loads to node_10 in the x-direction, and to node_6 in the z-direction
n10.dof_1.force = 2000000
n6.dof_3.force = 4000000

# assign initial displacement to node_4 in the negative y-direction
n4.dof_2.displaced = -1000

# create structure object
structure = Structure([e15, e26, e37, e48, e56, e68, e87, e57, e59, e610, e711, e812, e910, e1112, e911, e1012, e16])

# run first_order_elastic analysis
Solver.analyze_first_order_elastic(structure)

# show undeformed structure
Visualization.show_structure(structure)

# show deformations <show_deformed_shape(structure, number_of_stations, scale)>
Visualization.show_deformed_shape(structure, 10, 1)

# show window
Visualization.execute_qt()

Output

Upon running the above code, two text files ("Input.exe" and "Results.exe") are generated in the working directory. The "Results.txt" contains the displacements and reactions solved for. The following window pops up showing the undeformed structure (white) and the deformed shape (red). The axis colors are as follows:

  • Blue : X-axis
  • Yellow: Y-axis
  • Green: Z-axis

alt text

Gallary

Python files for below pictures can be found in the "Examples" folder.

  • Examples/ Hinged_Fixed_2D_Frame.py alt text
  • Examples/ Pyramid_Frame.py alt text
  • Examples/ Two_Story_Frame.py alt text
  • Examples/ Frame_Truss.py alt text alt text alt text alt text alt text

Under Development

The following enhancements will be included soon:

  • Releases at element end nodes.
  • Non-nodal loading.
  • Straining actions diagrams
  • Initial thermal straining.
  • Second-order elastic analysis.
  • First-order inelastic analysis.
  • Second-order inelastic analysis.
  • Eigenvalue analysis of buckling.
  • Dynamic analysis

Considerations

Kindly note that the library is still under development, errors may arise as the library has not been tested and exceptions have not been handled. The visualization depends on graphics library "PyQtGraph" which is still in its early stages of development, as a result, some of the features of displaying texts (i.e., node labels, axis labels, ..) have not been included yet.

Metadata

Release files for StructuralAnalysis 0.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for StructuralAnalysis 0.21
File Size Uploaded
StructuralAnalysis-0.21.tar.gz 14.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for StructuralAnalysis 0.21
File Interpreter ABI Platform
StructuralAnalysis-0.21-py3-none-any.whl Python 3 none any Details

Total release size: 31.6 kB

Release files / StructuralAnalysis-0.21.tar.gz

Download URL StructuralAnalysis-0.21.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a0842d31b083af3fba58afdaef3921a74ec48f57b392dd2f3ac9036ab93d01a7
BLAKE2b-256 checksum
How to use checksums
a51210e019eebe01ea4dd5436c45b20ccdd761c706044130b19e0ef3c2e4e544
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0

Release files / StructuralAnalysis-0.21-py3-none-any.whl

Download URL StructuralAnalysis-0.21-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b63277b160da4e9837709d800ef3c2c84c2fb07a9f56d452f185ad078faa2e09
BLAKE2b-256 checksum
How to use checksums
4824b5b01797f5a3125ee59e46f42ec8212351ce108ab55b5773a1a87b5ea6ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.21 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page