{
 "metadata": {
  "name": "",
  "signature": "sha256:09673653cb16b83119bc0c347f996805dac297e3d0e1db4167910bd881eb2ed7"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13: Inelastic Action"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.13.1, Page No:461"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "d=150 #Depth of the web in mm\n",
      "wf=100 #Width of the flange in mm\n",
      "df=20 #Depth of the flange in mm\n",
      "t=20 #Thickness of the web in mm\n",
      "\n",
      "#Calculations\n",
      "y_bar=10**-3*(((wf*df*(d+df*0.5))+(d*t*d*0.5))/(wf*df+d*t)) #Distance of Neutral Axis in m\n",
      "#Simplfying the computation\n",
      "a=wf*df**3*12**-1\n",
      "b=wf*df*((d+df*0.5)-y_bar*10**3)**2\n",
      "c=t*d**3*12**-1\n",
      "f=t*d*((d*0.5)-y_bar*10**3)**2\n",
      "I=(a+b+c+f)*10**-12 #Moment of inertia in mm^3\n",
      "\n",
      "#Limit Moment\n",
      "yp=(wf*df+d*t)/(2*t) #Plastic Neutral Axis in mm\n",
      "Myp=I/y_bar #Yielding will start at moment without the stress term to ease computation\n",
      "mom=10**-9*((t*yp**2*0.5)+(wf*df*(d-yp+10))+(t*25**2*0.5)) #Sum of 1st moments\n",
      "Ml_Myp=mom*Myp**-1 #Ratio\n",
      "\n",
      "#Result\n",
      "print \"The ratio ML/Myp=\",round(Ml_Myp,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The ratio ML/Myp= 1.765\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.13.2, Page No:467"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#Variable Decleration\n",
      "E_st=200 #Youngs Modulus of Steel in GPa\n",
      "sigma_st_yp=290 #Yielding Stress in MPa\n",
      "E_al=70 #Youngs Modulus of Aluminium in GPa\n",
      "sigma_al_yp=330 #Yielding Stresss of Aluminium in MPa\n",
      "A_st=900 #Area of steel rod in mm^2\n",
      "A_al=600 #Area of Aluminium rod in mm^2\n",
      "L_st=350 #Length of the steel rod in mm\n",
      "L_al=250 #Length of the aluminium rod in mm\n",
      "\n",
      "#Calculations\n",
      "#Limit Load\n",
      "P_st=sigma_st_yp*A_st*10**-3 #Load in limiting condition in kN\n",
      "P_al=sigma_al_yp*A_al*10**-3 #Load in limiting condition in kN\n",
      "P_L=P_st+2*P_al #Total Loading in kN\n",
      "\n",
      "#Elastic Unloading\n",
      "#Solving for Pst and Pal using matri approach\n",
      "A=np.array([[1,2],[L_st*(E_st*A_st)**-1,-L_al*(E_al*A_al)**-1]])\n",
      "B=np.array([P_L,0])\n",
      "C=np.linalg.solve(A,B) #Loading in kN\n",
      "\n",
      "#Residual Stresses\n",
      "P_res_st=C[0]-P_st #Residual Load in kN\n",
      "P_res_al=C[1]-P_al #Residual Load in kN\n",
      "sigma_st=P_res_st/A_st #residual Stress in Steel in MPa\n",
      "sigma_al=P_res_al/A_al #residual Stress in Aluminium in MPa\n",
      "\n",
      "\n",
      "#Result\n",
      "print \"The Residual stresses are as follows\"\n",
      "print \"Sigma_st=\",round(sigma_st*10**3,1),\"MPa and sigma_al=\",round(sigma_al*10**3,1),\"MPa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Residual stresses are as follows\n",
        "Sigma_st= 151.5 MPa and sigma_al= -113.6 MPa\n"
       ]
      }
     ],
     "prompt_number": 22
    }
   ],
   "metadata": {}
  }
 ]
}