summaryrefslogtreecommitdiff
path: root/Solid_Mechanics_by_S._M._A._Kazimi/Chapter2.ipynb
blob: 656a859770a59499c9964f0b5950b69f558e19ff (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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
{
 "metadata": {
  "name": "",
  "signature": "sha256:7ce3350f5dcc3b0641adb55040e49ecdbd34a727a892086466c616c0ec4732d8"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter2-Analysis of Stress(Equlibrium) "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex4-pg54"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#find the new stress tensor tau\n",
      "import numpy\n",
      "from numpy import linalg\n",
      "## initialization of variables\n",
      "\n",
      "tau=([[200, 100, 0],\n",
      "      [100, 0, 0],\n",
      "      [0 ,0, 500]]) ## some units\n",
      "theta=60. ## degrees\n",
      "##calculations\n",
      "theta1=theta/57.3\n",
      "a=([[math.cos(theta1), math.sin(theta1), 0],\n",
      "    [-math.sin(theta1), math.cos(theta1), 0],\n",
      "    [0, 0, 1]])\n",
      "b=numpy.transpose(a)\n",
      "tau_new=numpy.dot(a,tau)\n",
      "tau_new1=numpy.dot(tau_new,b)\n",
      "## Results\n",
      "print('The new stress tensor is')\n",
      "print tau_new1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The new stress tensor is\n",
        "[[ 136.62361289 -136.59689227    0.        ]\n",
        " [-136.59689227   63.37638711    0.        ]\n",
        " [   0.            0.          500.        ]]"
       ]
      },
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5-pg61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "find the octahedral at this point\n",
      "## initialization of variables\n",
      "import math\n",
      "sigma_1=100. ##kg*f/cm^2\n",
      "sigma_2=100. ##kg*f/cm^2\n",
      "sigma_3=-200. ##kg*f/cm^2\n",
      "## calculations\n",
      "tau_oct=1/3.*math.sqrt((sigma_1-sigma_2)**2+(sigma_2-sigma_3)**2+(sigma_3-sigma_1)**2)\n",
      "## Results\n",
      "print'%s %.2f %s '%('Octahedra shear stress at the point is=',tau_oct,' kgf/cm^2')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Octahedra shear stress at the point is= 141.42  kgf/cm^2 \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex7-pg61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#check whether the invariants of stress sensor\n",
      "import numpy\n",
      "from numpy import linalg\n",
      "## initialization of variable\n",
      "tau=numpy.matrix([[200, 100, 0],\n",
      "     [100, 0, 0],\n",
      "     [0, 0, 500]]) ## some units\n",
      "theta=60. ## 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",
      "b=numpy.transpose(a)\n",
      "tau_new=numpy.dot(a,tau)\n",
      "tau_new1=numpy.dot(tau_new,b)\n",
      "\n",
      "## stress invariants :old \n",
      "I1=tau[0,0]+tau[1,1]+tau[2,2]\n",
      "I2=tau[0,0]*tau[1,1]+tau[1,1]*tau[2,2]+tau[2,2]*tau[0,0]-(tau[0,1]**2+tau[1,2]**2+tau[2,0]**2)\n",
      "I3=tau[0,0]*tau[1,1]*tau[2,2]+2*tau[0,1]*tau[1,2]*tau[2,0]-(tau[0,0]*tau[1,2]**2+tau[1,1]*tau[2,0]**2+tau[2,2]*tau[0,1]**2)\n",
      "\n",
      "## stress invariants :new\n",
      "I11=tau_new1[0,0]+tau_new1[0,0]+tau_new1[1,1]\n",
      "I22=tau_new1[0,0]*tau_new1[1,1]+tau_new1[1,1]*tau_new1[2,2]+tau_new1[1,1]*tau_new1[0,0]-[tau_new1[0,1]**2+tau_new1[1,2]**2+tau_new1[1,0]**2]\n",
      "I33=tau_new1[0,0]*tau_new1[1,1]*tau_new1[2,2]+2*tau_new1[0,1]*tau_new1[1,2]*tau_new1[2,0]-[tau_new1[0,0]*tau_new1[1,2]**2+tau_new1[1,1]*tau_new1[2,0]**2+tau_new1[2,2]*tau_new1[0,1]**2]\n",
      "\n",
      "## Results\n",
      "print'%s %.2f %s %.2f %s %.2f %s %.2f %s %.2f %s %.2f' %('The invariants of old stress tensor are I1=',I1,' I2=',I2,' I3=',I3,' \\n and that of the new stress tensor are I1=',I11,' I2=',I22,' I3=',I33)\n",
      "\n",
      "print('\\n Hence the same stress tensor invariants')\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The invariants of old stress tensor are I1= 700.00  I2= 90000.00  I3= -5000000.00  \n",
        " and that of the new stress tensor are I1= 336.60  I2= 11698.73  I3= -5000000.00\n",
        "\n",
        " Hence the same stress tensor invariants\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8-pg67"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "## initialization of variables\n",
      "#find the value of sigma 1 and sigma2 at biaxial yeilding and unaxial\n",
      "sigma_3=0. ## kgf/cm**2\n",
      "tau_oct=1500. ## kgf/cm**2\n",
      "n=2 ## given that sigma_1=n*sigma_2\n",
      "## calculations\n",
      "sigma_2=1500.*3./(math.sqrt(2*n**2-2*n+2)) ## ## kgf/cm**2\n",
      "sigma_1=n*sigma_2 ## kgf/cm**2 \n",
      "sigma_0=4500./math.sqrt(2.) ## kgf/cm**2\n",
      "## Results\n",
      "print'%s %.2f %s %.2f %s %.2f %s  '%('The necessary stresses sigma_1, sigma_2 for biaxial yielding are \\n ',sigma_2,' kgf/cm^2' '',sigma_1,' kgf/cm^2' and 'for uniaxial yielding sigma_0 ',sigma_0,'kgf/cm^2.')\n",
      "                    \n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The necessary stresses sigma_1, sigma_2 for biaxial yielding are \n",
        "  1837.12  kgf/cm^2 3674.23 for uniaxial yielding sigma_0  3181.98 kgf/cm^2.  \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9-pg68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "##initialization of variables\n",
      "#find the magnitude and direction of principal stress for the a b c\n",
      "## part (a)\n",
      "tau_xx=300 ## kgf/cm**2\n",
      "tau_yy=0 ## kgf/cm**2\n",
      "tau_xy=600 ## kgf/cm**2\n",
      "##calculations\n",
      "sigma_1=(tau_xx+tau_yy)/2.+math.sqrt((1./2.*(tau_xx-tau_yy))**2+tau_xy**2)\n",
      "sigma_2=(tau_xx+tau_yy)/2-math.sqrt((1/2.*(tau_xx-tau_yy))**2+tau_xy**2)\n",
      "Beta=math.atan(2*tau_xy/(tau_xx-tau_yy))\n",
      "Beta=Beta*180/math.pi\n",
      "##Results\n",
      "print'%s %.2f%s %.2f %s %.2f %s'%('\\n Part (a) \\n The magnitude of principal stresses are',sigma_1,''and '',sigma_2,'kgf/cm^2' and' \\n the direction is given by 2*beta=',Beta,'')\n",
      "\n",
      "\n",
      "##part (b)\n",
      "tau_xx=1000 ## kgf/cm**2\n",
      "tau_yy=150 ## kgf/cm**2\n",
      "tau_xy=450 ## kgf/cm**2\n",
      "## calculations\n",
      "sigma_1=(tau_xx+tau_yy)/2+math.sqrt((1/2*(tau_xx-tau_yy))**2+tau_xy**2)\n",
      "sigma_2=(tau_xx+tau_yy)/2-math.sqrt((1/2*(tau_xx-tau_yy))**2+tau_xy**2)\n",
      "Beta=math.atan(2*tau_xy/(tau_xx-tau_yy))\n",
      "Beta1=Beta*180./math.pi\n",
      "## Results\n",
      "print'%s %.2f %s  %.2f %s %.2f %s '%('\\n Part (b) \\n The magnitude of principal stresses are',sigma_1,''and '',sigma_2,'kgf/cm^2' and' \\n the direction is given by 2*beta=',Beta1,'')\n",
      "\n",
      "## part (c)\n",
      "tau_xx=-850 ## kgf/cm**2\n",
      "tau_yy=350 ## kgf/cm**2\n",
      "tau_xy=700 ## kgf/cm**2\n",
      "## calculations\n",
      "sigma_1=(tau_xx+tau_yy)/2+math.sqrt((1/2*(tau_xx-tau_yy))**2+tau_xy**2)\n",
      "sigma_2=(tau_xx+tau_yy)/2-math.sqrt((1/2*(tau_xx-tau_yy))**2+tau_xy**2)\n",
      "Beta=math.atan(2*tau_xy/(tau_xx-tau_yy))\n",
      "Beta=Beta*57.3\n",
      "## Results\n",
      "print'%s %.2f %s %.2f %s %.2f %s '%('\\n Part (c) \\n The magnitude of principal stresses are',sigma_1,''and '',sigma_2,'kgf/cm^2' and' \\n the direction is given by 2*beta=',-Beta,'')\n",
      "                   \n",
      "\n",
      "## wrong answers were given in textbook for part (b) (c)\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        " Part (a) \n",
        " The magnitude of principal stresses are 768.47 -468.47  \n",
        " the direction is given by 2*beta= 75.96 \n",
        "\n",
        " Part (b) \n",
        " The magnitude of principal stresses are 1025.00   125.00  \n",
        " the direction is given by 2*beta= 45.00  \n",
        "\n",
        " Part (c) \n",
        " The magnitude of principal stresses are 450.00  -950.00  \n",
        " the direction is given by 2*beta= 63.44  \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex10-pg70"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import  math\n",
      "# initialization of variables\n",
      "#find the intensity of diagonal tension\n",
      "tau_xx= -1 # kgf/cm^2\n",
      "tau_yy= 0 # kgf/cm^2\n",
      "tau_xy= 7 # kgf/cm^2\n",
      "# calculations \n",
      "sigma_1=(tau_xx+tau_yy)/2.+math.sqrt((1/2.*(tau_xx-tau_yy))**2+tau_xy**2)\n",
      "sigma_2=(tau_xx+tau_yy)/2.-math.sqrt((1/2.*(tau_xx-tau_yy))**2+tau_xy**2)\n",
      "x=sigma_1 # positive one is tension\n",
      "if(sigma_2>sigma_1):\n",
      "    x=sigma_2\n",
      "\n",
      "# Results\n",
      "print'%s %.2f %s'%('The diagonal tension is ',x,' kgf/cm^2')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diagonal tension is  6.52  kgf/cm^2\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex11-pg70"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# initialization of variables\n",
      "#find the state of stress at the joint\n",
      "d=2 # m\n",
      "l=10 # m\n",
      "t=1 # cm\n",
      "p=15 # kgf/cm^2\n",
      "pitch= 2*math.pi #m\n",
      "##calculations\n",
      "w=2*math.pi*d/2. # m\n",
      "theta=math.atan(w/(2*math.pi))\n",
      "sigma_z=p*d*100./(4.*t)\n",
      "sigma_th=p*d*100./(2.*t)\n",
      "sigma_th_new=(sigma_th+sigma_z)/2.+(sigma_th-sigma_z)/2.*math.cos(2*theta)\n",
      "tau_thz=(sigma_z-sigma_th)*math.sin(2.*theta)/2\n",
      "# results\n",
      "print'%s %.2f %s %.2f %s '%('At the junction, the normal and shear stresses are',sigma_th_new,'' and '',-tau_thz,' kgf/cm^2 \\n respectively, and the rivets must be designed for this')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "At the junction, the normal and shear stresses are 1125.00  375.00  kgf/cm^2 \n",
        " respectively, and the rivets must be designed for this \n"
       ]
      }
     ],
     "prompt_number": 12
    }
   ],
   "metadata": {}
  }
 ]
}