Last active
April 2, 2024 02:36
-
-
Save terjehaukaas/031d4da3478df94bbf53a06bea56cd39 to your computer and use it in GitHub Desktop.
G2 Example 9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------------------ | |
# 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 * | |
from G2Model import * | |
elementType = 3 # Truss element with geometric nonlinearity | |
L = 2000.0 # Length of each element | |
F = 1500.0 # Vertical load on the truss | |
N0 = 0.0 # Initial axial force | |
h = 50.0 # Truss camber | |
A = 25**2 # Cross-section area | |
E = 210000.0 # Young's modulus | |
nsteps = 20 # Number of load steps | |
dt = 1.0/nsteps # Steps of pseudo-time | |
maxIter = 100 # Maximum number of equilibrium iterations | |
KcalcFrequency = 1 # 0=initial stress method, 1=Newton-Raphson, maxIter=Modified NR | |
tol = 1e-3 # Convergence tolerance | |
trackNode = 2 # Node to be plotted | |
trackDOF = 2 # DOF to be plotted | |
# Nodes | |
NODES = np.array([[0.0, 0.0], | |
[L, h], | |
[2*L, 0.0]]) | |
# Boundary conditions | |
CONSTRAINTS = np.array([[1, 1], | |
[0, 0], | |
[1, 1]]) | |
# Elements | |
ELEMENTS = [[elementType, E, A, N0, 1, 2], | |
[elementType, E, A, N0, 2, 3]] | |
# Empty arrays | |
SECTIONS = np.zeros((2,2)) | |
MATERIALS = np.zeros((2,2)) | |
# Loads | |
LOADS = np.array([[0.0, 0.0], | |
[0.0, -F], | |
[0.0, 0.0]]) | |
# Loads | |
MASS = np.array([[0.0, 0.0], | |
[0.0, 0.0], | |
[0.0, 0.0]]) | |
# Create the model object | |
a = [NODES, CONSTRAINTS, ELEMENTS, SECTIONS, MATERIALS, LOADS, MASS] | |
m = model(a) | |
# Analyze | |
nonlinearStaticAnalysis(m, nsteps, dt, maxIter, KcalcFrequency, tol, trackNode, trackDOF, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment