Created
June 11, 2019 02:27
-
-
Save terjehaukaas/0632cc0ce6682a9faa621125594e8365 to your computer and use it in GitHub Desktop.
SDOF Newmark
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 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): | |
beta = 1.0/6.0 | |
F1 = 1.0/beta*(m/delta_t+c/2.0) | |
F2 = 1.0/2.0*(c*(2.0-1.0/(2.0*beta))*delta_t-m/beta) | |
F3 = 1.0/beta*(m/delta_t**2+c/(2.0*delta_t)) | |
F4 = 1.0/(beta*delta_t**2) | |
F5 = 1.0/(beta*delta_t) | |
F6 = 1.0/(2.0*beta) | |
F7 = 1.0/(2.0*beta*delta_t) | |
F8 = 1.0/2.0*(2.0-1.0/(2.0*beta))*delta_t | |
structuralDisplacement = [0] | |
structuralVelocity = [0] | |
structuralAcceleration = [0] | |
time = 0.0 | |
ui = 0.0 | |
uDoti = 0.0 | |
uDotDoti = 0.0 | |
for i in range(len(record)-1): | |
delta_force = -m/100.0 * (record[i+1]-record[i]) | |
delta_displacement = (delta_force + F1*uDoti - F2*uDotDoti) / (F3 + k) | |
delta_velocity = F7*delta_displacement - F6*uDoti + F8*uDotDoti | |
delta_acceleration = F4*delta_displacement - F5*uDoti - F6*uDotDoti | |
ui += delta_displacement | |
uDoti += delta_velocity | |
uDotDoti += delta_acceleration | |
time += delta_t | |
# Store *relative* disp & vel but *total* acceleration | |
structuralDisplacement.append(ui*100.0) | |
structuralVelocity.append(uDoti*100.0) | |
structuralAcceleration.append(uDotDoti*100.0 + record[i+1]) | |
return [structuralDisplacement, structuralVelocity, structuralAcceleration] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment