Chapter3-Analysis of Strain

Ex1-pg82

In [2]:
#given matrix 
import math
#find all the strains
#by strain components
Ex=0.06
Ey=0.01
Ez=0.01
Exy=0.05
Eyx=0.03
Eyz=0
Ezy=0
Exz=0.02
Ezx=0.01
gammaxy=Exy-Eyx
gammayz=Eyz-Ezy
gammazx=Exz+Ezx
print'%s %.2f %s'%('gammaxy',gammaxy,'')
print'%s %.2f %s'%('gammayz',gammayz,'')
print'%s %.2f %s'%('gammazx',gammazx,'')
gammaxy 0.02 
gammayz 0.00 
gammazx 0.03 

Ex3-pg88

In [1]:
#show that they equal
import math
import numpy
from numpy import linalg
## initialization of variables

epsillon=numpy.matrix([[0.01, 0, 0],[0, 0.02, 0.02],[0, 0.02, 0.01]]) ## dimensionless
theta=30. ## degrees
##calculations
theta=theta*math.pi/180.
a=numpy.matrix([[math.cos(theta), math.sin(theta), 0],
  [-math.sin(theta), math.cos(theta), 0],
   [0, 0, 1]])

b=numpy.transpose(a)
epsillon_new=numpy.dot(epsillon,b)
epsillon1=numpy.dot(a,epsillon)
## calculation of strain invariants
## for epsillon
J1=epsillon[0,0]+epsillon[1,1]+epsillon[2,2]
J2=epsillon[0,0]*epsillon[1,1]+epsillon[1,1]*epsillon[2,2]+epsillon[2,2]*epsillon[0,0]-2*(epsillon[0,1]**2+epsillon[1,2]**2+epsillon[2,0]**2)
J3=epsillon[0,0]*epsillon[1,1]*epsillon[2,2]+2*epsillon[0,1]*epsillon[1,2]*epsillon[2,0]-(epsillon[0,0]*epsillon[1,2]**2+epsillon[1,1]*epsillon[2,0]**2+epsillon[2,2]*epsillon[0,1]**2)

## for epsillon_new
J11=epsillon_new[0,0]+epsillon_new[1,1]+epsillon_new[2,2]
J22=epsillon_new[0,0]*epsillon_new[1,1]+epsillon_new[1,1]*epsillon_new[2,2]+epsillon_new[2,2]*epsillon_new[0,0]-2*(epsillon_new[0,1]**2+epsillon_new[1,2]**2+epsillon_new[2,0]**2)
J33=epsillon_new[0,0]*epsillon_new[1,1]*epsillon_new[2,2]+2*epsillon_new[0,1]*epsillon_new[1,2]*epsillon_new[2,0]-(epsillon_new[0,0]*epsillon_new[1,2]**2+epsillon_new[1,1]*epsillon_new[2,0]**2+epsillon_new[2,2]*epsillon_new[0,1]**2)

## results
print('The new strain tensor is');
print(epsillon_new);
print'%s %.2f %s %.2e %s %.2e %s %.2f %s %.2e %s %.2e' %('The Strain invariants of old strain tensor are J1=',J1,' J2=',J2,' J3=',J3,' \n and that of the new stress tensor are J1=',J11,' J2=',J22,' J3=',J33)

print('\n Hence the same strain invariants')

print('because of rounding error ans is not matching')
The new strain tensor is
[[ 0.00866025 -0.005       0.        ]
 [ 0.01        0.01732051  0.02      ]
 [ 0.01        0.01732051  0.01      ]]
The Strain invariants of old strain tensor are J1= 0.04  J2= -3.00e-04  J3= -2.00e-06  
 and that of the new stress tensor are J1= 0.04  J2= -6.40e-04  J3= -5.95e-06

 Hence the same strain invariants
because of rounding error ans is not matching

Ex4-pg90

In [3]:
import math
import numpy
from numpy import linalg
#find all the componetns of epsillon and the invariants of epsillon new
## initialization of variables

epsillon=numpy.matrix([[0.01, -0.02, 0],
     [-0.02, 0.03, -0.01],
     [0, -0.01, 0]]) # dimensionless
a_xx=0.6     
theta=math.acos(a_xx) # radians
#calculations
theta1=theta*math.pi/180
a=numpy.matrix([[math.cos(theta1), 0 ,-math.sin(theta1)], [  0 ,      1,        0],[math.sin(theta1), 0 ,math.cos(theta1)]])
b=numpy.transpose(a)
epsillon1=numpy.dot(a,epsillon)
epsillon_new=numpy.dot(a,b)

# calculation of strain invariants
#for epsillon
J1=epsillon[0,0]+epsillon[1,1]+epsillon[2,2]
J2=epsillon[0,0]*epsillon[1,1]+epsillon[1,1]*epsillon[2,2]+epsillon[2,2]*epsillon[0,0]-2*(epsillon[0,1]**2+epsillon[1,2]**2+epsillon[2,0]**2)
J3=epsillon[0,0]*epsillon[1,1]*epsillon[2,2]+2*epsillon[0,1]*epsillon[1,2]*epsillon[2,0]-(epsillon[0,0]*epsillon[1,2]**2+epsillon[1,1]*epsillon[2,0]**2+epsillon[2,2]*epsillon[0,1]**2)

