{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "153bfedd-a63f-47f7-be65-4d8c006600e4",
   "metadata": {},
   "source": [
    "# Homework 2\n",
    "## NUCE 2100\n",
    "### Dane Sabo\n",
    "\n",
    "---\n",
    "\n",
    "Instructions: Complete the problems below being sure to show your work. If you need to lookup nuclear data from an external source please reference the source in your solutions (once is sufficient).\n",
    "\n",
    "---\n",
    "\n",
    "1. Consider the so-called DT (deuterium, tritium) fusion reaction\n",
    "\n",
    "$^2H + ^3H \\rightarrow ^HHe + ?$\n",
    "\n",
    "a. What is the missing product in the reaction?\n",
    "\n",
    "    A neutron!\n",
    "\n",
    "b. Calculate the binding energy of $^2H$, $^{3}H$, and $^{4}He$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "88d5e8eb-f0d6-4397-bcda-98c112bc6bc1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2H Binding Energy: 2.22482284320947 MeV\n",
      "3H Binding Energy: 8.482774677373571 MeV\n",
      "4He Binding Energy: 28.298926363869242 MeV\n"
     ]
    }
   ],
   "source": [
    "def binding_energy(mass,z,n):\n",
    "    c = 299792458 # m/s\n",
    "    h1_mass = 1007825.03190 #micro AMU\n",
    "    neutron_mass = 1008664.9159 #mirco AMU\n",
    "\n",
    "    mass_defect = (z*h1_mass + n*neutron_mass - mass)/1e6 #micro amu to u\n",
    "    energy = (mass_defect*1.6606e-27)*c**2 #amu to kg, answer in J\n",
    "\n",
    "    return energy*6.242e12 #Convert J to MeV\n",
    "    \n",
    "twoH_mass = 2014101.77784 #micro AMU\n",
    "print(\"2H Binding Energy:\", binding_energy(twoH_mass,1,1), \"MeV\")\n",
    "\n",
    "threeH_mass = 3016049.281328 #micro AMU\n",
    "print(\"3H Binding Energy:\", binding_energy(threeH_mass,1,2), \"MeV\")\n",
    "\n",
    "fourHe_mass = 4002603.25413 #micro AMU\n",
    "print(\"4He Binding Energy:\", binding_energy(fourHe_mass,2,2), \"MeV\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6eb8cf35-13c1-44ea-981a-17f9676e5c0e",
   "metadata": {},
   "source": [
    "c. Calculate the Q value of the reaction"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "0e86e84b-0551-4409-9fb5-c1fc0b269634",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Q is  -17.59132884328642 MeV\n"
     ]
    }
   ],
   "source": [
    "neutron_mass = 1008664.9159 #mirco AMU\n",
    "c = 299792458 # m/s\n",
    "\n",
    "Q = (fourHe_mass + neutron_mass - twoH_mass - threeH_mass)/1e6*1.6606e-27 * c**2\n",
    "print(\"Q is \", Q*6.242e12, \"MeV\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a1786156-6aca-4a89-806d-2d59748519f5",
   "metadata": {},
   "source": [
    "d. Show that the Q value is equal to the change in binding energy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "0f396ef3-e47d-42fd-8952-31b1fc7692f8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Q from binding is  -17.5913288432862 MeV\n"
     ]
    }
   ],
   "source": [
    "Q_from_binding = binding_energy(threeH_mass,1,2) + binding_energy(twoH_mass,1,1) - binding_energy(fourHe_mass,2,2)\n",
    "print(\"Q from binding is \", Q_from_binding, \"MeV\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e8108f30-f807-4f83-90b8-ce1092404284",
   "metadata": {},
   "source": [
    "2. Using atomic mass data, compute the average binding energy per nucleon of the following\n",
    "nuclei:\n",
    "\n",
    "a. $^{6}Li$\n",
    "\n",
    "b. $^{12}C$\n",
    "\n",
    "c. $^{51}V$\n",
    "\n",
    "d. $^{138}Ba$\n",
    "\n",
    "e. $^{235}U$\n",
    "\n",
    "[Atomic Mass Data](https://www-nds.iaea.org/relnsd/vcharthtml/VChartHTML.html)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "f47d7c3a-83fc-4f71-9db0-d227946635ff",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6Li Binding Energy: 31.997677545325832 MeV\n",
      "12C Binding Energy: 92.17236586153292 MeV\n",
      "51V Binding Energy: 445.8977789774969 MeV\n",
      "138Ba Binding Energy: 1158.4258775508786 MeV\n",
      "235U Binding Energy: 1784.0708281992524 MeV\n"
     ]
    }
   ],
   "source": [
    "sixLi_mass = 6015122.8874 #micro AMU\n",
    "print(\"6Li Binding Energy:\", binding_energy(sixLi_mass,3,3), \"MeV\")\n",
    "\n",
    "twelveC_mass = 12000000.0 #micro AMU\n",
    "print(\"12C Binding Energy:\", binding_energy(twelveC_mass,6,6), \"MeV\")\n",
    "\n",
    "fiftyoneV_mass = 50943957.66 #micro AMU\n",
    "print(\"51V Binding Energy:\", binding_energy(fiftyoneV_mass,23,28), \"MeV\")\n",
    "\n",
    "onethirtyeightBa_mass = 137905247.06 #micro AMU\n",
    "print(\"138Ba Binding Energy:\", binding_energy(onethirtyeightBa_mass,56,82), \"MeV\")\n",
    "\n",
    "twothirtyfiveU_mass = 235043928.1  #micro AMU\n",
    "print(\"235U Binding Energy:\", binding_energy(twothirtyfiveU_mass,92,143), \"MeV\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df1603d2-3e2c-463f-93eb-bd9aa1514314",
   "metadata": {},
   "source": [
    "3. Compute the atom densities of $^{235}U$ and $^{238}U$ in UO2 of physical density 10.8 g/cm3 if the uranium\n",
    "is enriched to 3.5 w/o in $^{235}U$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "5200a68d-12a0-4638-9059-43e31478c412",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "There are  8.900646006519835e+21  235U atoms per cm^3\n",
      "There are  3.187437478703836e+20  238U atoms per cm^3\n"
     ]
    }
   ],
   "source": [
    "twothirtyeightU_mass = 238050786.9 # micro AMU\n",
    "UO2_density = 10.8 #g/cm^3\n",
    "\n",
    "N_235 = (100-3.5)/3/100 * UO2_density*0.6022e24/(twothirtyfiveU_mass*1e-6)\n",
    "#(abundance of U235 in UO2, remember only 1 U for every 2 O!) * converting to atoms / cm^3\n",
    "print(\"There are \", N_235, \" 235U atoms per cm^3\")\n",
    "\n",
    "N_238 = (3.5)/3/100 * UO2_density*0.6022e24/(twothirtyeightU_mass*1e-6)\n",
    "print(\"There are \", N_238, \" 238U atoms per cm^3\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df698b09-ce8d-4b38-92c7-0d96765e1b25",
   "metadata": {},
   "source": [
    "4. Calculate the mean free path of 1-eV neutrons in graphite. The total cross section of carbon at\n",
    "this energy is 4.8 b.\n",
    "\n",
    "[Graphite Density Source](https://www.nrc.gov/docs/ML0117/ML011770379.pdf)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "f164a50e-b97a-4f8a-b436-81bd0f20075a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The nuclei density of graphite is  9.133366666666668e+22  atoms/cm^3\n",
      "The mean free path is  0.22810135729431646 cm in graphite.\n"
     ]
    }
   ],
   "source": [
    "graphite_density = 1.82 #g/cm^3\n",
    "graphite_nuclei_density = graphite_density/12.000*0.6022e24 #atoms/cm^3\n",
    "print(\"The nuclei density of graphite is \",graphite_nuclei_density,\" atoms/cm^3\")\n",
    "\n",
    "mean_free_path = 1/(4.8*10e-24)/graphite_nuclei_density\n",
    "print(\"The mean free path is \",mean_free_path,\"cm in graphite.\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
