{
 "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": 1,
   "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 #calculate mass defect, micro amu to u\n",
    "    energy = (mass_defect*1.6606e-27)*c**2 #convert amu to kg, answer in J\n",
    "\n",
    "    return energy*6.242e12 #Convert J to MeV, and return value\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": 2,
   "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",
    "#Calculate difference in mass of products - reactants, mulitply by c^2\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": 3,
   "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": [
    "---\n",
    "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": 4,
   "id": "f47d7c3a-83fc-4f71-9db0-d227946635ff",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A: Average 6Li Binding Energy: 5.332946257554306 MeV per nucleon\n",
      "B: Average 12C Binding Energy: 7.681030488461077 MeV per nucleon\n",
      "C: Average 51V Binding Energy: 8.743093705441115 MeV per nucleon\n",
      "D: Average 138Ba Binding Energy: 8.394390417035352 MeV per nucleon\n",
      "E: Average 235U Binding Energy: 7.5917907582946915 MeV per nucleon\n"
     ]
    }
   ],
   "source": [
    "#For each part, find the binding energy of the nuclide, then divde by the number of nucleons.\n",
    "\n",
    "sixLi_mass = 6015122.8874 #micro AMU\n",
    "print(\"A: Average 6Li Binding Energy:\", binding_energy(sixLi_mass,3,3)/6, \"MeV per nucleon\")\n",
    "\n",
    "twelveC_mass = 12000000.0 #micro AMU\n",
    "print(\"B: Average 12C Binding Energy:\", binding_energy(twelveC_mass,6,6)/12, \"MeV per nucleon\")\n",
    "\n",
    "fiftyoneV_mass = 50943957.66 #micro AMU\n",
    "print(\"C: Average 51V Binding Energy:\", binding_energy(fiftyoneV_mass,23,28)/51, \"MeV per nucleon\")\n",
    "\n",
    "onethirtyeightBa_mass = 137905247.06 #micro AMU\n",
    "print(\"D: Average 138Ba Binding Energy:\", binding_energy(onethirtyeightBa_mass,56,82)/138, \"MeV per nucleon\")\n",
    "\n",
    "twothirtyfiveU_mass = 235043928.1  #micro AMU\n",
    "print(\"E: Average 235U Binding Energy:\", binding_energy(twothirtyfiveU_mass,92,143)/235, \"MeV per nucleon\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df1603d2-3e2c-463f-93eb-bd9aa1514314",
   "metadata": {},
   "source": [
    "---\n",
    "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": 5,
   "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": [
    "---\n",
    "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": 6,
   "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",
    "#Take the density of graphite, divide by 12.000 g 12C / mole, then multiply by Avogadro's Number to get to atoms\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",
    "#Follow the formula from the slides, where we are converting Barns to cm.\n",
    "print(\"The mean free path is \",mean_free_path,\"cm in graphite.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2097a2cb-619e-410e-bfad-a5ca91849cbc",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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
}
