{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9:Stress Transformation"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.1 Page no 440"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "import math\n",
      "tou = 25\t\t #MPa, shear stress\n",
      "sigma1 = 50 \t\t#MPa, stress\n",
      "sigma2 = 80 \t\t#MPa\n",
      "phi = 30*(math.pi/180.0)\n",
      "\n",
      "# Calculations\n",
      "sigma_x1 = (sigma1*math.cos(phi)*math.cos(phi))- (tou*math.cos(phi)*math.sin(phi)) - (sigma2*math.sin(phi)*math.sin(phi))- (tou*math.sin(phi)*math.cos(phi))\n",
      "tou1 = (sigma1*math.cos(phi)*math.sin(phi))+ (tou*math.cos(phi)*math.cos(phi)) + (sigma2*math.sin(phi)*math.cos(phi))- (tou*math.sin(phi)*math.sin(phi))\n",
      "sigma_x2 = (tou*math.cos(phi)*math.sin(phi))- (sigma2*math.cos(phi)*math.cos(phi)) + (tou*math.sin(phi)*math.cos(phi))+ (sigma1*math.sin(phi)*math.sin(phi))\n",
      "tou2 = (tou*math.cos(phi)*math.cos(phi))+ (sigma2*math.cos(phi)*math.sin(phi)) - (tou*math.sin(phi)*math.sin(phi))+ (sigma1*math.sin(phi)*math.cos(phi))\n",
      "\n",
      "#Display\n",
      "print\"The normal stress component in the x diection is     = \",round(sigma_x1,1),\"MPa\"\n",
      "print\"  The shear stress component in the x diection is    = \",round(tou1,1),\"MPa\"\n",
      "print\"  The normal stress component in the y diection is   = \",round(sigma_x2,1),\"MPa\"\n",
      "print\"  The shear stress component in the y diection is    = \",round(tou2,1),\"MPa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The normal stress component in the x diection is     =  -4.2 MPa\n",
        "  The shear stress component in the x diection is    =  68.8 MPa\n",
        "  The normal stress component in the y diection is   =  -25.8 MPa\n",
        "  The shear stress component in the y diection is    =  68.8 MPa\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.2 Page no 444"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "import math\n",
      "phi = -30*(math.pi/180)    #angle\n",
      "theta = 60*(math.pi/180)   \n",
      "sigma_x = -80              #MPa\n",
      "sigma_y = 50               #MPa\n",
      "tou_xy = -25               #MPa\n",
      "\n",
      "#Plane CD\n",
      "sigma_x1 = (sigma_x+sigma_y)/2 + ((sigma_x-sigma_y)*math.cos(2*phi))/2 + (tou_xy*math.sin(2*phi)) #Eqn 9.1\n",
      "tou_xy1 = ((-(sigma_x - sigma_y)*math.sin(2*phi))/2) + (tou_xy*math.cos(2*phi)) #Eqn 9.2\n",
      "\n",
      "#Plane BC\n",
      "sigma_x2 = (sigma_x+sigma_y)/2 + ((sigma_x-sigma_y)*math.cos(2*theta))/2 + (tou_xy*math.sin(2*theta)) #Eqn 9.1\n",
      "tou_xy2 = (-(sigma_x - sigma_y)*math.sin(2*theta))/2 + tou_xy*math.cos(2*theta) #Eqn 9.2\n",
      "\n",
      "#Display\n",
      "print'The normal stress of plane CD inclined at 30 degrees    = ',round(sigma_x1,1),\"MPa\"\n",
      "print'The shear stress of plane CD inclined at 30 degrees     = ',round(tou_xy1,1),\"MPa\"\n",
      "print'The normal stress of plane BC inclined at 60 degrees    = ',round(sigma_x2,1),\"MPa\"\n",
      "print'The shear stress of plane BC inclined at 60 degrees     = ',round(tou_xy2,1),\"MPa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The normal stress of plane CD inclined at 30 degrees    =  -25.8 MPa\n",
        "The shear stress of plane CD inclined at 30 degrees     =  -68.8 MPa\n",
        "The normal stress of plane BC inclined at 60 degrees    =  -4.2 MPa\n",
        "The shear stress of plane BC inclined at 60 degrees     =  68.8 MPa\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3 Page no 448"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "sigma_x = -20   #MPa, stress\n",
      "sigma_y = 90    #MPa\n",
      "tou_xy = 60     #MPa\n",
      "\n",
      "#Orientation of Element\n",
      "import math\n",
      "theta_p2 = math.atan((2*tou_xy)/(sigma_x - sigma_y))\n",
      "theta_p2 = theta_p2/2.0\n",
      "theta_p1 = (180+2*theta_p2)/2.0\n",
      "\n",
      "#Principal Stresses\n",
      "\n",
      "sigma1 = ((sigma_x+sigma_y)/2.0)+(math.sqrt(((sigma_x - sigma_y)/2.0)**2 + tou_xy**2))\n",
      "sigma2 = ((sigma_x+sigma_y)/2.0)- math.sqrt(((sigma_x-sigma_y)/2.0)**2 + tou_xy**2)\n",
      "sigma_x2 = ((sigma_x+sigma_y)/2.0)+ (((sigma_x-sigma_y)/2.0)*math.cos(2*theta_p2)) + (tou_xy*math.sin(2*theta_p2))\n",
      "\n",
      "#Display\n",
      "print\"The first principal stress is                       = \",round(sigma1,1),\"MPa\"\n",
      "print\"The second principal stress is                      = \",round(sigma2,1),\"MPa\"\n",
      "print'The normal stress acting on the 23.7 degrees plane  = ',round(sigma_x2,1),\"MPa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The first principal stress is                       =  116.4 MPa\n",
        "The second principal stress is                      =  -46.4 MPa\n",
        "The normal stress acting on the 23.7 degrees plane  =  -43.3 MPa\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4 Page no 449"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "sigma_x = -20.0 #MPa, stress along x\n",
      "sigma_y  = 90.0 #MPa  stress along y\n",
      "tou_xy =60.0    #Mpa, shear stress\n",
      "\n",
      "#Calculation\n",
      "#Orientation of Element\n",
      "import math\n",
      "theta_s2 = math.atan(-(sigma_x - sigma_y)/(2*tou_xy))\n",
      "theta_s2 = theta_s2/2.0\n",
      "theta_s1 = math.pi + 2*theta_s2\n",
      "theta_s1 = theta_s1/2.0\n",
      "\n",
      "#Maximum in plane Shear Stress\n",
      "tou_max = (math.sqrt(((sigma_x - sigma_y)/2.0)**2 + tou_xy**2))\n",
      "tou_xy1 = -(sigma_x - sigma_y)*(math.sin(2*theta_s2))/2.0 + (tou_xy*math.cos(2*theta_s2))\n",
      "#Average Normal Stress\n",
      "sigma_avg = (sigma_x+sigma_y)/2\n",
      "\n",
      "#Display\n",
      "print\"The maximum in-plane shear stress is   = \",round(tou_xy1,1),\"MPa\"\n",
      "print\"The average normal stress is        = \",round(sigma_avg,0),\"MPa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum in-plane shear stress is   =  81.4 MPa\n",
        "The average normal stress is        =  35.0 MPa\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.7 Page no 465"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "sigma_x = -12  #ksi, stress along x\n",
      "sigma_y = 0\n",
      "tou_xy = -6    #ksi, stress along xy\n",
      "\n",
      "#Calculation\n",
      "#Construction of the circle\n",
      "import math\n",
      "sigma_avg = (sigma_x+sigma_y)/2.0\n",
      "R = sqrt((-sigma_x+sigma_avg)**2 + (tou_xy)**2)\n",
      "#Principal Stresses\n",
      "sigma2 = -R+sigma_avg\n",
      "sigma1 = R+sigma_avg\n",
      "theta_p2 = math.atan((-tou_xy)/(-sigma_x+sigma_avg))\n",
      "theta_p2 = theta_p2/2*(180/math.pi)\n",
      "\n",
      "#Display\n",
      "print'The first principal stress is            = ',round(sigma1,2),\"ksi\"\n",
      "print'The second principal stress is           = ',round(sigma2,2),\"ksi\"\n",
      "print'The direction of the principal plane is  = ',theta_p2,\"degree\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The first principal stress is            =  2.49 ksi\n",
        "The second principal stress is           =  -14.49 ksi\n",
        "The direction of the principal plane is  =  22.5 degree\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.8 Page no 466"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "sigma_x = -20.0 #MPa\n",
      "sigma_y = 90.0 #MPa\n",
      "tou_xy = 60.0  #MPa\n",
      "\n",
      "#Construction of the circle\n",
      "import math\n",
      "sigma_avg = (sigma_x+sigma_y)/2\n",
      "R = math.sqrt(((sigma_x-sigma_avg))**2 + (tou_xy)**2)\n",
      "#Maximum In plane Shear Stress\n",
      "tou_max = R\n",
      "theta_s1 = math.atan(-(sigma_x - sigma_avg)/(tou_xy))\n",
      "theta_s1 = theta_s1/2.0*(180/math.pi)\n",
      "\n",
      "#Display\n",
      "print'The maximum in-plane shear stresses are   = ',round(tou_max,1),\"MPa\"\n",
      "print'The second principal stress  = ',sigma_avg,\"MPa\"\n",
      "print'The orientation of the element is         = ',round(theta_s1,1),\"degree\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum in-plane shear stresses are   =  81.4 MPa\n",
        "The second principal stress  =  35.0 MPa\n",
        "The orientation of the element is         =  21.3 degree\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.9 Page no 467"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate normal stress and shear stress \n",
      "\n",
      "#Given\n",
      "sigma_x  = -8.0    #MPa\n",
      "sigma_y = 12.0    #MPa\n",
      "tou_xy = -6.0     #Mpa\n",
      "\n",
      "#Construction of the circle\n",
      "import math\n",
      "sigma_avg = (sigma_x+sigma_y)/2.0\n",
      "R = math.sqrt( 10**2 + tou_xy**2)\n",
      "#Stresses on 30 degree element\n",
      "phi = math.atan(6/10.0)\n",
      "psi = (math.pi/3.0) - phi\n",
      "#On face BD\n",
      "sigma_x1 = 2 - (R*math.cos(psi))\n",
      "tou_xy1 = (R*math.sin(psi))\n",
      "#On face DE\n",
      "sigma_x2 = 2 + (R*math.cos(psi))\n",
      "tou_xy2 = -(R*math.sin(psi))\n",
      "\n",
      "#Display\n",
      "print'The normal stress on plane BD inclined at 30 degrees is   = ',round(sigma_x1,1),\"ksi\"\n",
      "print'The normal stress on plane DE inclined at 60 degrees is   = ',round(sigma_x2,1),\"ksi\"\n",
      "print'The shear stress is     = ',round(tou_xy1,1),\"ksi\"\n",
      "print'The shear stress is     = ',round(tou_xy2,1),\"ksi\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The normal stress on plane BD inclined at 30 degrees is   =  -8.2 ksi\n",
        "The normal stress on plane DE inclined at 60 degrees is   =  12.2 ksi\n",
        "The shear stress is     =  5.7 ksi\n",
        "The shear stress is     =  -5.7 ksi\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.10 Page no 476"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "sigma_max = 32 #MPa\n",
      "sigma_min = 0 #MPa\n",
      "sigma_int = 16 #MPa\n",
      "\n",
      "#Calculation\n",
      "tou_max = (sigma_max - sigma_min)/2  \n",
      "sigma_avg = (sigma_max + sigma_min)/2 \n",
      "tou_in_plane = (sigma_max - sigma_int)/2\n",
      "sigma_avg2 = sigma_avg + (tou_in_plane)\n",
      "\n",
      "#Display\n",
      "print 'The normal shears tress is', sigma_avg,\"MPa\"\n",
      "print'The maximum absolute shear stress   = ',tou_max,\"MPa\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The normal shears tress is 16 MPa\n",
        "The maximum absolute shear stress   =  16 MPa\n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.11 Page no 477"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "tou = 40       #psi\n",
      "sigma = -20     #psi\n",
      "\n",
      "#Calculation\n",
      "#Principal Stresses\n",
      "import math\n",
      "sigma_avg = sigma/2\n",
      "R = sqrt( (-sigma + sigma_avg)**2 + tou**2)\n",
      "sigma_max = sigma_avg + R  \n",
      "sigma_min = sigma_avg - R  \n",
      "theta = math.atan(tou/(-sigma+sigma_avg))\n",
      "theta = theta/2\n",
      "#Absolute Maximum Shear Stress\n",
      "tou_max = (sigma_max - sigma_min)/2\n",
      "sigma_avg = (sigma_max + sigma_min)/2\n",
      "\n",
      "#Display\n",
      "print'The prinicpal stresses at the point are ',round(sigma_max,2),\"psi   and\",round(sigma_min,1),\"psi\"\n",
      "print'The absolute maximum shear stress at the point  ',round(tou_max,1),\"psi\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The prinicpal stresses at the point are  31.23 psi   and -51.2 psi\n",
        "The absolute maximum shear stress at the point   41.2 psi\n"
       ]
      }
     ],
     "prompt_number": 56
    }
   ],
   "metadata": {}
  }
 ]
}