summaryrefslogtreecommitdiff
path: root/Solid_Mechanics/Chapter4.ipynb
blob: 27418162f12b38dc966674e6373bbdb9869bb894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
{
 "metadata": {
  "name": "",
  "signature": "sha256:8153891fd31915fc027b9835e482fe359e89a7a1a683b21a2334c8771f72e58d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter4-Stress-Strain Relations"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "## initialization of variables\n",
      "import numpy\n",
      "E=2.*10**6. ## kg/cm^2\n",
      "G=8.*10**5. ## kg/cm^2\n",
      "ep=numpy.matrix([[0.001, 0, -0.002],\n",
      "    [0 ,-0.003, 0.0005],\n",
      "    [-0.002, 0.0005, 0]])\n",
      "## calculations\n",
      "nu=E/(2.*G)-1.\n",
      "D=E*nu/((1.+nu)*(1.-2.*nu))\n",
      "mu=G\n",
      "sigma=2.*mu*ep[0,0]+D*(ep[0,0]+ep[1,1]+ep[2,2])\n",
      "sigma=2.*mu*ep[1,1]+D*(ep[0,0]+ep[1,1]+ep[2,2])\n",
      "sigma=2.*mu*ep[2,2]+D*(ep[0,0]+ep[1,1]+ep[2,2])\n",
      "tau=2.*mu*ep[0,1]\n",
      "tau=2.*mu*ep[0,2]\n",
      "tau=2.*mu*ep[1,2]\n",
      "tau=numpy.matrix([[sigma, tau, tau],\n",
      "     [tau, sigma, tau],\n",
      "     [tau, tau, sigma]])\n",
      "## results\n",
      "print'%s %.2f %s  %.2f %s'%('The lames constants are ',D,' and ',mu,'kg/cm^2')\n",
      "print('\\n The stres tensor is')\n",
      "print(tau)\n",
      "print('in text book calculations are done wrong')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The lames constants are  800000.00  and   800000.00 kg/cm^2\n",
        "\n",
        " The stres tensor is\n",
        "[[-1600.   800.   800.]\n",
        " [  800. -1600.   800.]\n",
        " [  800.   800. -1600.]]\n",
        "in text book calculations are donw wrong\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg114"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "## initialization of variables\n",
      "#find the magnitude and direction of all the principal strains\n",
      "sigma_x=1000. ##kg/cm^2\n",
      "sigma_y=-500. ##kg/cm^2\n",
      "sigma_z=0.  ##kg/cm^2\n",
      "tau_xy=500. ##kg/cm^2\n",
      "E=2.*10**6 ## kg/cm^2\n",
      "nu=0.25\n",
      "##calculations\n",
      "ep_x=1./E*(sigma_x-nu*(sigma_y+sigma_z))\n",
      "ep_y=1./E*(sigma_y-nu*(sigma_x+sigma_z))\n",
      "ep_z=1./E*(sigma_z-nu*(sigma_y+sigma_x))\n",
      "J1=ep_x+ep_y+ep_z\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1/2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2.-math.sqrt((1/2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "th=1/2.*math.atan(2.*tau_xy/(sigma_x-sigma_y))\n",
      "th=th*180/math.pi\n",
      "ep_1=1./E*(sigma_1-nu*sigma_2)\n",
      "ep_2=1./E*(sigma_2-nu*sigma_1)\n",
      "ep_3=-1./E*nu*(sigma_1+sigma_2)\n",
      "##results\n",
      "print'%s %.5f %s'%('The magnitude of principal strain are ',abs(ep_1),'')\n",
      "print'%s %.5f %s'%('The magnitude of principal strain are ',abs(ep_2),'')\n",
      "print'%s %.5f %s'%('The magnitude of principal strain are ',abs(ep_3),'')\n",
      "print'%s %.2f %s'%('\\n and the diection is given by theta=',th,' degrees')\n",
      "print'%s %.8f %s'%('\\n J1 is ',J1,'')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The magnitude of principal strain are  0.00066 \n",
        "The magnitude of principal strain are  0.00047 \n",
        "The magnitude of principal strain are  0.00006 \n",
        "\n",
        " and the diection is given by theta= 16.85  degrees\n",
        "\n",
        " J1 is  0.00012500 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex3-pg115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#findd the value of sigma y and principal stress\n",
      "# initialization of variables\n",
      "\n",
      "sigma_x=1400. ##kg/cm^2\n",
      "tau_xy=400.## kg/cm^2\n",
      "ep_z=-3.6*10**-6\n",
      "nu=1/4.\n",
      "E=2*10**8 ##kg/cm^2\n",
      "## calculations\n",
      "sigma_y=(-ep_z*E/nu)-sigma_x\n",
      "sigma_1=(sigma_x+sigma_y)/2.+math.sqrt((1/2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "sigma_2=(sigma_x+sigma_y)/2-math.sqrt((1/2.*(sigma_x-sigma_y))**2+tau_xy**2)\n",
      "th=0.5*math.atan(2*tau_xy/(sigma_x-sigma_y))\n",
      "th=th*180/math.pi\n",
      "print'%s %.2f %s'%('sigma_y is ',sigma_y,' kg/cm^2')\n",
      "print'%s %.2f %s %.2f %s '%('\\n The principal stresses are',sigma_1,'kg/cm^2 'and '',sigma_2,'kg/cm^2')\n",
      "print'%s %.2f %s'%('\\n The direction is given by theta = ',-th,' degrees')\n",
      "\n",
      "## angle was given wrong in the text\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "sigma_y is  1480.00  kg/cm^2\n",
        "\n",
        " The principal stresses are 1842.00  1038.00 kg/cm^2 \n",
        "\n",
        " The direction is given by theta =  42.14  degrees\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex4-pg121"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "##initialization of variables\n",
      "#detemine wheather there is yielding according to tresca and von moises conditions or not\n",
      "C=1000./3. ##kg/cm^2\n",
      "sigma_x=2.*C\n",
      "sigma_y=4.*C\n",
      "tau_xy=4.*C\n",
      "sigma_0=4.*C\n",
      "sigma_1=3.+C*math.sqrt(2.)\n",
      "sigma_2=3.-C*math.sqrt(2.)\n",
      "sigma_3=0.\n",
      "tau_oct=1/3.*math.sqrt((sigma_1-sigma_2)**2+(sigma_2-sigma_3)**2+(sigma_3-sigma_1)**2)\n",
      "tau_max=sigma_1/2.\n",
      "taU=1.885*C\n",
      "tau_y=2.*C\n",
      "print'%s %.2f %s'%('Actual tau is ',taU,'')\n",
      "print'%s %.2f %s'%('\\n tau_max at yield is ',tau_y,'')\n",
      "print('\\n Hence yielding doesn not occur according to Von-Miles condition \\n but it occurs due to Tresca condition')\n",
      "print('\\n In text book C is not multiplied' )\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Actual tau is  628.33 \n",
        "\n",
        " tau_max at yield is  666.67 \n",
        "\n",
        " Hence yielding doesn not occur according to Von-Miles condition \n",
        " but it occurs due to Tresca condition\n",
        "\n",
        " In text book C is not multiplied\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}