{ "metadata": { "name": "", "signature": "sha256:06d678b0a78daa39d2ccf83b1f54b7f750b3218b6d64413136cd6df094ffadaf" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter3-Analysis of Strain" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex1-pg82" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#given matrix \n", "import math\n", "#find all the strains\n", "#by strain components\n", "Ex=0.06\n", "Ey=0.01\n", "Ez=0.01\n", "Exy=0.05\n", "Eyx=0.03\n", "Eyz=0\n", "Ezy=0\n", "Exz=0.02\n", "Ezx=0.01\n", "gammaxy=Exy-Eyx\n", "gammayz=Eyz-Ezy\n", "gammazx=Exz+Ezx\n", "print'%s %.2f %s'%('gammaxy',gammaxy,'')\n", "print'%s %.2f %s'%('gammayz',gammayz,'')\n", "print'%s %.2f %s'%('gammazx',gammazx,'')" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "gammaxy 0.02 \n", "gammayz 0.00 \n", "gammazx 0.03 \n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex3-pg88" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#show that they equal\n", "import math\n", "import numpy\n", "from numpy import linalg\n", "## initialization of variables\n", "\n", "epsillon=numpy.matrix([[0.01, 0, 0],[0, 0.02, 0.02],[0, 0.02, 0.01]]) ## dimensionless\n", "theta=30. ## degrees\n", "##calculations\n", "theta=theta*math.pi/180.\n", "a=numpy.matrix([[math.cos(theta), math.sin(theta), 0],\n", " [-math.sin(theta), math.cos(theta), 0],\n", " [0, 0, 1]])\n", "\n", "b=numpy.transpose(a)\n", "epsillon_new=numpy.dot(epsillon,b)\n", "epsillon1=numpy.dot(a,epsillon)\n", "## calculation of strain invariants\n", "## for epsillon\n", "J1=epsillon[0,0]+epsillon[1,1]+epsillon[2,2]\n", "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)\n", "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)\n", "\n", "## for epsillon_new\n", "J11=epsillon_new[0,0]+epsillon_new[1,1]+epsillon_new[2,2]\n", "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)\n", "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)\n", "\n", "## results\n", "print('The new strain tensor is');\n", "print(epsillon_new);\n", "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)\n", "\n", "print('\\n Hence the same strain invariants')\n", "\n", "print('because of rounding error ans is not matching')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The new strain tensor is\n", "[[ 0.00866025 -0.005 0. ]\n", " [ 0.01 0.01732051 0.02 ]\n", " [ 0.01 0.01732051 0.01 ]]\n", "The Strain invariants of old strain tensor are J1= 0.04 J2= -3.00e-04 J3= -2.00e-06 \n", " and that of the new stress tensor are J1= 0.04 J2= -6.40e-04 J3= -5.95e-06\n", "\n", " Hence the same strain invariants\n", "because of rounding error ans is not matching\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex4-pg90" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "import numpy\n", "from numpy import linalg\n", "#find all the componetns of epsillon and the invariants of epsillon new\n", "## initialization of variables\n", "\n", "epsillon=numpy.matrix([[0.01, -0.02, 0],\n", " [-0.02, 0.03, -0.01],\n", " [0, -0.01, 0]]) # dimensionless\n", "a_xx=0.6 \n", "theta=math.acos(a_xx) # radians\n", "#calculations\n", "theta1=theta*math.pi/180\n", "a=numpy.matrix([[math.cos(theta1), 0 ,-math.sin(theta1)], [ 0 , 1, 0],[math.sin(theta1), 0 ,math.cos(theta1)]])\n", "b=numpy.transpose(a)\n", "epsillon1=numpy.dot(a,epsillon)\n", "epsillon_new=numpy.dot(a,b)\n", "\n", "# calculation of strain invariants\n", "#for epsillon\n", "J1=epsillon[0,0]+epsillon[1,1]+epsillon[2,2]\n", "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)\n", "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)\n", "\n", "# for epsillon_new\n", "J11=epsillon_new[0,0]+epsillon_new[1,1]+epsillon_new[2,2]\n", "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)\n", "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)\n", "# Results\n", "print('The new strain tensor is');\n", "print(epsillon_new);\n", "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)\n", "print('because of rounding error ans is not matching')\n", "print('\\n Hence the same strain invariants')\n", "print(\"in book calculations are done wrong\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The new strain tensor is\n", "[[ 1. 0. 0.]\n", " [ 0. 1. 0.]\n", " [ 0. 0. 1.]]\n", "The Strain invariants of old strain tensor are J1= 4.00e-02 J2= -7.00e-04 J3= -1.00e-06 \n", " and that of the new stress tensor are J1= 3.00e+00 J2= 3.00e+00 J3= 1.00e+00\n", "because of rounding error ans is not matching\n", "\n", " Hence the same strain invariants\n", "in book calculations are done wrong\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex5-pg93" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "##initialization of variables\n", "#find the principal strains by using transformation equations\n", "epsillon_A= 700.*10**-6 \n", "epsillon_B= 300.*10**-6 \n", "epsillon_C= 300.*10**-6 \n", "theta=45. ## degrees\n", "theta=theta*math.pi/180 ## radians\n", "## calculations\n", "epsillon_x=epsillon_A\n", "epsillon_y=epsillon_C\n", "gamma_xy=(epsillon_B-(epsillon_x*math.cos(theta)**2+epsillon_y*math.sin(theta)**2))/(math.sin(theta)*math.cos(theta))\n", "epsillon_1=1/2.*(epsillon_x+epsillon_y)+(1/2.)*math.sqrt((epsillon_x-epsillon_y)**2+gamma_xy**2)\n", "epsillon_2=1/2.*(epsillon_x+epsillon_y)-(1/2.)*math.sqrt((epsillon_x-epsillon_y)**2+gamma_xy**2)\n", "phi=0.5*math.atan(gamma_xy/(epsillon_x-epsillon_y))\n", "phi=phi*180./math.pi\n", "##results\n", "print'%s %.2e %s %.2e %s'%('The principal strains are ',epsillon_1,''and '',epsillon_2,'')\n", "print'%s %.2f %s'%('\\n phi = ',phi,'degrees')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The principal strains are 7.83e-04 2.17e-04 \n", "\n", " phi = -22.50 degrees\n" ] } ], "prompt_number": 28 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Ex6-pg96" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "import numpy\n", "from numpy import linalg\n", "#find the principal strains\n", "\n", "## initialization of variables\n", "epsillon_A= 1000*10**-6 \n", "epsillon_B= 720*10**-6 \n", "epsillon_C= 600*10**-6 \n", "th_B=120 # degrees\n", "th_C=240 # degrees\n", "##calculations\n", "th_B=th_B*math.pi/180.\n", "th_C=th_C*math.pi/180.\n", "## we need to solve for epsillon_y and gamma_xy\n", "# Ax=B\n", "ep_x=epsillon_A\n", "A=numpy.matrix([[math.sin(th_B)**2, math.sin(th_B)*math.cos(th_B)],\n", " [ math.sin(th_C)**2, math.sin(th_C)*math.cos(th_C)]])\n", "C=numpy.matrix([[epsillon_B-ep_x*math.cos(th_B)**2], [epsillon_C-ep_x*math.cos(th_C)**2]]) \n", "\n", "x=numpy.dot(numpy.linalg.inv(A),C)\n", "\n", "ep_y=x[0,0]\n", "gam_xy=x[1,0]\n", "epsillon_x=ep_x\n", "epsillon_y=ep_y\n", "gamma_xy=gam_xy\n", "epsillon_1=1/2.*(epsillon_x+epsillon_y)+(1./2.)*math.sqrt((epsillon_x-epsillon_y)**2+gamma_xy**2)\n", "epsillon_2=1/2.*(epsillon_x+epsillon_y)-(1./2.)*math.sqrt((epsillon_x-epsillon_y)**2+gamma_xy**2)\n", "## Results\n", "print'%s %.3e %s %.3e %s '%('The principal strains are ',epsillon_1,''and '',epsillon_2,'')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The principal strains are 1.010e-03 5.363e-04 \n" ] } ], "prompt_number": 4 } ], "metadata": {} } ] }