


























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Several numerical methods for solving structural analysis problems, including the direct step iteration, newton-raphson method, modified newton-raphson method, and incremental method. The code provided demonstrates the implementation of these methods using the numpy library in python. The key steps involved in each method, such as calculating the displacement, stiffness matrix, and force error. It also shows how the stiffness matrix is updated at each iteration to account for the changing structural behavior. This document would be useful for students and researchers interested in computational mechanics, finite element analysis, and structural engineering. The methods presented can be applied to a wide range of structural analysis problems, from simple truss structures to more complex systems.
Typology: Schemes and Mind Maps
1 / 34
This page cannot be seen from the preview
Don't miss anything!



























1 import numpy as np 2 np.set_printoptions(precision= 4 ) 3 ks= np.matrix([[ 150 ,- 100 , 0 ],[- 100 , 250 .,- 150 ],[ 0 ,- 150 , 350 ]]).astype(float) 4 force=np.matrix([[ 90 ],[ 60 ],[ 30 ]]) 5 # ks=np.matrix(ks_initial,dtype='float 64 ') 6 u_ini=np.matrix([[ 0 ],[ 0 ],[ 0 ]]) 7 i= 0 8 while True: 9 i=i+ 1 10 print(f"iteration={i}") 11 u=np.linalg.inv(ks).dot(force) 12 print (f"Displacement={u}") 13 ks[ 0 , 0 ]= 150 - 5 *u[ 0 ]+ 10 *u[ 1 ] 14 ks[ 1 , 0 ]=- 100 + 10 *u[ 0 ]- 10 *u[ 1 ] 15 ks[ 1 , 1 ]= 250 - 10 *u[ 0 ]- 5 *u[ 1 ]+ 15 *u[ 2 ] 16 ks[ 2 , 1 ]=- 150 + 15 *u[ 1 ]- 15 *u[ 2 ] 17 ks[ 2 , 2 ]= 350 - 15 *u[ 1 ]- 15 *u[ 2 ] 18 ks[ 0 , 1 ]=ks[ 1 , 0 ] 19 ks[ 1 , 2 ]=ks[ 2 , 1 ] 20 print(f"Stiffness={ks}") 21 if(u[ 0 ]-u_ini[ 0 ]< 0. 0001 and u[ 1 ]-u_ini[ 1 ]< 0. 0001 and u[ 2 ]-u_ini[ 2 ]< 0. 0001 ): 22 break 23 u_ini=u
1 import numpy as np 2 ks= np.matrix([[ 150 ,- 100 , 0 ],[- 100 , 250 .,- 150 ],[ 0 ,- 150 , 350 ]]) 3 kt= np.matrix([[ 150 ,- 100 , 0 ],[- 100 , 250 .,- 150 ],[ 0 ,- 150 , 350 ]]) 4 force=np.matrix([[ 90 ],[ 60 ],[ 30 ]]) 5 error=np.matrix(force) 6 # derror=np.matrix([[ 0 ],[ 0 ],[ 0 ]]) 7 u=np.matrix([[ 0 ],[ 0 ],[ 0 ]]) 8 i= 1 9 while True: 10 print(f"Iteration={i}") 11 i=i+ 1 12 13 derror=np.linalg.inv(kt).dot(error) 14 print("Change in displacement\n") 15 print(derror) 16 u=u+derror 17 print("Displacement\n") 18 print(u) 19 ks[ 0 , 0 ]= 150 - 5 *u[ 0 ]+ 10 *u[ 1 ] 20 ks[ 1 , 0 ]=- 100 + 10 *u[ 0 ]- 10 *u[ 1 ] 21 ks[ 1 , 1 ]= 250 - 10 *u[ 0 ]- 5 *u[ 1 ]+ 15 *u[ 2 ] 22 ks[ 2 , 1 ]=- 150 + 15 *u[ 1 ]- 15 *u[ 2 ] 23 ks[ 2 , 2 ]= 350 - 15 *u[ 1 ]- 15 *u[ 2 ] 24 ks[ 0 , 1 ]=ks[ 1 , 0 ] 25 ks[ 1 , 2 ]=ks[ 2 , 1 ] 26 print("Secant stiffness\n") 27 print(ks) 28 error=force-ks.dot(u) 29 print("Force error\n") 30 print (error) 31 kt[ 0 , 0 ]= 150 - 10 *u[ 0 ]+ 20 *u[ 1 ] 32 kt[ 1 , 0 ]=- 100 + 20 *u[ 0 ]- 20 *u[ 1 ] 33 kt[ 1 , 1 ]= 250 - 20 *u[ 0 ]- 10 *u[ 1 ]+ 30 *u[ 2 ] 34 kt[ 2 , 1 ]=- 150 + 30 *u[ 1 ]- 30 *u[ 2 ] 35 kt[ 2 , 2 ]= 350 - 30 *u[ 1 ]- 30 *u[ 2 ] 36 kt[ 0 , 1 ]=kt[ 1 , 0 ] 37 kt[ 1 , 2 ]=kt[ 2 , 1 ] 38 print("Tangential stiffness\n") 39 print(kt) 40 if(derror[ 0 ]< 0. 0001 and derror[ 1 ]< 0. 0001 and derror[ 2 ]< 0. 0001 ): 41 break
1 import numpy as np 2 kt= np.matrix([[ 150 ,- 100 , 0 ],[- 100 , 250 .,- 150 ],[ 0 ,- 150 , 350 ]]) 3 force=np.matrix([[ 90 ],[ 60 ],[ 30 ]]) 4 uf=np.matrix([[ 0 ],[ 0 ],[ 0 ]]) 5 i= 0 6 while True: 7 i=i+ 1 8 dforce=force/ 3 9 print(f"Iteration={i}") 10 u=np.linalg.inv(kt).dot(dforce) 11 uf=uf+u 12 print("Displacement\n") 13 print(uf) 14 kt[ 0 , 0 ]= 150 - 10 *u[ 0 ]+ 20 *u[ 1 ] 15 kt[ 1 , 0 ]=- 100 + 20 *u[ 0 ]- 20 *u[ 1 ] 16 kt[ 1 , 1 ]= 250 - 20 *u[ 0 ]- 10 *u[ 1 ]+ 30 *u[ 2 ] 17 kt[ 2 , 1 ]=- 150 + 30 *u[ 1 ]- 30 *u[ 2 ] 18 kt[ 2 , 2 ]= 350 - 30 *u[ 1 ]- 30 *u[ 2 ] 19 kt[ 0 , 1 ]=kt[ 1 , 0 ] 20 kt[ 1 , 2 ]=kt[ 2 , 1 ] 21 print("Tangential stiffness\n") 22 print(kt) 23 if(i== 3 ): 24 break