# for epsillon_new
J11=epsillon_new[0,0]+epsillon_new[1,1]+epsillon_new[2,2]
J22=epsillon_new[0,0]*epsillon_new[1,1]+epsillon_new[1,1]*epsillon_new[2,2]+epsillon_new[2,2]*epsillon_new[0,0]-2*(epsillon_new[0,1]**2+epsillon_new[1,2]**2+epsillon_new[2,0]**2)
J33=epsillon_new[0,0]*epsillon_new[1,1]*epsillon_new[2,2]+2*epsillon_new[0,1]*epsillon_new[1,2]*epsillon_new[2,0]-(epsillon_new[0,0]*epsillon_new[1,2]**2+epsillon_new[1,1]*epsillon_new[2,0]**2+epsillon_new[2,2]*epsillon_new[0,1]**2)
# Results
print('The new strain tensor is');
print(epsillon_new);
print'%s %.2e %s %.2e %s %.2e %s %.2e %s %.2e %s %.2e' %('The Strain invariants of old strain tensor are J1=',J1,' J2=',J2,' J3=',J3,' \n and that of the new stress tensor are J1=',J11,' J2=',J22,' J3=',J33)
print('because of rounding error ans is not matching')
print('\n Hence the same strain invariants')
print("in book calculations are done wrong")
The new strain tensor is
[[ 1.  0.  0.]
 [ 0.  1.  0.]
 [ 0.  0.  1.]]
The Strain invariants of old strain tensor are J1= 4.00e-02  J2= -7.00e-04  J3= -1.00e-06  
 and that of the new stress tensor are J1= 3.00e+00  J2= 3.00e+00  J3= 1.00e+00
because of rounding error ans is not matching

 Hence the same strain invariants
in book calculations are done wrong

Ex5-pg93

In [28]:
import math
##initialization of variables
#find the principal strains by using transformation equations
epsillon_A= 700.*10**-6 
epsillon_B= 300.*10**-6 
epsillon_C= 300.*10**-6 
theta=45. ## degrees
theta=theta*math.pi/180 ## radians
## calculations
epsillon_x=epsillon_A
epsillon_y=epsillon_C
gamma_xy=(epsillon_B-(epsillon_x*math.cos(theta)**2+epsillon_y*math.sin(theta)**2))/(math.sin(theta)*math.cos(theta))
epsillon_1=1/2.*(epsillon_x+epsillon_y)+(1/2.)*math.sqrt((epsillon_x-epsillon_y)**2+gamma_xy**2)
epsillon_2=1/2.*(epsillon_x+epsillon_y)-(1/2.)*math.sqrt((epsillon_x-epsillon_y)**2+gamma_xy**2)
phi=0.5*math.atan(gamma_xy/(epsillon_x-epsillon_y))
phi=phi*180./math.pi
##results
print'%s %.2e %s %.2e %s'%('The principal strains are  ',epsillon_1,''and '',epsillon_2,'')
print'%s %.2f %s'%('\n phi =  ',phi,'degrees')
The principal strains are   7.83e-04  2.17e-04 

 phi =   -22.50 degrees

Ex6-pg96

In [4]:
import math
import numpy
from numpy import linalg
#find the principal strains

## initialization of variables
epsillon_A= 1000*10**-6 
epsillon_B= 720*10**-6 
epsillon_C= 600*10**-6 
th_B=120 # degrees
th_C=240 # degrees
##calculations
th_B=th_B*math.pi/180.
th_C=th_C*math.pi/180.
## we need to solve for epsillon_y and gamma_xy
# Ax=B
ep_x=epsillon_A
A=numpy.matrix([[math.sin(th_B)**2, math.sin(th_B)*math.cos(th_B)],
  [ math.sin(th_C)**2, math.sin(th_C)*math.cos(th_C)]])
C=numpy.matrix([[epsillon_B-ep_x*math.cos(th_B)**2], [epsillon_C-ep_x*math.cos(th_C)**2]])  

x=numpy.dot(numpy.linalg.inv(A),C)

ep_y=x[0,0]
gam_xy=x[1,0]
epsillon_x=ep_x
epsillon_y=ep_y
gamma_xy=gam_xy
epsillon_1=1/2.*(epsillon_x+epsillon_y)+(1./2.)*math.sqrt((epsillon_x-epsillon_y)**2+gamma_xy**2)
epsillon_2=1/2.*(epsillon_x+epsillon_y)-(1./2.)*math.sqrt((epsillon_x-epsillon_y)**2+gamma_xy**2)
## Results
print'%s %.3e %s %.3e %s '%('The principal strains are ',epsillon_1,''and '',epsillon_2,'')
The principal strains are  1.010e-03  5.363e-04