diff --git a/Final projects/Joiner/README.txt b/Final projects/Joiner/README.txt new file mode 100644 index 0000000..81a553f --- /dev/null +++ b/Final projects/Joiner/README.txt @@ -0,0 +1 @@ +Jason Joiner Final Project \ No newline at end of file diff --git a/Final projects/Joiner/ThermalExpansionofaPipe _ JoinerFinalProject.ipynb b/Final projects/Joiner/ThermalExpansionofaPipe _ JoinerFinalProject.ipynb new file mode 100644 index 0000000..99d6fbf --- /dev/null +++ b/Final projects/Joiner/ThermalExpansionofaPipe _ JoinerFinalProject.ipynb @@ -0,0 +1,512 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9740eaf357ef28329fdf75bfe80e2a139656472176632974bba45e510d19771a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 6, + "metadata": {}, + "source": [ + "Content under Creative Commons Attribution license CC-BY 4.0, code under MIT license (c)2014 created by J.Joiner for GWU MAE6286 " + ] + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "The Days Grow Shorter, The Pipes Grow Longer. " + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Linear Thermal Expansion" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Greetings and welcome back. This module will discuss the 2nd order equation governing the expansion of materials. More specifically it will cover the linear thermal expansion of process piping. Like many objects, metal pipes expand and contract due to variations in temperature. This is especially true for process piping and if not careful this will lead to the pipe and pipe supports to become overly stressed. For instance if a steam pipe containing 350 degrees Fahrenheit is installed on a 10 degree day, the pipe will expand considerably. This expansion, if restrained will lead to a larger buildup of forces on the restraints. How much will this pipe expand, unconstrained? How much stress will be applied to the restraints? Let\u2019s find out." + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Strain" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Inorder to determine the expansion of the pipe a relationship between strain and temperature must be derived. Lets start with the Mathmatical definitions of strain in each direction, given in cylindrical coordinates. For this problem, r is the radius of the pipe, $\\theta$ is the angular position in the pipe cross-section, and z is in the axial direction of the pipe. $^1$" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "e_{rr} &= \\frac{\\partial u}{\\partial r}\\\\\n", + "e_{\\theta \\theta} &= \\frac{1}{r}\\frac{\\partial u_\\theta}{\\partial \\theta} + \\frac{u_r}{r}\\\\\n", + "e_{zz} &= \\frac{\\partial u_z}{\\partial z}\\\\\n", + "e_{rz} &= \\frac{1}{2} (\\frac{\\partial u_r}{\\partial z} + \\frac{\\partial u_z}{\\partial r})\\\\\n", + "e_{\\theta z} &= \\frac{1}{2} (\\frac{\\partial u_\\theta}{\\partial z} + \\frac{\\partial u_z}{\\partial \\theta})\\\\\n", + "e_{\\theta r} &= \\frac{1}{2} (\\frac{1}{r}\\frac{\\partial u_r}{\\partial \\theta} + \\frac{u_\\theta}{r} + \\frac{\\partial u_\\theta}{r})\\\\\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this module we are looking to solve for linear expansion which coresponds to $e_{zz}$ which is the strain in the Z-Direction. To to simplify the strain equations we will need to establish some assumptions. \n", + "\n", + "Assumptions:\n", + "1) The temperature from the inside diameter to the outside diameter of the pipe only varies in the r-direction. For the length of the pipe the temperature is constant. This is assuming that whatever heat lost to the pipe surrodnings is regenerated by a steam boiler such that the internal pipe temperature is constant. \n", + "\n", + "2) The pipe material is homogenous. It is made of one type of material. \n", + "\n", + "3) Temperature is uniform in the radial direction, $\\theta$. The pipe is homogenious and symetrical. \n", + "\n", + "4) The wall of the pipe is thin such that the radial deflection of the change of the deflection in the z-direction does not change significatly with the change pipe radius. \n", + "\n", + "From these assumptions it the following variables become zero:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "u_\\theta &=0\\\\\n", + "\\partial \\theta &=0\\\\\n", + "\\frac{\\partial u_z}{\\partial r}&=0\\\\\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We are now left with the following strain equations:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "e_{rr} &= \\frac{\\partial u_r}{\\partial r}\\\\\n", + "e_{\\theta \\theta} &= \\frac{u_r}{r}\\\\\n", + "e_{zz} &= \\frac{\\partial u_z}{\\partial z}\\\\\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "One final assumption is that $u_r$ is small when compared with the length of the pipe section. This assumption is made such that only linear expansion is considered. As the pipe section grows smaller this assumption becomes more and more inaccurate.\n", + "\n", + "We are now left with one strain equation for the strain in the z-direction:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "e_{zz} &= \\frac{\\partial u_z}{\\partial z}\n", + "\\end{align}" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Strain versus Temperature" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The relationship between linear strain and temperature is given in the following equation when it is assumed that there are no stresses $^2$:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "e_{zz} &= a\\Delta T\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This is valid for the case where the pipe is allowed to expand unstrained. \n", + "\n", + "Taking the partial derivative with respect to time leads to the time rate of change of strain as the temperature of the pipe changes. " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "\\frac{\\partial e_{zz}}{\\partial t} &= a\\frac{\\partial T}{\\partial t}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Where a is the themal expansion coefficient. Since heat from the contents of the pipe is diffusing out of the pipe cross-section, the heat transfer is governed by the 2D heat conduction equation. From the pervious lessons $^3$ from Module 4 we know that the 2D heat condution equation is as follows:\n", + "\n", + "\\begin{align}\n", + "\\frac{\\partial T}{\\partial t} = a (\\frac{\\partial^2 T}{\\partial x^2}+\\frac{\\partial^2 T}{\\partial y^2})\n", + "\\end{align}\n", + "\n", + "Where $\\alpha$ is the thermal diffusivity. in radial coordinates this equation becomes:\n", + "\n", + "\\begin{align}\n", + "\\frac{\\partial T}{\\partial t} = \\alpha (\\frac{\\partial^2 T}{\\partial r^2})\n", + "\\end{align}\n", + "\n", + "where:\n", + "\n", + "\\begin{align}\n", + "x = r \\cos(\\theta)\\\\\n", + "y = r \\sin(\\theta)\\\\\n", + "\\end{align}\n", + "\n", + "and $\\Delta \\theta$ is small.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The strain rate can now be solved for as a function of pipe radius and change in temperature. By substituting in the above equation into the strain rate equation:\n", + "\n", + "\\begin{align}\n", + "\\frac{\\partial e_{zz}}{\\partial t} &= a\\alpha (\\frac{\\partial^2 T}{\\partial r^2})\n", + "\\end{align}\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Numerical Scheme" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The new strain rate equation is now in the form of the 1D diffusion equation. To solve this equation the numerical scheme to be used with therefore with a forward time central space discretization. " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "\\frac{e_{i}^{n+1}-e_{i}^{n}}{\\Delta t}=a\\alpha\\frac{T_{i+1}^{n}-2T_{i}^{n}+T_{i-1}^{n}}{\\Delta r^2}\n", + "\\end{align}\n", + "\n", + "Solving for the next displacement in time, the equation becomes:\n", + "\n", + "\\begin{align}\n", + "e_{i}^{n+1}=e_{i}^{n}+\\frac{a \\alpha\\Delta t}{\\Delta r^2}(T_{i+1}^{n}-2T_{i}^{n}+T_{i-1}^{n})\n", + "\\end{align}\n", + "\n", + "Finally based on the definition of strain the following relatioship gives the elongation of the pipe:\n", + "\n", + "\\begin{align}\n", + "L_{i}^{n+1} = e_{i}^{n+1}*L_{i}^{0} + L_{i}^{0}\n", + "\\end{align}\n", + "\n", + "Where $L$ is the length of the pipe and $L_{i}^{0}$ is the initiall length of the pipe. " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Finally inorder to ensure stability the cfl condition from von Neumann stability analysis $^4$ is determined to be:\n", + "\n", + "\\begin{align}\n", + "\\frac{a \\alpha \\Delta t}{\\Delta x^2 } \\le 0.5\n", + "\\end{align}\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Solve!" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Before we solve. Lets establish some initial conditions and boundary conditions. \n", + "\n", + "The pipe is a 18 in steel pipe containing steam at 350 deg F and was installed at 10 degrees. In this simulation the pipe is initally at 10 degrees at all points except at the internal diameter which is at 350 degrees due to the temperature of the pipe contents. The pipe is condsidered to be perfectlly unsulated such that there is no heat loss at the outer diameter. The simulation will run until the outside temperature of the pipe reaches in the inside temperature.\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import numpy\n", + "import matplotlib.pyplot as plt\n", + "#matplotlib inline\n", + "from matplotlib import rcParams\n", + "\n", + "rcParams['font.family'] = 'serif'\n", + "rcParams['font.size'] = 16\n", + "\n", + "\n", + "\n", + "\n", + "#Material Properties\n", + "alpha = 1.172e-5 #thermal diffusity, m\u00b2/s of steel\n", + "a = 12.0e-6 #thermal expansion coeff, 10-6/K, of steel\n", + "nu = 0.3 # Poisson's ratio streel, carbon steel\n", + "E = 205.5e9*0.000145 # Modulous of Elasticity, Pa, carbon steel\n", + "\n", + "c13 = E*(nu)/((1.+nu)*(1.-2.*nu))\n", + "c12 =c13\n", + "c23 = c13\n", + "\n", + "c33 = E*(1.-nu)/((1.+nu)*(1.-2.*nu))\n", + "Beta = (c13+c23+c33)*a\n", + "\n", + "\n", + "A = c33*a+Beta\n", + "# Conversion Factors\n", + "in2mm = 25.4 #converts to SI units\n", + "ft2m = 0.3048 #Converts ft to meters\n", + "\n", + "# Pipe Size\n", + "OD = 18 # Outer Diameter in inches\n", + "OD = OD*in2mm/1000. # converts inches to meters\n", + "Pipe_thick = 0.375*in2mm/1000 # converts inches to meters\n", + "ID = OD-Pipe_thick*2 # Inner Diameter\n", + "\n", + "#Pipe Length\n", + "L0 = 200.0 # Initial length of pipe, ft\n", + "L0 = L0*ft2m #Converts ft to meters\n", + "\n", + "\n", + "# Grid Size\n", + "nr = 51.\n", + "nt = 40000\n", + "dr = Pipe_thick/(nr-1)\n", + "# Stability Requirements\n", + "sigma = 1/2.0\n", + "\n", + "\n", + "dt = sigma * dr*dr/alpha\n", + "\n", + "\n", + "# Initial Conditions\n", + "Tins = 10. # Install Temperature deg F\n", + "Tins = ((Tins-32)*5/9 + 274.15) #converted to Kelvin\n", + "Ti = numpy.ones((nr))*Tins#*Tins#*((Tins-32)*5/9 + 274.15)# Initial Temperature array converted to deg C\n", + "Topp = 350. # Operational Temperature deg F\n", + "Ti[0] = (Topp-32)*5/9 + 274.15#Sets the temperature at the inner diameter to Operational Temp, deg C \n", + "L = numpy.ones((nr,nt))*L0 #Initalizes array for lengths\n", + "#dL = numpy.zeros(nr)\n", + "\n", + "# Final Temperature and Pipe Lengths\n", + "T = Ti.copy()\n", + "Lexp = L.copy()\n", + "\n", + "# Stress and Strain Arrays, Initailly Zero Stress or Strain\n", + "\n", + "StrainI = numpy.zeros((nr))\n", + "\n", + "# Final Stress and Strain\n", + "StrainF = StrainI.copy()\n", + "\n", + "# Final Temperature\n", + "T_Break = (Topp-32)*5/9 + 274.15\n", + "\n", + "for n in range(nt): \n", + "\n", + "# Solve for Temp\n", + " Tn = T.copy() \n", + " T[1:-1] = Tn[1:-1] + alpha*dt/dr**2*(Tn[2:] -2*Tn[1:-1] + Tn[0:-2])\n", + " T[-1] = T[-2]\n", + " \n", + " StrainN = StrainF.copy()\n", + " StrainF[1:-1] = StrainN[1:-1] + (alpha**2)*dt/dr**2*(Tn[2:] -2*Tn[1:-1] + Tn[0:-2])\n", + " StrainF[0] = StrainF[1]\n", + " StrainF[-1] = StrainF[-2]\n", + "\n", + " Lexp[:,n] = StrainF[:]*L[:,n]+L[:,n]\n", + " \n", + " #Lexp = Lexp+dL\n", + " \n", + "# Determining Stop Condition\n", + " T_current = T[nr-1] #Temp at OD\n", + " T_fin = T_Break-T_current #Difference between Temp at OD and Temp at ID\n", + " n_stop = n + 1\n", + " if Topp > Tins:\n", + " if T_fin <= 0.1:\n", + " print (\"Outside of pipe reached 350F at time {0:.2f}s, in time step {1:d}.\".format(dt*n_stop, n_stop))\n", + " break\n", + " else: \n", + " if T_fin >= -0.1:\n", + " print (\"Outside of pipe reached 350F at time {0:.2f}s, in time step {1:d}.\".format(dt*n_stop, n_stop))\n", + " break \n", + "\n", + "\n", + "\n", + "\n", + "T = ((T - 274.15)*9./5.)+32.\n", + "time = n*dt\n", + "\n", + "#print n_stop, time, T[50,nt]>=Topp*0.1\n", + "\n", + "Lexp = Lexp/ft2m\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Outside of pipe reached 350F at time 23.94s, in time step 15460.\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print (\"The expansion of the pipe is {0:.2f} inches.\" .format((Lexp[nr-1,n_stop-1]-L[nr-1,0]/ft2m)*12))\n", + "print (\"The new Length of the pipe is {0:.2f} feet.\" .format((Lexp[nr-1,n_stop-1])))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The expansion of the pipe is 5.31 inches.\n", + "The new Length of the pipe is 200.44 feet.\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If the pipe is then restrained such that no expansion is allowed the stress in psi becomes:" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "StressF3 = E*StrainF #psi\n", + "print numpy.mean(StressF3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "65942.7644163\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "References" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[1] \"Thermal Stresses in a Rotating Non-Homogenious Hollow Cylinder\", A.M. El-Naggar, Heat and Mass Transfer 39 (2002) 41-46 Springer Verlag 2002\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[2] \"Transient Thermal Stress Analysis of Thick-Walled Cylinders\", A. Kandil, Int. J. Mech. Sci. Vol 36, No 7, pp. 721-732, 1195, Elsevier Science Ltd." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[3] Barba, Lorena A., et al. \"MAE 6286 Practical Numerical Methods with Python,\" GW Open edX, The George Washingtion University, 2014. http://openedx.seas.gwu.edu/courses/GW/MAE6286/2014_fall/about" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[4] \"Analysis of Numerical Methods\" (Dover Books on Mathematics) Paperback \u2013 June 7, 1994\n", + "by Eugene Isaacson (Author), Herbert Bishop Keller (Author), Dover Publications; Reprint edition (June 7, 1994)" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Final projects/ThermalExpansionofaPipe _ JoinerFinalProject.ipynb b/Final projects/ThermalExpansionofaPipe _ JoinerFinalProject.ipynb new file mode 100644 index 0000000..99d6fbf --- /dev/null +++ b/Final projects/ThermalExpansionofaPipe _ JoinerFinalProject.ipynb @@ -0,0 +1,512 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9740eaf357ef28329fdf75bfe80e2a139656472176632974bba45e510d19771a" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 6, + "metadata": {}, + "source": [ + "Content under Creative Commons Attribution license CC-BY 4.0, code under MIT license (c)2014 created by J.Joiner for GWU MAE6286 " + ] + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "The Days Grow Shorter, The Pipes Grow Longer. " + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Linear Thermal Expansion" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Greetings and welcome back. This module will discuss the 2nd order equation governing the expansion of materials. More specifically it will cover the linear thermal expansion of process piping. Like many objects, metal pipes expand and contract due to variations in temperature. This is especially true for process piping and if not careful this will lead to the pipe and pipe supports to become overly stressed. For instance if a steam pipe containing 350 degrees Fahrenheit is installed on a 10 degree day, the pipe will expand considerably. This expansion, if restrained will lead to a larger buildup of forces on the restraints. How much will this pipe expand, unconstrained? How much stress will be applied to the restraints? Let\u2019s find out." + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Strain" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Inorder to determine the expansion of the pipe a relationship between strain and temperature must be derived. Lets start with the Mathmatical definitions of strain in each direction, given in cylindrical coordinates. For this problem, r is the radius of the pipe, $\\theta$ is the angular position in the pipe cross-section, and z is in the axial direction of the pipe. $^1$" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "e_{rr} &= \\frac{\\partial u}{\\partial r}\\\\\n", + "e_{\\theta \\theta} &= \\frac{1}{r}\\frac{\\partial u_\\theta}{\\partial \\theta} + \\frac{u_r}{r}\\\\\n", + "e_{zz} &= \\frac{\\partial u_z}{\\partial z}\\\\\n", + "e_{rz} &= \\frac{1}{2} (\\frac{\\partial u_r}{\\partial z} + \\frac{\\partial u_z}{\\partial r})\\\\\n", + "e_{\\theta z} &= \\frac{1}{2} (\\frac{\\partial u_\\theta}{\\partial z} + \\frac{\\partial u_z}{\\partial \\theta})\\\\\n", + "e_{\\theta r} &= \\frac{1}{2} (\\frac{1}{r}\\frac{\\partial u_r}{\\partial \\theta} + \\frac{u_\\theta}{r} + \\frac{\\partial u_\\theta}{r})\\\\\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this module we are looking to solve for linear expansion which coresponds to $e_{zz}$ which is the strain in the Z-Direction. To to simplify the strain equations we will need to establish some assumptions. \n", + "\n", + "Assumptions:\n", + "1) The temperature from the inside diameter to the outside diameter of the pipe only varies in the r-direction. For the length of the pipe the temperature is constant. This is assuming that whatever heat lost to the pipe surrodnings is regenerated by a steam boiler such that the internal pipe temperature is constant. \n", + "\n", + "2) The pipe material is homogenous. It is made of one type of material. \n", + "\n", + "3) Temperature is uniform in the radial direction, $\\theta$. The pipe is homogenious and symetrical. \n", + "\n", + "4) The wall of the pipe is thin such that the radial deflection of the change of the deflection in the z-direction does not change significatly with the change pipe radius. \n", + "\n", + "From these assumptions it the following variables become zero:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "u_\\theta &=0\\\\\n", + "\\partial \\theta &=0\\\\\n", + "\\frac{\\partial u_z}{\\partial r}&=0\\\\\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We are now left with the following strain equations:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "e_{rr} &= \\frac{\\partial u_r}{\\partial r}\\\\\n", + "e_{\\theta \\theta} &= \\frac{u_r}{r}\\\\\n", + "e_{zz} &= \\frac{\\partial u_z}{\\partial z}\\\\\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "One final assumption is that $u_r$ is small when compared with the length of the pipe section. This assumption is made such that only linear expansion is considered. As the pipe section grows smaller this assumption becomes more and more inaccurate.\n", + "\n", + "We are now left with one strain equation for the strain in the z-direction:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "e_{zz} &= \\frac{\\partial u_z}{\\partial z}\n", + "\\end{align}" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Strain versus Temperature" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The relationship between linear strain and temperature is given in the following equation when it is assumed that there are no stresses $^2$:" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "e_{zz} &= a\\Delta T\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This is valid for the case where the pipe is allowed to expand unstrained. \n", + "\n", + "Taking the partial derivative with respect to time leads to the time rate of change of strain as the temperature of the pipe changes. " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "\\frac{\\partial e_{zz}}{\\partial t} &= a\\frac{\\partial T}{\\partial t}\n", + "\\end{align}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Where a is the themal expansion coefficient. Since heat from the contents of the pipe is diffusing out of the pipe cross-section, the heat transfer is governed by the 2D heat conduction equation. From the pervious lessons $^3$ from Module 4 we know that the 2D heat condution equation is as follows:\n", + "\n", + "\\begin{align}\n", + "\\frac{\\partial T}{\\partial t} = a (\\frac{\\partial^2 T}{\\partial x^2}+\\frac{\\partial^2 T}{\\partial y^2})\n", + "\\end{align}\n", + "\n", + "Where $\\alpha$ is the thermal diffusivity. in radial coordinates this equation becomes:\n", + "\n", + "\\begin{align}\n", + "\\frac{\\partial T}{\\partial t} = \\alpha (\\frac{\\partial^2 T}{\\partial r^2})\n", + "\\end{align}\n", + "\n", + "where:\n", + "\n", + "\\begin{align}\n", + "x = r \\cos(\\theta)\\\\\n", + "y = r \\sin(\\theta)\\\\\n", + "\\end{align}\n", + "\n", + "and $\\Delta \\theta$ is small.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The strain rate can now be solved for as a function of pipe radius and change in temperature. By substituting in the above equation into the strain rate equation:\n", + "\n", + "\\begin{align}\n", + "\\frac{\\partial e_{zz}}{\\partial t} &= a\\alpha (\\frac{\\partial^2 T}{\\partial r^2})\n", + "\\end{align}\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Numerical Scheme" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The new strain rate equation is now in the form of the 1D diffusion equation. To solve this equation the numerical scheme to be used with therefore with a forward time central space discretization. " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\\begin{align}\n", + "\\frac{e_{i}^{n+1}-e_{i}^{n}}{\\Delta t}=a\\alpha\\frac{T_{i+1}^{n}-2T_{i}^{n}+T_{i-1}^{n}}{\\Delta r^2}\n", + "\\end{align}\n", + "\n", + "Solving for the next displacement in time, the equation becomes:\n", + "\n", + "\\begin{align}\n", + "e_{i}^{n+1}=e_{i}^{n}+\\frac{a \\alpha\\Delta t}{\\Delta r^2}(T_{i+1}^{n}-2T_{i}^{n}+T_{i-1}^{n})\n", + "\\end{align}\n", + "\n", + "Finally based on the definition of strain the following relatioship gives the elongation of the pipe:\n", + "\n", + "\\begin{align}\n", + "L_{i}^{n+1} = e_{i}^{n+1}*L_{i}^{0} + L_{i}^{0}\n", + "\\end{align}\n", + "\n", + "Where $L$ is the length of the pipe and $L_{i}^{0}$ is the initiall length of the pipe. " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Finally inorder to ensure stability the cfl condition from von Neumann stability analysis $^4$ is determined to be:\n", + "\n", + "\\begin{align}\n", + "\\frac{a \\alpha \\Delta t}{\\Delta x^2 } \\le 0.5\n", + "\\end{align}\n" + ] + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "Solve!" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Before we solve. Lets establish some initial conditions and boundary conditions. \n", + "\n", + "The pipe is a 18 in steel pipe containing steam at 350 deg F and was installed at 10 degrees. In this simulation the pipe is initally at 10 degrees at all points except at the internal diameter which is at 350 degrees due to the temperature of the pipe contents. The pipe is condsidered to be perfectlly unsulated such that there is no heat loss at the outer diameter. The simulation will run until the outside temperature of the pipe reaches in the inside temperature.\n" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import numpy\n", + "import matplotlib.pyplot as plt\n", + "#matplotlib inline\n", + "from matplotlib import rcParams\n", + "\n", + "rcParams['font.family'] = 'serif'\n", + "rcParams['font.size'] = 16\n", + "\n", + "\n", + "\n", + "\n", + "#Material Properties\n", + "alpha = 1.172e-5 #thermal diffusity, m\u00b2/s of steel\n", + "a = 12.0e-6 #thermal expansion coeff, 10-6/K, of steel\n", + "nu = 0.3 # Poisson's ratio streel, carbon steel\n", + "E = 205.5e9*0.000145 # Modulous of Elasticity, Pa, carbon steel\n", + "\n", + "c13 = E*(nu)/((1.+nu)*(1.-2.*nu))\n", + "c12 =c13\n", + "c23 = c13\n", + "\n", + "c33 = E*(1.-nu)/((1.+nu)*(1.-2.*nu))\n", + "Beta = (c13+c23+c33)*a\n", + "\n", + "\n", + "A = c33*a+Beta\n", + "# Conversion Factors\n", + "in2mm = 25.4 #converts to SI units\n", + "ft2m = 0.3048 #Converts ft to meters\n", + "\n", + "# Pipe Size\n", + "OD = 18 # Outer Diameter in inches\n", + "OD = OD*in2mm/1000. # converts inches to meters\n", + "Pipe_thick = 0.375*in2mm/1000 # converts inches to meters\n", + "ID = OD-Pipe_thick*2 # Inner Diameter\n", + "\n", + "#Pipe Length\n", + "L0 = 200.0 # Initial length of pipe, ft\n", + "L0 = L0*ft2m #Converts ft to meters\n", + "\n", + "\n", + "# Grid Size\n", + "nr = 51.\n", + "nt = 40000\n", + "dr = Pipe_thick/(nr-1)\n", + "# Stability Requirements\n", + "sigma = 1/2.0\n", + "\n", + "\n", + "dt = sigma * dr*dr/alpha\n", + "\n", + "\n", + "# Initial Conditions\n", + "Tins = 10. # Install Temperature deg F\n", + "Tins = ((Tins-32)*5/9 + 274.15) #converted to Kelvin\n", + "Ti = numpy.ones((nr))*Tins#*Tins#*((Tins-32)*5/9 + 274.15)# Initial Temperature array converted to deg C\n", + "Topp = 350. # Operational Temperature deg F\n", + "Ti[0] = (Topp-32)*5/9 + 274.15#Sets the temperature at the inner diameter to Operational Temp, deg C \n", + "L = numpy.ones((nr,nt))*L0 #Initalizes array for lengths\n", + "#dL = numpy.zeros(nr)\n", + "\n", + "# Final Temperature and Pipe Lengths\n", + "T = Ti.copy()\n", + "Lexp = L.copy()\n", + "\n", + "# Stress and Strain Arrays, Initailly Zero Stress or Strain\n", + "\n", + "StrainI = numpy.zeros((nr))\n", + "\n", + "# Final Stress and Strain\n", + "StrainF = StrainI.copy()\n", + "\n", + "# Final Temperature\n", + "T_Break = (Topp-32)*5/9 + 274.15\n", + "\n", + "for n in range(nt): \n", + "\n", + "# Solve for Temp\n", + " Tn = T.copy() \n", + " T[1:-1] = Tn[1:-1] + alpha*dt/dr**2*(Tn[2:] -2*Tn[1:-1] + Tn[0:-2])\n", + " T[-1] = T[-2]\n", + " \n", + " StrainN = StrainF.copy()\n", + " StrainF[1:-1] = StrainN[1:-1] + (alpha**2)*dt/dr**2*(Tn[2:] -2*Tn[1:-1] + Tn[0:-2])\n", + " StrainF[0] = StrainF[1]\n", + " StrainF[-1] = StrainF[-2]\n", + "\n", + " Lexp[:,n] = StrainF[:]*L[:,n]+L[:,n]\n", + " \n", + " #Lexp = Lexp+dL\n", + " \n", + "# Determining Stop Condition\n", + " T_current = T[nr-1] #Temp at OD\n", + " T_fin = T_Break-T_current #Difference between Temp at OD and Temp at ID\n", + " n_stop = n + 1\n", + " if Topp > Tins:\n", + " if T_fin <= 0.1:\n", + " print (\"Outside of pipe reached 350F at time {0:.2f}s, in time step {1:d}.\".format(dt*n_stop, n_stop))\n", + " break\n", + " else: \n", + " if T_fin >= -0.1:\n", + " print (\"Outside of pipe reached 350F at time {0:.2f}s, in time step {1:d}.\".format(dt*n_stop, n_stop))\n", + " break \n", + "\n", + "\n", + "\n", + "\n", + "T = ((T - 274.15)*9./5.)+32.\n", + "time = n*dt\n", + "\n", + "#print n_stop, time, T[50,nt]>=Topp*0.1\n", + "\n", + "Lexp = Lexp/ft2m\n", + "\n", + "\n", + "\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Outside of pipe reached 350F at time 23.94s, in time step 15460.\n" + ] + } + ], + "prompt_number": 12 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print (\"The expansion of the pipe is {0:.2f} inches.\" .format((Lexp[nr-1,n_stop-1]-L[nr-1,0]/ft2m)*12))\n", + "print (\"The new Length of the pipe is {0:.2f} feet.\" .format((Lexp[nr-1,n_stop-1])))\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The expansion of the pipe is 5.31 inches.\n", + "The new Length of the pipe is 200.44 feet.\n" + ] + } + ], + "prompt_number": 34 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If the pipe is then restrained such that no expansion is allowed the stress in psi becomes:" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "StressF3 = E*StrainF #psi\n", + "print numpy.mean(StressF3)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "65942.7644163\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 3, + "metadata": {}, + "source": [ + "References" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[1] \"Thermal Stresses in a Rotating Non-Homogenious Hollow Cylinder\", A.M. El-Naggar, Heat and Mass Transfer 39 (2002) 41-46 Springer Verlag 2002\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[2] \"Transient Thermal Stress Analysis of Thick-Walled Cylinders\", A. Kandil, Int. J. Mech. Sci. Vol 36, No 7, pp. 721-732, 1195, Elsevier Science Ltd." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[3] Barba, Lorena A., et al. \"MAE 6286 Practical Numerical Methods with Python,\" GW Open edX, The George Washingtion University, 2014. http://openedx.seas.gwu.edu/courses/GW/MAE6286/2014_fall/about" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "[4] \"Analysis of Numerical Methods\" (Dover Books on Mathematics) Paperback \u2013 June 7, 1994\n", + "by Eugene Isaacson (Author), Herbert Bishop Keller (Author), Dover Publications; Reprint edition (June 7, 1994)" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file