Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Computational Mechanics Project #01 - Heat Transfer in Forensic Science\n",
"\n",
"We can use our current skillset for a macabre application. We can predict the time of death based upon the current temperature and change in temperature of a corpse. \n",
"\n",
"Forensic scientists use Newton's law of cooling to determine the time elapsed since the loss of life, \n",
"\n",
"$\\frac{dT}{dt} = -K(T-T_a)$,\n",
"\n",
"where $T$ is the current temperature, $T_a$ is the ambient temperature, $t$ is the elapsed time in hours, and $K$ is an empirical constant. \n",
"\n",
"Suppose the temperature of the corpse is 85$^o$F at 11:00 am. Then, 2 hours later the temperature is 74$^{o}$F. \n",
"\n",
"Assume ambient temperature is a constant 65$^{o}$F.\n",
"\n",
"1. Use Python to calculate $K$ using a finite difference approximation, $\\frac{dT}{dt} \\approx \\frac{T(t+\\Delta t)-T(t)}{\\Delta t}$. "
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"K = 0.6111111111111112\n"
]
}
],
"source": [
"dt = 2\n",
"dT = (74-85)\n",
"T = 74\n",
"Ta = 65\n",
"K = -(dT/dt)/(T-Ta)\n",
"print('K =',K)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"2. Change your work from problem 1 to create a function that accepts the temperature at two times, ambient temperature, and the time elapsed to return $K$. "
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.6111111111111112\n"
]
}
],
"source": [
"def measure_K(Temp_t1,Temp_t2,Temp_ambient,delta_t):\n",
" ''' Determine the value of K based upon temperature of corpse \n",
" when discovered, Temp_t1\n",
" after time, delta_t, Temp_t2\n",
" with ambient temperature, Temp_ambient\n",
" Arguments\n",
" ---------\n",
" Inputs\n",
" \n",
" Returns\n",
" -------\n",
" your outputs...\n",
" \n",
" '''\n",
" dt = delta_t\n",
" dT = (Temp_t2 - Temp_t1)\n",
" T = Temp_t2\n",
" Ta = Temp_ambient\n",
" K = -(dT/dt)/(T-Ta)\n",
" \n",
" print(K)\n",
"measure_K(85,74,65,2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"3. A first-order thermal system has the following analytical solution, \n",
"\n",
" $T(t) =T_a+(T(0)-T_a)e^{-Kt}$\n",
"\n",
" where $T(0)$ is the temperature of the corpse at t=0 hours i.e. at the time of discovery and $T_a$ is a constant ambient temperature. \n",
"\n",
" a. Show that an Euler integration converges to the analytical solution as the time step is decreased. Use the constant $K$ derived above and the initial temperature, T(0) = 85$^o$F. \n",
"\n",
" b. What is the final temperature as t$\\rightarrow\\infty$?\n",
" \n",
" c. At what time was the corpse 98.6$^{o}$F? i.e. what was the time of death?"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"at t = 2: T = 70.89149656620215\n"
]
}
],
"source": [
"import math\n",
"T_a = 65\n",
"T_o = 85\n",
"k = 0.6111111111111112\n",
"t = 2\n",
"T_t = T_a + (T_o - T_a)*math.exp(-k*t)\n",
"print('at t = 2: T = ', T_t)\n"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Decreasing timestep, at t = 1.3: T = analyitcal = 74.03664366175614\n"
]
}
],
"source": [
"import math\n",
"T_a = 65\n",
"T_o = 85\n",
"k = 0.6111111111111112\n",
"t = 1.3\n",
"T_t = T_a + (T_o - T_a)*math.exp(-k*t)\n",
"print('Decreasing timestep, at t = 1.3: T = analyitcal = ', T_t)\n"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"as t goes to infinity, T_t = Ambient Temperature = 65.0\n"
]
}
],
"source": [
"import math\n",
"T_a = 65\n",
"T_o = 85\n",
"k = 0.6111111111111112\n",
"t = 1000\n",
"T_t = T_a + (T_o - T_a)*math.exp(-k*t)\n",
"print('as t goes to infinity, T_t = Ambient Temperature = ', T_t)"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-0.8489352983157284\n",
"-50.93611789894371 min\n",
"time of death = 10:09 am\n"
]
}
],
"source": [
"import math\n",
"import numpy as np\n",
"T_a = 65\n",
"T_o = 85\n",
"k = 0.6111111111111112\n",
"T_t = 98.6\n",
"t = (1/k)*np.log((T_a-T_o)/(T_a-T_t))\n",
"print(t)\n",
"print((t*60), 'min')\n",
"print('time of death = ', '10:09 am')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"4. Now that we have a working numerical model, we can look at the results if the\n",
"ambient temperature is not constant i.e. T_a=f(t). We can use the weather to improve our estimate for time of death. Consider the following Temperature for the day in question. \n",
"\n",
" |time| Temp ($^o$F)|\n",
" |---|---|\n",
" |8am|55|\n",
" |9am|58|\n",
" |10am|60|\n",
" |11am|65|\n",
" |noon|66|\n",
" |1pm|67|\n",
"\n",
" a. Create a function that returns the current temperature based upon the time (0 hours=11am, 65$^{o}$F) \n",
" *Plot the function $T_a$ vs time. Does it look correct? Is there a better way to get $T_a(t)$?\n",
"\n",
" b. Modify the Euler approximation solution to account for changes in temperature at each hour. \n",
" Compare the new nonlinear Euler approximation to the linear analytical model. \n",
" At what time was the corpse 98.6$^{o}$F? i.e. what was the time of death? \n",
" \n",
" "
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"65"
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCAYAAABhffzLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1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s2+tnDzF40s7Fm9pGZDTOzvmb2hpm9a2Y7R+9rYWbjzWxW9Ni3in02MrMHo8+9bWY9o5cmAy2jXv3+1cXl7o9H7z852ucV0fHmmNkIC3Y2s7dSjtvOzN6sm/8yUqiU+KXQ7AGcB3QETgHau3tX4D5gcPSe2wk98y6E2ij3VbGf/wVw947AScBD0UI/RwHz3L2zu7+cRjxvAbtGz4e7e5do/YjGwJHuPg/42sw6R+8ZQKjbLlJjSvxSaGa5+5KodMc8Qo8b4F2gbfT8IGC4mc0m1ADawsyaVtrPfsAjAO7+AeF2+vY1iMdSnvc0s5lm9i7QC9gtar8PGGBm9QklSB6rwXFE/ktj/FJoUms1laVsl1Hx/0M9YG93X13Nfqya1zbGnkBx9NfCXwkrxn0aXacoXyp0PKFuyzTgzeh6hkiNqccvsq7JpNQ9TxlmSfUSYWEMzKw9oTjcRq2GZWbHAYcQqqiWJ/nlZrY5cHz5+9x9DfAccDfw4MYcQ6QqSvwi6zoXKIqmZL4PVFUB8q9A/WhY5nHgtDQrvw4pn84J9AN6RWtGfAWMJAw5TQRmVfrcaMKye/m8ipxkiKpziuQAM/sD0Mzd/5R0LJL7NMYvkuXMbAKwM+GCr0itqccvIlJgNMYvIlJglPhFRAqMEr+ISIFR4hcRKTBK/CIiBeb/AQ4ethMnGg6tAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"time_temp=np.array([[8,55],[9,58],[10,60],[11,65],[12,66],[13,67]])\n",
"def ambient_temp(time):\n",
" if time == 0:\n",
" Temp_amb = 65\n",
" elif 3 > time > 0:\n",
" Temp_amb = time_temp[time-3,1]\n",
" elif -4 < time < 0:\n",
" Temp_amb = time_temp[time+3,1]\n",
" else : \n",
" Temp_amb = 'unknown' \n",
" print('error')\n",
" return Temp_amb\n",
"plt.plot(time_temp[:,0],time_temp[:,1],'b-')\n",
"plt.xlabel('Time of Day')\n",
"plt.ylabel('Ambient Temp')\n",
"plt.title('Time Vs Ambient Temp')\n",
"ambient_temp(0)"
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-0.8489352983157284\n"
]
}
],
"source": [
"import math\n",
"import numpy as np\n",
"time_temp=np.array([[8,55],[9,58],[10,60],[11,65],[12,66],[13,67]])\n",
"def ambient_temp(time):\n",
" if time == 0:\n",
" Temp_amb = 65\n",
" elif 3 > time > 0:\n",
" Temp_amb = time_temp[time-3,1]\n",
" elif -4 < time < 0:\n",
" Temp_amb = time_temp[time+3,1]\n",
" else : \n",
" Temp_amb = 'unknown' \n",
" print('error')\n",
" return Temp_amb\n",
"T_a = ambient_temp(0)\n",
"T_o = 85\n",
"k = 0.6111111111111112\n",
"T_t = 98.6\n",
"t = (1/k)*np.log((T_a-T_o)/(T_a-T_t))\n",
"print(t)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}