summaryrefslogtreecommitdiff
path: root/Mechanical_Metallurgy/Chapter_2.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Mechanical_Metallurgy/Chapter_2.ipynb')
-rwxr-xr-xMechanical_Metallurgy/Chapter_2.ipynb251
1 files changed, 251 insertions, 0 deletions
diff --git a/Mechanical_Metallurgy/Chapter_2.ipynb b/Mechanical_Metallurgy/Chapter_2.ipynb
new file mode 100755
index 00000000..535881a6
--- /dev/null
+++ b/Mechanical_Metallurgy/Chapter_2.ipynb
@@ -0,0 +1,251 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 2: Stress and Strain Relationships for Elastic Behavior"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "collapsed": true
+ },
+ "source": [
+ "### Example 2.1, State of Stress in two dimensions, Page No. 25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "sigma_x= -12.5 MPa\n",
+ "sigma_y= -2.5 MPa\n",
+ "T_xy= 57.5 MPa\n",
+ "sigma_y`= -65 MPa\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "from math import sin\n",
+ "from math import cos\n",
+ "from math import radians\n",
+ "from numpy.linalg import inv\n",
+ "import numpy as np\n",
+ "\n",
+ "#variable declaration\n",
+ "sigma_x=25;\n",
+ "sigma_y=5;\n",
+ "theta=45;\n",
+ "sigma_x_=50;\n",
+ "T_x_y_=5;\n",
+ "\n",
+ "#calculation\n",
+ "theta=radians(theta);\n",
+ "A=[[(sigma_x+sigma_y)/2+(sigma_x-sigma_y)/2*cos(2*theta),sin(2*theta)],[(sigma_y-sigma_x)/2*sin(2*theta),cos(2*theta)]];\n",
+ "B=[[sigma_x_],[T_x_y_]];\n",
+ "X=np.dot(inv(A),B);\n",
+ "p=X[0];\n",
+ "T_xy=X[1];\n",
+ "sigma_x1=sigma_x*p;\n",
+ "sigma_y1=sigma_y*p;\n",
+ "sigma_y_=sigma_x1+sigma_y1-sigma_x_;\n",
+ "\n",
+ "#result\n",
+ "print ('\\nsigma_x= %g MPa\\nsigma_y= %g MPa\\nT_xy= %g MPa\\nsigma_y`= %g MPa') %(sigma_x1,sigma_y1,T_xy,sigma_y_);\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 2.2, State of Stress in three dimensions, Page No. 29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "sigma0 = 360 MPa\n",
+ "\n",
+ "sigma1 = -280 MPa\n",
+ "\n",
+ "sigma2 = -160 MPa\n"
+ ]
+ }
+ ],
+ "source": [
+ "import numpy as np\n",
+ "\n",
+ "#variable declaration\n",
+ "A=[[0,-240,0],[-240,200,0],[0,0,-280]];\n",
+ "\n",
+ "#calcualtion\n",
+ "p=[1, -(A[0][0]+A[1][1]+A[2][2]), (A[0][0]*A[1][1]+A[1][1]*A[2][2]+A[0][0]*A[2][2]-A[1][0]**2-A[2][1]**2-A[2][0]**2), -(A[0][0]*A[1][1]*A[2][2]+2*A[1][0]*A[2][1]*A[2][0]-A[0][0]*A[2][1]**2-A[1][1]*A[2][0]**2-A[2][2]*A[1][0]**2)];\n",
+ "X=np.roots(p);\n",
+ "\n",
+ "#result\n",
+ "for i in range (0,3):\n",
+ " print('\\nsigma%i = %g MPa')%(i,X[i]);\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 2.3, Calculation of Stresses from elastic strains, Page No. 52"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "sigma1 = 971.833 MPa\n",
+ "sigma2 = 520.705 MPa\n",
+ "\n",
+ "\n",
+ "Note: Slight calculation errors in Book\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "E=200;\n",
+ "nu=0.33;\n",
+ "e1=0.004;\n",
+ "e2=0.001;\n",
+ "\n",
+ "#calculation\n",
+ "sigma1=E*(e1+nu*e2)/(1-nu**2);\n",
+ "sigma2=E*(e2+nu*e1)/(1-nu**2);\n",
+ "sigma1=sigma1*1000; #conversion to MPa\n",
+ "sigma2=sigma2*1000; #conversion to MPa\n",
+ "\n",
+ "#result\n",
+ "print('\\nsigma1 = %g MPa\\nsigma2 = %g MPa\\n')%(sigma1,sigma2);\n",
+ "print('\\nNote: Slight calculation errors in Book')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Example 2.4, Elastic Anisotropy, Page No. 60"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "For Iron:\n",
+ "\n",
+ "\n",
+ "E_111 = 2.72727 x 10^11 Pa\n",
+ "E_100 = 1.25 x 10^11 Pa\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "For Tungten:\n",
+ "\n",
+ "\n",
+ "E_111 = 3.84615 x 10^11 Pa\n",
+ "E_100 = 3.84615 x 10^11 Pa\n",
+ "\n",
+ "Therefore tungsten is elastically isotropic while iron is elasitcally anisotropic\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "\n",
+ "#variable declaration\n",
+ "from math import sqrt\n",
+ "S11_Fe=0.8;\n",
+ "S12_Fe=-0.28;\n",
+ "S44_Fe=0.86;\n",
+ "S11_W=0.26;\n",
+ "S12_W=-0.07;\n",
+ "S44_W=0.66;\n",
+ "D_100_l=1;\n",
+ "D_100_m=0;\n",
+ "D_100_n=0;\n",
+ "D_110_l=1/sqrt(2);\n",
+ "D_110_m=1/sqrt(2);\n",
+ "D_110_n=0;\n",
+ "D_111_l=1/sqrt(3);\n",
+ "D_111_m=1/sqrt(3);\n",
+ "D_111_n=1/sqrt(3);\n",
+ "\n",
+ "#calculation\n",
+ "Fe_E_111=1/(S11_Fe-2*((S11_Fe-S12_Fe)-S44_Fe/2)*(D_111_l**2*D_111_m**2+D_111_n**2*D_111_m**2+D_111_l**2*D_111_n**2));\n",
+ "Fe_E_100=1/(S11_Fe-2*((S11_Fe-S12_Fe)-S44_Fe/2)*(D_100_l**2*D_100_m**2+D_100_n**2*D_100_m**2+D_100_l**2*D_100_n**2));\n",
+ "W_E_111=1/(S11_W-2*((S11_W-S12_W)-S44_W/2)*(D_111_l**2*D_111_m**2+D_111_n**2*D_111_m**2+D_111_l**2*D_111_n**2));\n",
+ "W_E_100=1/(S11_W-2*((S11_W-S12_W)-S44_W/2)*(D_100_l**2*D_100_m**2+D_100_n**2*D_100_m**2+D_100_l**2*D_100_n**2));\n",
+ "\n",
+ "#result\n",
+ "print '\\nFor Iron:\\n\\n'\n",
+ "print 'E_111 = %g x 10^11 Pa\\nE_100 = %g x 10^11 Pa\\n' %(Fe_E_111,Fe_E_100)\n",
+ "print '\\n\\n\\nFor Tungten:\\n\\n'\n",
+ "print 'E_111 = %g x 10^11 Pa\\nE_100 = %g x 10^11 Pa\\n\\nTherefore tungsten is elastically isotropic while iron is elasitcally anisotropic' %(W_E_111,W_E_100)\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}