{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ff3dc3d3-f1ba-4f76-8625-8832519245bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import sympy as sm"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7eb9455d-669d-40aa-9c71-2146373f1ff3",
   "metadata": {},
   "source": [
    "Homework 4 - NUCE 2100\n",
    "\n",
    "**Dane Sabo**\n",
    "\n",
    "*September 24th, 2024*"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1bf2efb4-39b4-4430-b544-4bd712b079ff",
   "metadata": {},
   "source": [
    "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)."
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "0c1ab609-7c1f-48cf-a360-42599f2f2b38",
   "metadata": {},
   "source": [
    "**Isotope Reaction Plots**\n",
    "Use the [Sigma tool](https://www.nndc.bnl.gov/sigma/) to answer questions 1--2. Plots can be generated by choosing your isotope and reaction and using the plot cart capability or using the “Basic Retrieval” tab.\n",
    "\n",
    "# Plot the total fission cross section, referred to as either (n, f) or (n, total fission), for $^{233}U$, $^{235}U$, $^{238}U$, $^{239}Pu$, and $^{241}Pu$.\n",
    "\n",
    "![plot1.png](plot1.png)\n",
    "\n",
    "## Based on these results explain why $^{233}U$, $^{235}U$, $^{239}Pu$, and $^{241}Pu$ are referred to as fissile and $^{238}U$ as fissionable.\n",
    "$^{233}U$, $^{235}U$, $^{239}Pu$, and $^{241}Pu$ are fissile materials because their total fission cross section (for the most part) remains above one. For the thermal neutron range, this value is several magnitudes larger than 1. This means that these isotopes will generate more neutrons in fission than required to fission in the first place. This self-sustaining chain reaction is what makes these isotopes fissile.\n",
    "\n",
    "$^{238}U$ on the other hand, is below 1 for nearly all values. This means that $^{238}U$ can fission, but it requires many more neutrons to make happen than it will release. This makes $^{238}U$ a neutron sink. Fission is possible, but not self-sustaining\n",
    "\n",
    "## Look at the dependence of the cross section on energy in this plot and discuss ways in which the fundamental properties of the naturally existing uranium isotopes ($^{235}U$ and $^{238}U$) have driven the design of the existing commercial reactor fleet.\n",
    "\n",
    "The neutron cross section of the reactor fuel can be tuned by designing the ratio of enrichment of $^{235}U$ to $^{238}U$. With this in mind, a reactor can be designed to have a predictable neutron production rate for a given fuel and conditions. Also, this cross section dependence on energy has driven commercial reactors to create designs that get neutrons from the high energy part of the chart to the thermal range, while avoiding interaction with the fuel while the neutrons are in the resonant cross section range of the isotopes.\n",
    "\n",
    "Notably, $^{235}U$ is the only fissile isotope that is primordial. That is, it doesn't need to be manufactured artificially because it is already in the uranium ore in the ground. This fact makes uranium a cheaper fuel compared to plutonium and other fissile materials.  \n",
    "\n",
    "# Plot the radiative capture cross section, denoted (n, $\\gamma$), and total reaction cross section, denoted (n, total), for the isotopes $^1H$ and $^2H$.\n",
    "\n",
    "![plot2.png](plot2.png)\n",
    "\n",
    "## In terms of the six-factor formula, use the capture cross sections to explain whether you would expect heavy water reactors to use higher or lower enriched fuel than light water reactors.\n",
    "\n",
    "Reactors using heavy water can use lower enriched fuels than light water reactors. This is because absorption is lower with deuterium compared to regular hydrogen. Using deuterium, $k_{eff}$ is effectively larger for the same fuel.\n",
    "\n",
    "## Based on the total cross sections explain whether the mean free path of a neutron will be larger in light or heavy water. Based on the mean free paths what type of reactor would you expect to have a larger physical footprint, a heavy or light water reactor? Pose your response in terms of the relevant factors in the six-factor formula\n",
    "\n",
    "The mean free path is larger with heavy water reactors, and thus heavy water reactors must be larger compared to light water reactors. This is because of the leakage probabilities of a heavy water and light water reactor. For both fast and thermal neutrons, there is a higher leakage probability per unit distance for heavy water than there is for light water. This is explicitly defined in the larger mean free path of heavy water. Because of this, there simply needs to be a larger thickness of heavy water to create the same leakage probability compared to a light water reactor.\n",
    "\n",
    "# Using the six-factor formula, describe the effect (increase, decrease, or neither) of the following changes (individually, not cumulatively) on $k_{eff}$ for a spherical bare (surrounded by vacuum) thermal reactor containing a homogeneous mixture of uranium and water. Note that you do not need to indicate the change in each factor in the formula, just the overall change and the dominant effect.\n",
    "\n",
    "## Surrounding the reactor with a highly-scattering material (e.g. water)\n",
    "\n",
    "Leakage probabilities are going to decrease, which will bring $k_{eff}$ an increase.\n",
    "\n",
    "## Surrounding the reactor with a strong thermal neutron absorber\n",
    "\n",
    "Leakage probabilities are going to increase, which will bring $k_{eff}$ a decrease.\n",
    "\n",
    "## Allowing the reactor to operate at a specified power level for 1 year\n",
    "\n",
    "Over time the enrichment will decrease, which will reduce the fission cross section, and decrease $k_{eff}$. \n",
    "\n",
    "## Lumping the fuel together into pins arranged in a regular lattice\n",
    "\n",
    "This will decrease absorption, as the neutrons will exit the high absorption cross section fuel and begin scattering in the intermittent moderator. This will lower the energy in the neutrons, increasing the fission cross section. These two effects will increase $k_{eff}$.\n",
    "\n",
    "## Changing the moderator from $^1H$ to $^{27}Al$\n",
    "\n",
    "![plot3.png](plot3.png)\n",
    "\n",
    "Looking at the plot of the absorption of $^1H$ compared to $^{27}Al$, we can see the aluminum will absorb a lot more fresh, high-energy neutrons. As a result, $k_{eff}$ is going to decrease.\n",
    "\n",
    "## Changing the shape to a cylinder\n",
    "\n",
    "Leakage probabilities are going to increase due to an increased surface-to-volume ratio. This will lower $k_{eff}$.\n",
    "\n",
    "## Lowering the fuel enrichment of $^{235}U$ (i.e. replacing some $^{235}U$ with $^{238}U$)\n",
    "\n",
    "This will reduce the total fission cross section. This will lower $k_{eff}$. \n",
    "\n",
    "## Another identical reactor is placed a short distance from the original reactor\n",
    "\n",
    "Because these reactors are in a vacuum, this will marginally increase $k_{eff}$ of both reactors. This is because neutrons escaping from one reactor may very well get caught by the other. So effectively, I suppose the leakage probabilities are lower.\n",
    "\n",
    "# What is the maximum value of the multiplication factor that can be achieved in any conceivable reactor design?\n",
    "\n",
    "The maximum multiplication factor is dependent on the absorption, production, and leakage. The maximum value is achieved when the maximum amount of neutrons escape resonance while also maximizing the neutron utilization in fission reactions. These two factors are then also multiplied by the escape probability. Perfecting these parameters will maximize the multiplication factor.\n",
    "\n",
    "# In the previous problem consider reducing the radius of the sphere by one half **while keeping the mass constant**. The effect of this is difficult to predict using the six-factor formula because the probability of neutron leakage (fast and thermal) depends on the material density of the core in addition to its geometric shape. To further explore this dependence:\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2b2da36e-2363-4f7c-8fe3-f63f0609312e",
   "metadata": {},
   "source": [
    "## Calculate the mean free path, $\\lambda$, for a neutron traveling in a homogeneous spherical reactor with radius r. The total mass of the reactor is given by m and the microscopic total cross section in the core is $\\sigma_t$. The average atomic mass in the reactor is A."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "88376900-ab9e-437a-97bd-5f824bce8694",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\lambda_{original} = \\frac{4 A \\pi r_{original}^{3}}{3 L m \\sigma_{t}}$"
      ],
      "text/plain": [
       "Eq(lambda_original, 4*A*pi*r_original**3/(3*L*m*sigma_t))"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lamb_1, r_1, sigma_t, A, m, L, pi = sm.symbols('lambda_original, r_original, sigma_t, A, m, L, pi', positive = True)\n",
    "one_third = sm.Rational(1, 3)\n",
    "#L = Avogadro's constant\n",
    "N = m/((1+one_third)*pi*r_1**3) / A * L #kg/m^3 * mol/kg * nuclei/mol\n",
    "mean_free_path = sm.Eq(lamb_1, 1/(sigma_t*N))\n",
    "mean_free_path"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1df9de17-eb73-43be-8855-67a70cb9cde8",
   "metadata": {},
   "source": [
    "## Express the radius in terms of neutron mean free paths ($r_{\\text{original}}$ / $\\lambda_{\\text{original}}$)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "bcd0ab02-1247-49d5-9567-1e737e9b3bc1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle r_{original} = \\frac{\\sqrt[3]{6} \\sqrt[3]{L} \\sqrt[3]{\\lambda_{original}} \\sqrt[3]{m} \\sqrt[3]{\\sigma_{t}}}{2 \\sqrt[3]{A} \\sqrt[3]{\\pi}}$"
      ],
      "text/plain": [
       "Eq(r_original, 6**(1/3)*L**(1/3)*lambda_original**(1/3)*m**(1/3)*sigma_t**(1/3)/(2*A**(1/3)*pi**(1/3)))"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r_eq = sm.Eq(r_1, (lamb_1*L*m*sigma_t/(1+one_third)/A/pi)**(one_third))\n",
    "r_eq"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "42b4dd30-ae5c-4b39-852a-90a80ede5097",
   "metadata": {},
   "source": [
    "$$r_{original} = \\sqrt[3]{\\frac{3 L m \\sigma_t \\lambda_{\\text{original}}}{4 A \\pi}}$$"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "537dfbbc-e60a-4a38-b40d-6ef0f411fc17",
   "metadata": {},
   "source": [
    "## Assuming that the reactor from part (a) is compressed such that the radius is halved while the original mass is preserved calculate the mean free path of a neutron in the compressed reactor."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "aa13feb1-28ce-4378-b2e1-97e3597b7d41",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\lambda_{new} = \\frac{A \\pi r_{original}^{3}}{6 L m \\sigma_{t}}$"
      ],
      "text/plain": [
       "Eq(lambda_new, A*pi*r_original**3/(6*L*m*sigma_t))"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lamb_2 = sm.symbols('lambda_new')\n",
    "N_new = m/((1+one_third)*pi*(r_1/2)**3) / A * L #kg/m^3 * mol/kg * nuclei/mol\n",
    "new_free_path = sm.Eq(lamb_2, 1/(sigma_t*N_new))\n",
    "new_free_path"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1854b29b-ab47-4b7d-b25e-7d282c0521f8",
   "metadata": {},
   "source": [
    "## Express the radius of the compressed reactor in terms of neutron mean free paths (rcompressed / λcompressed)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "834d4ab2-c494-4801-809f-603a85c3a2b9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle r_{original} = \\frac{6^{\\frac{2}{3}} \\sqrt[3]{L} \\sqrt[3]{\\lambda_{original}} \\sqrt[3]{m} \\sqrt[3]{\\sigma_{t}}}{2 \\sqrt[3]{A} \\sqrt[3]{\\pi}}$"
      ],
      "text/plain": [
       "Eq(r_original, 6**(2/3)*L**(1/3)*lambda_original**(1/3)*m**(1/3)*sigma_t**(1/3)/(2*A**(1/3)*pi**(1/3)))"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r_new_eq = sm.Eq(r_1, (6*lamb_1*L*m*sigma_t/(1+one_third)/A/pi)**(one_third))\n",
    "r_new_eq"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9fe58cdf-a954-4989-b05a-cdf8085f8da7",
   "metadata": {},
   "source": [
    "$$r_{new} = \\sqrt[3]{\\frac{9 L m \\sigma_t \\lambda_{\\text{original}}}{2 A \\pi}}$$\n",
    "\n",
    "## From the perspective of a neutron, what has happened to the size of the reactor (think in mean free paths)?\n",
    "\n",
    "The mean free path has gotten 6 times shorter, while the radius has only halved. As a result, the neutron things the reactor is 3 times bigger than it was previously.\n",
    "\n",
    "## What is the effect of the reactor compression on the probability of non-leakage? Using the six-factor formula, what is the effect of the compression on multiplication factor?\n",
    "\n",
    "Leakage has decreased because the mean free path relative to the size of the reactor has decreased. The neutron is more likely to have an interaction per unit length in this reactor than the uncompressed reactor. The effect of this is an increase in $k_{eff}$ as leakage probabilities decrease."
   ]
  }
 ],
 "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
}
