Skip to content

Instantly share code, notes, and snippets.

@terjehaukaas
terjehaukaas / PlotBeamDiagrams.py
Last active June 11, 2019 01:06
Plot Beam Diagrams
# ------------------------------------------------------------------------
# The following Python code is implemented by Professor Terje Haukaas at
# the University of British Columbia in Vancouver, Canada. It is made
# freely available online at terje.civil.ubc.ca together with notes,
# examples, and additional Python code. Please be cautious when using
# this code; it may contain bugs and comes without any form of warranty.
# Please see the Programming note for how to get started, and notice
# that you must copy certain functions into the file terjesfunctions.py
# ------------------------------------------------------------------------
@terjehaukaas
terjehaukaas / getTrussStiffness2D.py
Created June 11, 2019 01:39
Get Truss Stiffness 2D
# ------------------------------------------------------------------------
# The following function is implemented in Python by Professor Terje Haukaas
# at the University of British Columbia in Vancouver, Canada. It is made
# freely available online at terje.civil.ubc.ca together with notes,
# examples, and additional Python code. Please be cautious when using
# this code; it may contain bugs and comes without any form of warranty.
# ------------------------------------------------------------------------
def getTrussStiffness2D(E, A, L, delta_x, delta_y, N):
@terjehaukaas
terjehaukaas / getFrameStiffness2D.py
Created June 11, 2019 01:43
Get Frame Stiffness 2D
# ------------------------------------------------------------------------
# The following function is implemented in Python by Professor Terje Haukaas
# at the University of British Columbia in Vancouver, Canada. It is made
# freely available online at terje.civil.ubc.ca together with notes,
# examples, and additional Python code. Please be cautious when using
# this code; it may contain bugs and comes without any form of warranty.
# ------------------------------------------------------------------------
def getFrameStiffness2D(E, nu, I, A, beta, L, delta_x, delta_y, N):
@terjehaukaas
terjehaukaas / getQuad4Stiffness2D.py
Created June 11, 2019 01:46
Get Quad4 Stiffness 2D
# ------------------------------------------------------------------------
# The following function is implemented in Python by Professor Terje Haukaas
# at the University of British Columbia in Vancouver, Canada. It is made
# freely available online at terje.civil.ubc.ca together with notes,
# examples, and additional Python code. Please be cautious when using
# this code; it may contain bugs and comes without any form of warranty.
# ------------------------------------------------------------------------
def getQuad4Stiffness2D(E, nu, t, ps, x, y):
@terjehaukaas
terjehaukaas / assembleStiffnessMatrix.py
Last active January 26, 2020 07:26
Assemble Stiffness Matrix
# ------------------------------------------------------------------------
# The following functions are implemented in Python by Professor Terje Haukaas
# at the University of British Columbia in Vancouver, Canada. It is made
# freely available online at terje.civil.ubc.ca together with notes,
# examples, and additional Python code. Please be cautious when using
# this code; it may contain bugs and comes without warranty of any form
# ------------------------------------------------------------------------
def assembleStiffnessMatrix(Ka, Kg, nodeList, numDOFsPerNodeInElement, numDOFsPerNodeInStructure):
@terjehaukaas
terjehaukaas / LinearStaticStructuralAnalysis.py
Last active July 23, 2021 03:22
Linear Static Structural Analysis
# ------------------------------------------------------------------------
# The following Python code is implemented by Professor Terje Haukaas at
# the University of British Columbia in Vancouver, Canada. It is made
# freely available online at terje.civil.ubc.ca together with notes,
# examples, and additional Python code. Please be cautious when using
# this code; it may contain bugs and comes without any form of warranty.
# Please see the Programming note for how to get started, and notice
# that you must copy certain functions into the file terjesfunctions.py
# ------------------------------------------------------------------------
@terjehaukaas
terjehaukaas / trapezoidalRecordIntegration.py
Created June 11, 2019 02:24
Trapezoidal Record Integration
# ------------------------------------------------------------------------
# The following function is implemented in Python by Professor Terje Haukaas
# at the University of British Columbia in Vancouver, Canada. It is made
# freely available online at terje.civil.ubc.ca together with notes,
# examples, and additional Python code. Please be cautious when using
# this code; it may contain bugs and comes without any form of warranty.
# ------------------------------------------------------------------------
def trapezoidalRecordIntegration(delta_t, record):
@terjehaukaas
terjehaukaas / sdofNewmark.py
Created June 11, 2019 02:27
SDOF Newmark
# ------------------------------------------------------------------------
# The following function is implemented in Python by Professor Terje Haukaas
# at the University of British Columbia in Vancouver, Canada. It is made
# freely available online at terje.civil.ubc.ca together with notes,
# examples, and additional Python code. Please be cautious when using
# this code; it may contain bugs and comes without any form of warranty.
# ------------------------------------------------------------------------
def sdofNewmark(m, c, k, delta_t, record):
@terjehaukaas
terjehaukaas / sdofDynamicAnalysis.py
Last active March 29, 2024 19:46
SDOF Dynamic Analysis
# ------------------------------------------------------------------------
# The following Python code is implemented by Professor Terje Haukaas at
# the University of British Columbia in Vancouver, Canada. It is made
# freely available online at terje.civil.ubc.ca together with notes,
# examples, and additional Python code. Please be cautious when using
# this code; it may contain bugs and comes without warranty of any kind.
# Also notice that for this particular code you need these three files:
# GroundAccelerationX.txt
# GroundAccelerationY.txt
# GroundAccelerationZ.txt
@terjehaukaas
terjehaukaas / mdofDynamicAnalysis.py
Last active March 23, 2023 02:44
MDOF Dynamic Analysis
# ------------------------------------------------------------------------
# The following Python code is implemented by Professor Terje Haukaas at
# the University of British Columbia in Vancouver, Canada. It is made
# freely available online at terje.civil.ubc.ca together with notes,
# examples, and additional Python code. Please be cautious when using
# this code; it may contain bugs and comes without warranty of any form.
# Please see the Programming note for how to get started, and notice
# that you must copy certain functions into the file terjesfunctions.py
# Also notice that for this particular code you need the file
# ElCentroGroundMotion.txt, which is posted nearby.