Skip to content

Instantly share code, notes, and snippets.

@terjehaukaas
terjehaukaas / G2Example9.py
Last active April 2, 2024 02:36
G2 Example 9
# ------------------------------------------------------------------------
# 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.
# ------------------------------------------------------------------------
# Units: [N, mm]
from G2AnalysisNonlinearStatic import *
@terjehaukaas
terjehaukaas / G2Example8.py
Last active April 4, 2024 22:32
G2 Example 8
# 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.
# The code implemented in this file is underpinned by axial strain and axial
# stress, which are related to both axial force (P) and bending moment (M).
# The capacity of a cross-section to carry axial force and bending moment
# depends on several factors: its geometry, the materials it is made up of,
@terjehaukaas
terjehaukaas / G2Example7.py
Last active April 4, 2024 22:44
G2 Example 7
# ------------------------------------------------------------------------
# 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.
# ------------------------------------------------------------------------
import matplotlib.pyplot as plt
from G2AnalysisNonlinearStatic import *
@terjehaukaas
terjehaukaas / G2Example6.py
Last active April 2, 2024 02:34
G2 Example 6
# ------------------------------------------------------------------------
# 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.
# ------------------------------------------------------------------------
from G2AnalysisNonlinearStatic import *
from G2Model import *
@terjehaukaas
terjehaukaas / G2Example5.py
Last active April 2, 2024 02:31
G2 Example 5
# ------------------------------------------------------------------------
# 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.
# ------------------------------------------------------------------------
from G2AnalysisNonlinearStatic import *
from G2Model import *
@terjehaukaas
terjehaukaas / G2Example4.py
Last active April 2, 2024 02:31
G2 Example 4
# ------------------------------------------------------------------------
# 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.
# ------------------------------------------------------------------------
import matplotlib.pyplot as plt
from G2MaterialPlasticity import *
@terjehaukaas
terjehaukaas / G2Example3.py
Last active April 2, 2024 02:30
G2 Example 3
# ------------------------------------------------------------------------
# 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.
# ------------------------------------------------------------------------
from G2AnalysisNonlinearStatic import *
from G2Model import *
@terjehaukaas
terjehaukaas / G2Example2.py
Last active April 3, 2024 20:15
G2 Example 2
from G2AnalysisSDOFNonlinearDynamic import *
from G2MaterialBilinear import *
import numpy as np
import matplotlib.pyplot as plt
# SI units: N, m, kg, sec.
# Natural periods considered
minPeriod = 0.1
maxPeriod = 5.0
@terjehaukaas
terjehaukaas / G2Example1.py
Last active April 2, 2024 02:27
G2 Example 1
from G2AnalysisSDOFNonlinearDynamic import *
from G2MaterialBilinear import *
import numpy as np
import matplotlib.pyplot as plt
# SI units: N, m, kg, sec.
# Spectrum range (natural periods)
minPeriod = 0.05
maxPeriod = 5.0
@terjehaukaas
terjehaukaas / G2Element10.py
Last active April 2, 2024 02:17
G2 Element 10
# ------------------------------------------------------------------------
# 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.
# ------------------------------------------------------------------------
# Element 10: Rigid element with one hysteretic uniaxial material at each end
from G2MaterialBilinear import *