<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>JCTree</title>
    <subtitle>A collection of my personal projects</subtitle>
    <link rel="self" type="application/atom+xml" href="https://jctree.gitlab.io/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://jctree.gitlab.io"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-05-31T00:00:00+00:00</updated>
    <id>https://jctree.gitlab.io/atom.xml</id>
    <entry xml:lang="en">
        <title>Revisions for TOFE 2026 Plots</title>
        <published>2026-05-31T00:00:00+00:00</published>
        <updated>2026-05-31T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://jctree.gitlab.io/tofe26/"/>
        <id>https://jctree.gitlab.io/tofe26/</id>
        
        <content type="html" xml:base="https://jctree.gitlab.io/tofe26/">&lt;div&gt;

    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;tofe26&#x2F;energy.png&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;energy.6649addfb9e2a934.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;tofe26&#x2F;flux.png&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;flux.60735ac93212b6e4.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;div&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>The Nodal Expansion Method</title>
        <published>2025-11-29T10:40:00+00:00</published>
        <updated>2025-11-29T10:40:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://jctree.gitlab.io/nem/"/>
        <id>https://jctree.gitlab.io/nem/</id>
        
        <content type="html" xml:base="https://jctree.gitlab.io/nem/">&lt;p&gt;This page is under construction. If it seems incomplete, it is, but feel free to
enjoy what is already here. This page has an accompanying toy nodal expansion
method code, which lives &lt;a href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;JCTree&#x2F;nem_solver&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;transport-equation&quot;&gt;Transport Equation&lt;&#x2F;h1&gt;
&lt;p&gt;The neutron transport equation defines the balance of neutron creation and
neutron removal processes from a volume $V$. For a system with no external
source, the time rate of change of the flux is given by
$$
\begin{align}
\frac{1}{v}\frac{\partial\phi}{\partial t}&amp;amp;=
\int\limits_{4\pi}\int\limits_0^\infty
\Sigma_s(\vec r,E’\rightarrow E,\hat\Omega’\rightarrow\hat\Omega,t)
\phi(\vec r,E’,\hat\Omega’,t)dE’d\hat\Omega’ \\
&amp;amp;+\frac{\chi(E)}{4\pi}\int\limits_0^\infty
\nu(E’)\Sigma_f(\vec r,E’,t)\phi(\vec r,E’,\hat\Omega,t)dE’ \\
&amp;amp;+\frac{1}{4\pi}\sum\limits_f\chi_f(E)\lambda_fC_f(\vec r,t) \\
&amp;amp;-\hat\Omega\cdot\nabla\phi(\vec r,E,\hat\Omega,t) \\
&amp;amp;-\Sigma_t(\vec r,E,t)\phi(\vec r,E,\hat\Omega,t)
\end{align}
$$
where&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$v$ is the neutron velocity&lt;&#x2F;li&gt;
&lt;li&gt;$\phi$ is the neutron flux, and is a function of position, energy, angle, and
time&lt;&#x2F;li&gt;
&lt;li&gt;$\Sigma_s$ is the scattering cross section, and is a function of position,
energy, angle, and time&lt;&#x2F;li&gt;
&lt;li&gt;$\chi(E)$ is the probability a neutron produced from fission was produced at
energy $E$&lt;&#x2F;li&gt;
&lt;li&gt;$nu$ is the average number of neutrons produced in a fission event, and is a
function of incident neutron energy&lt;&#x2F;li&gt;
&lt;li&gt;$\Sigma_f$ is the fission cross section, and is a function of position,
energy, and time&lt;&#x2F;li&gt;
&lt;li&gt;$\chi_f(E)$ is the probability a decay neutron from fission product $f$ is
emitted at energy $E$&lt;&#x2F;li&gt;
&lt;li&gt;$\lambda_f$ is the decay constant of fission product $f$&lt;&#x2F;li&gt;
&lt;li&gt;$C_f$ is the concentration of fission product $f$, and is a function of
position and time&lt;&#x2F;li&gt;
&lt;li&gt;$\Sigma_t$ is the total cross section, and is a function of position, neutron
energy, and time&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;On the right-hand side of the equation, there are positive terms that represent
neutron gains in the system, and negative terms that represent neutron losses in
the system. At this point, let us consider the flux of neutrons with a fixed
energy $E$ and direction $\hat\Omega$ at the point $\vec r$ in space. The first
term on the right-hand side of the transport equation is the in-scattering
source, where neutrons at a different angle and energy scatter into our energy
$E$ and angle $\hat\Omega$. The next term describes the neutrons produced at our
position, angle, and energy from fission. The final gain term is the production
of neutrons from the decay of radioactive fission products. The first loss term
is the leakage of neutrons away from our position $\vec r$. The other loss term
simply represents neutrons being removed from our position, angle, or energy
from suffering an interaction in matter.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;discretization-of-the-transport-equation&quot;&gt;Discretization of the Transport Equation&lt;&#x2F;h1&gt;
&lt;p&gt;The full time-dependent neutron transport equation is very difficult to solve.
There are many different approximations to the transport equation that are
available which allow it to be calculated. One such approximation is to assume
that the angular distribution does not strongly effect the solution. To do this,
we integrate the transport equation over all angles to get
$$
\begin{align}
\frac{1}{v}\frac{\partial\phi}{\partial t}&amp;amp;=
\int\limits_0^\infty\Sigma_s(E’\rightarrow E)\phi(\vec r,E’,t) \\
&amp;amp;+\frac{\chi(E)}{4\pi}\int\limits_0^\infty
\nu(E’)\Sigma_f(\vec r,E’,t)\phi(\vec r,E’,t)dE’ \\
&amp;amp;+\frac{1}{4\pi}\sum\limits_f\chi_f(E)\lambda_fC_f(\vec r,t) \\
&amp;amp;-\int\limits_{4\pi}
\hat\Omega\cdot\nabla\phi(\vec r,E,\hat\Omega,t)d\hat\Omega \\
&amp;amp;-\Sigma_t(\vec r,E,t)\phi(\vec r,E,t)
\end{align}
$$
We can then use the divergence theorem on the first loss term, which yields the
neutron continuity equation:
$$
\begin{align}
\frac{1}{v}\frac{\partial\phi}{\partial t}&amp;amp;=
\int\limits_0^\infty\Sigma_s(E’\rightarrow E)\phi(\vec r,E’,t) \\
&amp;amp;+\frac{\chi(E)}{4\pi}\int\limits_0^\infty
\nu(E’)\Sigma_f(\vec r,E’,t)\phi(\vec r,E’,t)dE’ \\
&amp;amp;+\frac{1}{4\pi}\sum\limits_f\chi_f(E)\lambda_fC_f(\vec r,t) \\
&amp;amp;-\nabla\cdot\vec J(\vec r,E,t) \\
&amp;amp;-\Sigma_t(\vec r,E,t)\phi(\vec r,E,t)
\end{align}
$$
where $\vec J$ is the neutron current.&lt;&#x2F;p&gt;
&lt;p&gt;Next, we discretize the equation in energy. We say that our energy spectrum is
divided up into $G$ groups, where the properties within each group $g$ are
approximated to be constant. This allows us to rewrite the continuity equation
as
$$
\frac{1}{v}\frac{\partial\phi_g}{\partial t}
+\nabla\cdot\vec J_g(\vec r,t)
+(\Sigma_{t,g}(\vec r,t)-\Sigma_{s,g}(\vec r,t))\phi_g(\vec r,t)
=Q_g(\vec r,t)
$$
where the gain terms have been combined into a single source term $Q$.&lt;&#x2F;p&gt;
&lt;p&gt;At this point, we will choose to solve a steady-state problem, meaning that the
time dependence of the terms can be removed. In order to solve this, we also
need to discretize our problem in space. Dividing space into cubes turns out to
be convenient. Each cube in space is approximated to have constant properties.
We call one of these cubes a node, and denote a specific node as $k$. This leads
us to the following form of the diffusion equation:
$$
\nabla\cdot\vec J^k_g+\Sigma^k_{r,g}\phi^k_g=Q^k_g
$$
where we use the removal cross section, defined as
$$
\Sigma^k_{r,g}=\Sigma^k_{a,g}
+\sum\limits^G_{g’\neq g}\Sigma^k_{s,g\rightarrow g’}
$$
and
$$
Q^k_g(\vec{r})=\frac{\chi_g}{k_{eff}}
\sum\limits_{g’=1}^G\nu\Sigma_{f,g’}^k\phi^k_{g’}(\vec{r})+
\sum\limits_{g’\neq g}^G\Sigma^k_{s,g’\rightarrow g}\phi^k_{g’}(\vec{r})
$$
This is the starting point of the derivation in &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;nem&#x2F;#okumura&quot;&gt;Okumura, 1998&lt;&#x2F;a&gt;, which
is roughly translated in the following section.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;the-diffusion-approximation&quot;&gt;The Diffusion Approximation&lt;&#x2F;h1&gt;
&lt;p&gt;We now introduce another approximation by assuming that the relationship between
the flux and the current follow &lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fick%27s_laws_of_diffusion&quot;&gt;Fick’s
Law&lt;&#x2F;a&gt;. This can be
expressed as
$$
\vec J_g(\vec r,t)=-D_g(\vec r)\nabla\phi_g(\vec r,t)
$$
We will use Fick’s Law in the following sections to eliminate an unknown (the
current) in a system of equations, a common result in an introductory reactor
physics course.&lt;&#x2F;p&gt;
&lt;p&gt;As an aside, plugging this into the continuity equation gives the diffusion
equation:
$$
\frac{1}{v}\frac{\partial\phi}{\partial t}-
\nabla\cdot D_g(\vec r)\nabla\phi_g(\vec r,t)
+\Sigma_{a,g}(\vec r,t)\phi_g(\vec r,t)=Q_g(\vec r,t)
$$&lt;&#x2F;p&gt;
&lt;h1 id=&quot;nodal-balance&quot;&gt;Nodal Balance&lt;&#x2F;h1&gt;
&lt;p&gt;We define the center of our node $k$ to be $(0,0,0)$. Therefore, the node spans
the space $-\frac{\Delta x}{2}&amp;lt;x&amp;lt;\frac{\Delta x}{2}$, $-\frac{\Delta
y}{2}&amp;lt;y&amp;lt;\frac{\Delta y}{2}$, $-\frac{\Delta z}{2}&amp;lt;z&amp;lt;\frac{\Delta z}{2}$. “+” and
“-” are used to denote the face of the node with a positive or negative
component, respectively. Now, we expand the divergence of the current in the
diffusion equation, integrate over the node, and divide by the node volume. This
results in the node balance equation, given by
$$
\frac{1}{\Delta_x^k}\left(J^k_{g,x+}-J^k_{g,x-}\right)+
\frac{1}{\Delta_y^k}\left(J^k_{g,y+}-J^k_{g,y-}\right)+
\frac{1}{\Delta_z^k}\left(J^k_{g,z+}-J^k_{g,z-}\right)+
\Sigma^k_{rg}\phi^k_{g,0}=Q^k_{g,0}
$$
where we defined
$$
\phi^k_{g,0}=\frac{1}{\Delta^k_x\Delta^k_y\Delta^k_z}
\int\limits^{\Delta^k_x&#x2F;2}_{-\Delta^k_x&#x2F;2}
\int\limits^{\Delta^k_y&#x2F;2}_{-\Delta^k_y&#x2F;2}
\int\limits^{\Delta^k_z&#x2F;2}_{-\Delta^k_z&#x2F;2}
\phi^k_g(x,y,z)dxdydz
$$
and
$$
J^k_{g,x\pm}=\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits^{\Delta^k_y&#x2F;2}_{-\Delta^k_y&#x2F;2}
\int\limits^{\Delta^k_z&#x2F;2}_{-\Delta^k_z&#x2F;2}
J^k_g\left(\pm\frac{\Delta^k_x}{2},y,z\right)dydz
$$
and
$$
\begin{align}
Q^k_{g,0}&amp;amp;=\frac{1}{\Delta^k_x\Delta^k_y\Delta^k_z}
\int\limits^{\Delta^k_x&#x2F;2}_{-\Delta^k_x&#x2F;2}
\int\limits^{\Delta^k_y&#x2F;2}_{-\Delta^k_y&#x2F;2}
\int\limits^{\Delta^k_z&#x2F;2}_{-\Delta^k_z&#x2F;2}
Q^k_g(x,y,z)dxdydz \\
&amp;amp;=\frac{1}{\Delta^k_x\Delta^k_y\Delta^k_z}
\int\limits^{\Delta^k_x&#x2F;2}_{-\Delta^k_x&#x2F;2}
\int\limits^{\Delta^k_y&#x2F;2}_{-\Delta^k_y&#x2F;2}
\int\limits^{\Delta^k_z&#x2F;2}_{-\Delta^k_z&#x2F;2}
\left(\frac{\chi_g}{k_{eff}}
\sum\limits_{g’=1}^G\nu\Sigma_{fg’}^k\phi^k_{g’}(x,y,z)+
\sum\limits_{g’\neq g}^G\Sigma^k_{sg’\rightarrow g}\phi^k_{g’}(x,y,z)
\right)dxdydz \\
&amp;amp;=\frac{\chi_g}{k_{eff}}
\sum\limits_{g’=1}^G\nu\Sigma_{fg’}^k\phi^k_{g’,0}+
\sum\limits_{g’\neq g}^G\Sigma^k_{sg’\rightarrow g}\phi^k_{g’,0}
\end{align}
$$
The $y$ and $z$ currents are defined in the same way as the $x$ current. In
order to reduce the number of variables, we would like to reduce the number of
unknowns. One approximation often made to neutron transport is the application
of &lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fick%27s_laws_of_diffusion&quot;&gt;Fick’s Law&lt;&#x2F;a&gt;, which
relates the current to the flux as
$$
\vec J^k_g=-D^k_g\nabla\phi^k_g
$$
Plugging this into the definition of the $x$ current yields
$$
J^k_{g,x\pm}=\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits^{\Delta^k_y&#x2F;2}_{-\Delta^k_y&#x2F;2}
\int\limits^{\Delta^k_z&#x2F;2}_{-\Delta^k_z&#x2F;2}
-D^k_{g,x}\frac{\partial}{\partial x}\phi^k_g(x,y,z)
\biggr|_{x=\pm\Delta^k_x&#x2F;2}dydz
$$&lt;&#x2F;p&gt;
&lt;p&gt;The node balance equation is expressed in terms of the volume-averaged neutron
flux within a node, denoted as $\phi^k_{g,0}$, and the surface-averaged net
neutron currents across the six faces of the node. To proceed, we introduce the
concepts of surface-averaged neutron flux and surface-averaged partial neutron
currents. Within diffusion theory, the partial neutron currents are typically
defined using the P1 approximation of the angular neutron flux, as shown below.
$$
\begin{align}
J^{out}_g(\vec{r})&amp;amp;=\frac{\phi_g(\vec{r})}{4}-
\frac{D_g}{2}\hat{e}_s\cdot\nabla\phi(\vec{r}) \\
J^{in}_g(\vec{r})&amp;amp;=\frac{\phi_g(\vec{r})}{4}+
\frac{D_g}{2}\hat{e}_s\cdot\nabla\phi(\vec{r})
\end{align}
$$
Here, $\hat{e}_s$ represents the unit outward normal vector to the surface
under consideration. The outgoing partial neutron current in the direction of
this outward normal vector is denoted as $J^{out}$, while the incoming partial
neutron current, flowing in the opposite direction, is denoted as $J^{in}$. The
partial current leaving the x+ surface is therefore
$$
J^{out,k}_{g,x+}=\frac{1}{4}\phi^k_{g,x+}+\frac{1}{2}
\left[
\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits^{\Delta^k_y&#x2F;2}_{-\Delta^k_y&#x2F;2}
\int\limits^{\Delta^k_z&#x2F;2}_{-\Delta^k_z&#x2F;2}
-D^k_{g,x}\frac{\partial}{\partial x}\phi^k_g(x,y,z)
\biggr|_{x=\Delta^k_x&#x2F;2}dydz
\right]
$$
where $\phi^k_{g,x+}$ is the surface-averaged neutron flux on the $k+$ interface
of the positive $x$ surface of the node.
$$
\phi_{g,x+}^{k}=\frac{1}{\Delta_y^k\Delta_z^k}
\int\limits_{-\Delta_y^k&#x2F;2}^{\Delta_y^k&#x2F;2}
\int\limits_{-\Delta_z^k&#x2F;2}^{\Delta_z^k&#x2F;2}
\phi^{k}_g\left(\frac{\Delta_x^k}{2},y,z\right)dydz
$$&lt;&#x2F;p&gt;
&lt;p&gt;The term in the square brackets is the definition of $J^k_{g,x+}$ from above.
Substituting this in gives that
$$
J^{out,k}_{g,x+}=\frac{1}{4}\phi^k_{g,x+}+\frac{1}{2}J^k_{g,x+} \
$$
Similarly, since the only difference in the definition of the incoming current
from the P1 approximation is the sign flip, we can show that
$$
J^{in,k}_{g,x+}=\frac{1}{4}\phi^k_{g,x+}-\frac{1}{2}J^k_{g,x+}
$$
Adding and subtracting these two equations gives expressions for the current and
flux at the $x+$ surface of the node:
$$
\begin{align}
J^k_{g,x+}&amp;amp;=J^{out,k}_{g,x+}-J^{in,k}_{g,x+} \\
\phi^k_{g,x+}&amp;amp;=2(J^{out,k}_{g,x+}+J^{in,k}_{g,x+})
\end{align}
$$
Mirroring these calculations for the $x-$ surface yields
$$
\begin{align}
J^k_{g,x-}&amp;amp;=J^{in,k}_{g,x-}-J^{out,k}_{g,x-} \\
\phi^k_{g,x-}&amp;amp;=2(J^{out,k}_{g,x-}+J^{in,k}_{g,x-})
\end{align}
$$
This allows us to rewrite the node balance equation using the incoming and
outgoing currents.
$$
\begin{align}
\frac{1}{\Delta^k_x}
(J^{out,k}_{g,x+}-J^{in,k}_{g,x+}-J^{in,k}_{g,x-}+J^{out,k}_{g,x-})
&amp;amp;+\frac{1}{\Delta^k_y}
(J^{out,k}_{g,y+}-J^{in,k}_{g,y+}-J^{in,k}_{g,y-}+J^{out,k}_{g,y-})
\nonumber \\
&amp;amp;+\frac{1}{\Delta^k_z}
(J^{out,k}_{g,z+}-J^{in,k}_{g,z+}-J^{in,k}_{g,z-}+J^{out,k}_{g,z-})+
\Sigma^k_{r,g}\phi^k_{g,0}=Q^k_{g,0}
\end{align}
$$&lt;&#x2F;p&gt;
&lt;p&gt;We do this because it allows us to split up the calculation. I will show in a
later section that we can solve for the outgoing current on each surface of a
node from the values of the incoming currents. This allows a two-step iteration
strategy. First, we calculate the outgoing current for each node from its
incoming current. The outgoing current for each node is used to update the
incoming currents of the adjacent nodes. We can iterate this until the system
of nodes is balanced to converge on a solution.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;transverse-integration&quot;&gt;Transverse Integration&lt;&#x2F;h1&gt;
&lt;p&gt;In order to reduce the solution complexity, we derive a one dimensional
diffusion equation by integrating over the transverse directions. This is
performed for each direction, yielding three equations toward the solution. The
steps to derive the diffusion equation in x are roughly outlined in this
section. The same steps can be equivalently followed for integration in the y
and z directions as well.&lt;&#x2F;p&gt;
&lt;p&gt;Earlier, we derived a special form of the diffusion equation.
$$
\nabla\cdot\vec J^k_g+\Sigma^k_{r,g}\phi^k_g=Q^k_g
$$
We can expand the divergence of the current and integrate with respect to y and
z within the node. Dividing by the area $\Delta_y^k\Delta_z^k$ then yields the
following:
$$
\begin{align}
&amp;amp;\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits_{-\Delta_y^k&#x2F;2}^{\Delta_y^k&#x2F;2}
\int\limits_{-\Delta_z^k&#x2F;2}^{\Delta_z^k&#x2F;2}
\frac{\partial}{\partial x}J^k_{g,x}(x,y,z)dydz
+\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits_{-\Delta_y^k&#x2F;2}^{\Delta_y^k&#x2F;2}
\int\limits_{-\Delta_z^k&#x2F;2}^{\Delta_z^k&#x2F;2}
\frac{\partial}{\partial y}J^k_{g,y}(x,y,z)dydz \nonumber \\
+&amp;amp;\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits_{-\Delta_y^k&#x2F;2}^{\Delta_y^k&#x2F;2}
\int\limits_{-\Delta_z^k&#x2F;2}^{\Delta_z^k&#x2F;2}
\frac{\partial}{\partial z}J^k_{g,z}(x,y,z)dydz
+\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits_{-\Delta_y^k&#x2F;2}^{\Delta_y^k&#x2F;2}
\int\limits_{-\Delta_z^k&#x2F;2}^{\Delta_z^k&#x2F;2}
\Sigma^k_{r,g}\phi^k_g(x,y,z)dydz \nonumber \\
=&amp;amp;\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits_{-\Delta_y^k&#x2F;2}^{\Delta_y^k&#x2F;2}
\int\limits_{-\Delta_z^k&#x2F;2}^{\Delta_z^k&#x2F;2}
Q^k_g(x,y,z)dydz
\end{align}
$$
which can be simplified to:
$$
\begin{equation}
\frac{d}{dx}\bar J^k_{g,x}(x)+\Sigma^k_{r,g}\bar\phi^k_{g,x}(x)
=\bar Q^k_{g,x}(x)-\frac{1}{\Delta^k_y}\bar L^k_{g,y}(x)
-\frac{1}{\Delta^k_z}\bar L^k_{g,z}(x)
\end{equation}
$$
where
$$
\begin{align}
\bar\phi^{k}_{g,x}(x)&amp;amp;=\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits_{-\Delta_y^k&#x2F;2}^{\Delta_y^k&#x2F;2}
\int\limits_{-\Delta_z^k&#x2F;2}^{\Delta_z^k&#x2F;2}
\phi^k_g(x,y,z)dydz \nonumber \\
\bar J^{k}_{g,x}(x)&amp;amp;=\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits_{-\Delta_y^k&#x2F;2}^{\Delta_y^k&#x2F;2}
\int\limits_{-\Delta_z^k&#x2F;2}^{\Delta_z^k&#x2F;2}
J^k_g(x,y,z)dydz \nonumber \\
\bar Q^k_{g,x}(x)&amp;amp;=\frac{1}{\Delta^k_y\Delta^k_z}
\int\limits_{-\Delta_y^k&#x2F;2}^{\Delta_y^k&#x2F;2}
\int\limits_{-\Delta_z^k&#x2F;2}^{\Delta_z^k&#x2F;2}
Q^k_g(x,y,z)dydz \nonumber \\
&amp;amp;=\frac{\chi^k_g}{k}
\sum\limits_{g’=1}^{G}\nu\Sigma^{k}_{f,g’}\bar\phi^k_{g’}(x)+
\sum\limits_{g’\neq g}^{G}\Sigma^{k}_{s,g’\rightarrow g}
\bar\phi^k_{g’}(x) \\
\bar L^{k}_{g,y}(x)&amp;amp;=\frac{1}{\Delta^k_z}
\int\limits_{-\Delta_z^k&#x2F;2}^{\Delta_z^k&#x2F;2}\left[
-D^k_{g,y}\frac{\partial\phi^k_g(x,y,z)}{\partial y}
\right]^{\Delta^k_y&#x2F;2}_{-\Delta^k_y&#x2F;2}dz \nonumber \\
\bar L^{k}_{g,z}(x)&amp;amp;=\frac{1}{\Delta^k_y}
\int\limits_{-\Delta_{y}^{k}&#x2F;2}^{\Delta_{y}^{k}&#x2F;2}\left[
-D^k_{g,z}\frac{\partial\phi^{k}_{g}(x,y,z)}{\partial z}
\right]^{\Delta^k_z&#x2F;2}_{-\Delta^k_z&#x2F;2}dy
\end{align}
$$
are the parameters averaged over the area of the node.&lt;&#x2F;p&gt;
&lt;p&gt;Similar equations can be written for the y and z directions. This is the
transverse-integrated one-dimensional neutron balance equation. The equation is
a one-dimensional diffusion equation with transverse leakage terms.&lt;&#x2F;p&gt;
&lt;p&gt;We can now write Fick’s Law in the x-direction averaged over a node.
$$
\begin{equation}
\bar J^k_{g,x}(x)=-D^k_{g,x}\frac{d}{dx}\bar\phi^k_{g,x}(x)
\end{equation}
$$
and similarly for the y and z directions. Substituting these into the 1D
diffusion equation with transverse leakage terms results in the following
one-dimensional diffusion equation.
$$
\begin{equation}
-D^k_{g,x}\frac{d^2}{dx^2}\bar\phi^k_{g,x}(x)+
\Sigma^k_{r,g}\bar\phi^k_{g,x}(x)
=\bar Q^k_{g,x}(x)-\frac{1}{\Delta^k_y}\bar L^k_{g,y}(x)
-\frac{1}{\Delta^k_z}\bar L^k_{g,z}(x)
\end{equation}
$$&lt;&#x2F;p&gt;
&lt;!---
# Nodal Expansion Method

$$
  a^k_{x1}=\phi^k_{x+}-\phi^k_{x-}
$$
$$
  a^k_{x2}=\phi^k_{x+}-\phi^k_{x-}-2\phi^k_0
$$
$$
  a^k_{x3}=10\phi^k_{x+}-10\phi^k_{x-}-120\phi^k_{x1}
$$
$$
  a^k_{x4}=35\phi^k_{x+}-35\phi^k_{x-}-70\phi^k_{0}-700\phi^k_{x2}
$$
where
$$
  \phi^k_{x+}=2(J^k_{out,x+}+J^k_{in,x+})
$$
$$
  \phi^k_{x-}=2(J^k_{out,x-}+J^k_{in,x-})
$$
$$
  \phi^k_{y+}=2(J^k_{out,y+}+J^k_{in,y+})
$$
$$
  \phi^k_{y-}=2(J^k_{out,y-}+J^k_{in,y-})
$$

This is a footnote. [^1]

This is another sentence. [^2]

```c++
  double fxp = 2. * (_j_out.get(0, 0) + _j_in.get(0, 0));
  double fxm = 2. * (_j_out.get(1, 0) + _j_in.get(1, 0));
  double fyp = 2. * (_j_out.get(2, 0) + _j_in.get(2, 0));
  double fym = 2. * (_j_out.get(3, 0) + _j_in.get(3, 0));
```

[^1]: Footnote text

[^2]: Footnote text
--&gt;
&lt;h1 id=&quot;references&quot;&gt;References&lt;&#x2F;h1&gt;
&lt;a id=&quot;okumura&quot;&gt;
Okumura, K. (1998). MOSRA-Light; high speed three-dimensional nodal diffusion
code for vector computers.
https:&#x2F;&#x2F;www.osti.gov&#x2F;etdeweb&#x2F;servlets&#x2F;purl&#x2F;300794
&lt;&#x2F;a&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Hiking Wales</title>
        <published>2025-08-19T00:00:00+00:00</published>
        <updated>2025-08-19T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://jctree.gitlab.io/wales/"/>
        <id>https://jctree.gitlab.io/wales/</id>
        
        <content type="html" xml:base="https://jctree.gitlab.io/wales/">&lt;p&gt;In May of 2025, I boarded a plane bound for the UK with a friend. Our plan was
to hike as much of the northern section of the Cambrian Way as we could in 10
days. The Cambrian Way traverses Wales, starting in the South in Cardiff and
ending in the North in Conwy. The route makes a point of hitting as many peaks
as possible. Since we only had long enough to do a single section, we chose to
start in the North in Conwy and hike in reverse as far as we could. I included a
small gallery of pictures along the way. The pictures are ordered to start in
Conwy on day 1, and the last one is leaving Barmouth on day 7. I am making this
post to share my memories from this hike.&lt;&#x2F;p&gt;
&lt;div&gt;

    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;wales&#x2F;1conwy_view.png&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;1conwy_view.a82063eb67573367.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;wales&#x2F;2tent_night.png&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;2tent_night.74f0239a1951e7ab.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;wales&#x2F;3tent_day.jpg&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;3tent_day.3bccf63f0868ffcb.jpg&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;wales&#x2F;4day2_lake.png&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;4day2_lake.a8f1bc7145685990.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;wales&#x2F;5snowdon.jpg&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;5snowdon.cb5af386b9baadaa.jpg&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;wales&#x2F;6day4_morning.png&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;6day4_morning.e728da053feaf41e.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;wales&#x2F;7purple_flowers.jpg&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;7purple_flowers.fca246e5ca9d784e.jpg&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;wales&#x2F;8mountain_lake.jpg&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;8mountain_lake.5f82cbb0963de592.jpg&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
    &lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;wales&#x2F;9barmouth.png&quot; target=&quot;_blank&quot;&gt;
      &lt;img src=&quot;https:&amp;#x2F;&amp;#x2F;jctree.gitlab.io&amp;#x2F;processed_images&amp;#x2F;9barmouth.42490964b75ef471.png&quot; &#x2F;&gt;
    &lt;&#x2F;a&gt;
&lt;&#x2F;div&gt;
&lt;p&gt;Before we started, we did not know what to expect. Neither of us had done any
serious through-hiking, and my friend did not even have much experience with
hiking in general. We were a little bit caught off guard, though, since our
first day ended up being fairly challenging. Looking back, it was the most
difficult stage we did. It was both far and steep. We were low on water, so we
needed to get to a water source to pitch camp. At the end of the day, we started
feeling better. All we had was about a mile to get off the ridge to finish the
stage, and we had a little bit of daylight left. The descent off the ridge,
however, was very challenging. There were times we had to take off our bags to
climb down. About half way down, we found a stream. We were losing light, so we
decided to camp now that we could.&lt;&#x2F;p&gt;
&lt;p&gt;The next day felt a lot better. It was still steep, but the distance was
shorter. From the second day on, we started to develop a rhythm. On the third
day, we hiked Snowdon, the tallest mountain in Wales. Neither of us realized
that it was Snowdon until we reached the top and saw the visitor center. The
picture in the center of the gallery shows Snowdon.&lt;&#x2F;p&gt;
&lt;p&gt;Two days later, another friend of mine met up with us for the last few days of
hiking. He joined us the night before the stage that ends in Barmouth. This
stage felt quite similar to our first day. The distance was very far, and the
terrain was very steep. We barely made it into Barmouth, and were very happy to
have a shower and a warm meal. After that stage, we started later the next day,
and spent the net two days completing the next stage. The last stages to the end
of the northern section were easier as well. The slower pace made the last few
days of hiking much more relaxing, and also convinced my friend to stick with it
until the end.&lt;&#x2F;p&gt;
&lt;p&gt;The friend who hiked the whole way with me does not really have an online
presence. The other one has a website which can be found
&lt;a href=&quot;https:&#x2F;&#x2F;www.paulsphysicsnotes.org&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Radioactive Decay Chains</title>
        <published>2025-06-16T12:00:00+00:00</published>
        <updated>2025-06-16T12:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://jctree.gitlab.io/decay-chain/"/>
        <id>https://jctree.gitlab.io/decay-chain/</id>
        
        <content type="html" xml:base="https://jctree.gitlab.io/decay-chain/">&lt;h1 id=&quot;radioactive-decay&quot;&gt;Radioactive Decay&lt;&#x2F;h1&gt;
&lt;p&gt;Radioactive decay is a random process. For one unstable atom, it is completely
random when it decays. For a large quantity of atoms, though, radioactive decay
follows certain rules. The most important rule is that a radioactive sample, a
collection of atoms of the same type, decay with a constant half-life. After one
half-life, half of the original amount of atoms will have decayed. We can write
this mathematically as
$$
N(t)=N(0)\left(\frac{1}{2}\right)^{\frac{t}{t_{1&#x2F;2}}}
$$
where $N(t)$ is the number of atoms at time $t$, and $t_{1&#x2F;2}$ is the half-life.
To prove to ourselves that this works, we can plug in $t=0$, which yields
$$
N(0)=N(0)\left(\frac{1}{2}\right)^0=N(0)
$$
and plugging in $t=t_{1&#x2F;2}$ gives
$$
N(t_{1&#x2F;2})=N(0)\left(\frac{1}{2}\right)^1=\frac{N(0)}{2}
$$&lt;&#x2F;p&gt;
&lt;p&gt;We can rearrange this equation to make our lives easier. We start by writing
that
$$
N(t)=N(0)\left(\frac{1}{2}\right)^{\frac{t}{t_{1&#x2F;2}}}=N(0)2^{-\frac{t}{t_{1&#x2F;2}}}
$$
By definition,
$\exp(\log(x))=x$. We use this to say that
$$
\begin{align}
2^{-\frac{t}{t_{1&#x2F;2}}}&amp;amp;=
\exp\left(\log\left(2^{-\frac{t}{t_{1&#x2F;2}}}\right)\right) \\
&amp;amp;=\exp\left(-\frac{t}{t_{1&#x2F;2}}\log(2)\right) \\
&amp;amp;=\exp\left(-\lambda t\right)
\end{align}
$$
where we define $\lambda=\frac{\log(2)}{t_{1&#x2F;2}}$. Plugging this into the decay
equation gives an equivalent but more ubiquitous form:
$$
N(t)=N(0)e^{-\lambda t}
$$
$\lambda$ is called the decay constant, and represents a rate. A more natural
quantity to think about, however, is the number of atoms that decay per unit of
time in a sample, called the activity. The SI units for activity are the
Becquerel (Bq), where 1 Bq is 1 decay per second. The number of atoms that decay
per unit of time in a sample is the time rate-of-change of the number of atoms
in a sample, $\frac{dN}{dt}$. We can take this derivative to get
$$
\begin{align}
\frac{dN(t)}{dt}&amp;amp;=N(0)\frac{d}{dt}\left(e^{-\lambda t}\right) \\
&amp;amp;=N(0)\left(-\lambda e^{-\lambda t}\right) \\
&amp;amp;=-\lambda\left(N(0)e^{-\lambda t}\right) \\
&amp;amp;=-\lambda N(t)
\end{align}
$$
Denoting the activity of the sample as $A$, we write
$$
A(t)=-\lambda N(t)
$$&lt;&#x2F;p&gt;
&lt;h1 id=&quot;decay-chains&quot;&gt;Decay Chains&lt;&#x2F;h1&gt;
&lt;p&gt;When atoms decay, they emit some of their mass as radiation. What remains is a
different atom, either a new element or a different isotope of the old one. This
new isotope may itself be unstable and decay with a different half-life into yet
another atom. Depending on what isotope you start from, you can end up with long
decay chains. One such decay chain is called the “thorium series”, which starts
at $^{232}$Th and ends on stable $^{208}$Pb. The thorium series is shown below.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;text&quot; style=&quot;background-color:#fafafa;color:#61676c;&quot; class=&quot;language-text &quot;&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;Th232
&lt;&#x2F;span&gt;&lt;span&gt;└── Ra228
&lt;&#x2F;span&gt;&lt;span&gt;    └── Ac228
&lt;&#x2F;span&gt;&lt;span&gt;        └── Th228
&lt;&#x2F;span&gt;&lt;span&gt;            └── Ra224
&lt;&#x2F;span&gt;&lt;span&gt;                └── Rn220
&lt;&#x2F;span&gt;&lt;span&gt;                    └── Po216
&lt;&#x2F;span&gt;&lt;span&gt;                        └── Pb212
&lt;&#x2F;span&gt;&lt;span&gt;                            └── Bi212
&lt;&#x2F;span&gt;&lt;span&gt;                                ├── Po212
&lt;&#x2F;span&gt;&lt;span&gt;                                │   └── Pb208
&lt;&#x2F;span&gt;&lt;span&gt;                                └── Tl208
&lt;&#x2F;span&gt;&lt;span&gt;                                    └── Pb208
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each isotope in the chain has its own half-life (and therefore its own decay
constant). The decay of $^{232}$Th results in the production of $^{228}$Ra, which
itself decays, producing $^{228}$Ac, and so on.&lt;&#x2F;p&gt;
&lt;p&gt;Looking at these chains, we can ask the question, “how much of each isotope
exists at any given time?” We can formulate an answer to this question using the
equations we derived above. To simplify notation, we denote $^{232}$Th as isotope
1 and $^{228}$Ra as isotope 2. Let’s say we start with $N_1(0)$ atoms of $^{232}$Th,
and $N_2(0)=0$ atoms (no atoms) of $^{228}$Ra. We can immediately write the time
rate-of-change of the thorium atoms:
$$
\frac{dN_1(t)}{dt}=-\lambda_1N_1(t)
$$
If we are losing thorium atoms at a rate of $\lambda_1N_1(t)$, then we must be
gaining radium atoms at a rate of $\lambda_1N_1(t)$. For radium then, we have
$$
\frac{dN_2(t)}{dt}=\lambda_1N_1(t)
$$
In addition to gaining atoms from the decay of the thorium, we are also losing
the radium atoms through its own decay at a rate of $\lambda_2N_2(t)$. We
therefore need to subtract out this term to get
$$
\frac{dN_2(t)}{dt}=\lambda_1N_1(t)-\lambda_2N_2(t)
$$
We therefore get a system of two coupled differential equations to describe the
number of atoms of thorium and of radium at any point in time. We can expand our
analysis to the next isotope in the chain, actinium. The number of actinium
atoms depends on the rate of decay of radium and the rate of decay of itself:
$$
\frac{dN_3(t)}{dt}=\lambda_2N_2(t)-\lambda_3N_3(t)
$$
If we keep up this numbering scheme, we can easily write an equation for each
isotope in a decay chain that is $n$ isotopes long. The last element in the
decay chain (lead-212 in our example) is stable, so it does not have the loss
term from its own decay, only the gain term from the decay of the isotope above
it in the chain.
$$
\frac{dN_n(t)}{dt}=\lambda_{n-1}N_{n-1}(t)
$$&lt;&#x2F;p&gt;
&lt;h1 id=&quot;solving-the-differential-equations&quot;&gt;Solving the Differential Equations&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;numerical-integration&quot;&gt;Numerical Integration&lt;&#x2F;h2&gt;
&lt;p&gt;The goal of this method is to turn the scary derivatives into sums without doing
any difficult math. We start by defining a time-step, $\delta t$, that is small
compared to the half-lives of all the isotopes in the decay chain. If we really
squint, the decay equations
$$
\begin{align}
\frac{dN_1(t)}{dt}&amp;amp;=-\lambda_1N_1(t) &amp;amp;
\frac{dN_2(t)}{dt}&amp;amp;=\lambda_1N_1(t)-\lambda_2N_2(t)
\end{align}
$$
look like
$$
\begin{align}
\frac{\delta N_1(t)}{\delta t}&amp;amp;=-\lambda_1N_1(t) &amp;amp;
\frac{\delta N_2(t)}{\delta t}&amp;amp;=\lambda_1N_1(t)-\lambda_2N_2(t)
\end{align}
$$
This does actually work. The derivative is the slope of the curve at a point. We
can approximate the slope of the curve at a point by the average slope of the
curve around the point. This is an approximation, but as long as the interval
($\delta t$) is short compared to how quickly the slope of the curve is changing
(the half-life of the isotope), then it is not a bad one. We can multiply both
sides of the equations by $\delta t$ to get
$$
\begin{align}
\delta N_1(t)&amp;amp;=-\lambda_1N_1(t)\delta t &amp;amp;
\delta N_2(t)&amp;amp;=(\lambda_1N_1(t)-\lambda_2N_2(t))\delta t
\end{align}
$$
If we keep track of amount of atoms for each isotope at each time-step, we
simply add $\delta N$ to the amount of atoms at the current time-step to get the
number of atoms at the next time-step. In order to calculate this $\delta N$, we
need the number of atoms of the isotope of interest and the number of atoms of
the isotope one position above it in the decay chain at the current time-step.
Starting at $t=0$ where we know the initial number of atoms of all isotopes, we
can calculate in time-steps going forward in time the number of atoms for each
isotope in the chain.&lt;&#x2F;p&gt;
&lt;p&gt;This method is very easy to implement in a computer program, and is often
accurate enough. Care does have to be taken, however, that the time-step is
short enough. If there are very short-lived isotopes in the decay chain, the
required time-step may be so small that the method is not computationally
feasible.&lt;&#x2F;p&gt;
&lt;p&gt;We can write a simple program in Python which calculates the decay of $^{232}$Th
into $^{228}$Ra. First, we define the half-lives of the isotopes. The half-lives
are given in years. We will also need the &lt;code&gt;numpy&lt;&#x2F;code&gt; library, which we import.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;python&quot; style=&quot;background-color:#fafafa;color:#61676c;&quot; class=&quot;language-python &quot;&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span style=&quot;color:#fa6e32;&quot;&gt;import &lt;&#x2F;span&gt;&lt;span&gt;numpy &lt;&#x2F;span&gt;&lt;span style=&quot;color:#fa6e32;&quot;&gt;as &lt;&#x2F;span&gt;&lt;span&gt;np
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;half_life_Th &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color:#61676ccc;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;405e10
&lt;&#x2F;span&gt;&lt;span&gt;half_life_Ra &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;5&lt;&#x2F;span&gt;&lt;span style=&quot;color:#61676ccc;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;73
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Next, we calculate the decay constants from the half-lives.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;python&quot; style=&quot;background-color:#fafafa;color:#61676c;&quot; class=&quot;language-python &quot;&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span&gt;lambda_Th &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span&gt;np&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;&#x2F; &lt;&#x2F;span&gt;&lt;span&gt;half_life_Th
&lt;&#x2F;span&gt;&lt;span&gt;lambda_Ra &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span&gt;np&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;) &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;&#x2F; &lt;&#x2F;span&gt;&lt;span&gt;half_life_Ra
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Since both the half-lives are multiple years, we can set our time-step as half
of a year and still get reasonable results. We also need to set the initial
number of atoms of thorium and radium. We put the initial numbers as the first
elements in arrays, which we will append the new number of atoms to at each
time-step.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;python&quot; style=&quot;background-color:#fafafa;color:#61676c;&quot; class=&quot;language-python &quot;&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span&gt;dt &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color:#61676ccc;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;5
&lt;&#x2F;span&gt;&lt;span&gt;N_Th &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;1e15&lt;&#x2F;span&gt;&lt;span&gt;]
&lt;&#x2F;span&gt;&lt;span&gt;N_Ra &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color:#61676ccc;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;]
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Finally, we make a loop that calculates the number of atoms of each isotope
every year for 20 years. In the loop, we first calculate the change in the
number of atoms of each isotope from decay over the year. Next, we subtract the
amount of atoms lost from the previous value in the array, and for radium, we
add the number of atoms lost from thorium.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;python&quot; style=&quot;background-color:#fafafa;color:#61676c;&quot; class=&quot;language-python &quot;&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span style=&quot;color:#fa6e32;&quot;&gt;for &lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span style=&quot;color:#fa6e32;&quot;&gt;in &lt;&#x2F;span&gt;&lt;span style=&quot;color:#f07171;&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;20 &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;* &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;):
&lt;&#x2F;span&gt;&lt;span&gt;  dN_Th &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span&gt;lambda_Th &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;* &lt;&#x2F;span&gt;&lt;span&gt;N_Th[i] &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;* &lt;&#x2F;span&gt;&lt;span&gt;dt
&lt;&#x2F;span&gt;&lt;span&gt;  dN_Ra &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span&gt;lambda_Ra &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;* &lt;&#x2F;span&gt;&lt;span&gt;N_Ra[i] &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;* &lt;&#x2F;span&gt;&lt;span&gt;dt
&lt;&#x2F;span&gt;&lt;span&gt;  N_Th&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(N_Th[i] &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span&gt;dN_Th)
&lt;&#x2F;span&gt;&lt;span&gt;  N_Ra&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(N_Ra[i] &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;+ &lt;&#x2F;span&gt;&lt;span&gt;dN_Th &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;- &lt;&#x2F;span&gt;&lt;span&gt;dN_Ra)
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This leaves us with two arrays containing the number of atoms of thorium and
radium at half year increments. We can plot the data using the following code:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;python&quot; style=&quot;background-color:#fafafa;color:#61676c;&quot; class=&quot;language-python &quot;&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span style=&quot;color:#fa6e32;&quot;&gt;import &lt;&#x2F;span&gt;&lt;span&gt;matplotlib&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pyplot &lt;&#x2F;span&gt;&lt;span style=&quot;color:#fa6e32;&quot;&gt;as &lt;&#x2F;span&gt;&lt;span&gt;plt
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;times &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;= &lt;&#x2F;span&gt;&lt;span&gt;np&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;linspace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color:#61676ccc;&quot;&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;20&lt;&#x2F;span&gt;&lt;span style=&quot;color:#61676ccc;&quot;&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;41&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;plt&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;plot&lt;&#x2F;span&gt;&lt;span&gt;(times&lt;&#x2F;span&gt;&lt;span style=&quot;color:#61676ccc;&quot;&gt;, &lt;&#x2F;span&gt;&lt;span&gt;N_Th&lt;&#x2F;span&gt;&lt;span style=&quot;color:#61676ccc;&quot;&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;label&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color:#86b300;&quot;&gt;&amp;quot;Thorium Atoms&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;plt&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;plot&lt;&#x2F;span&gt;&lt;span&gt;(times&lt;&#x2F;span&gt;&lt;span style=&quot;color:#61676ccc;&quot;&gt;, &lt;&#x2F;span&gt;&lt;span&gt;N_Ra&lt;&#x2F;span&gt;&lt;span style=&quot;color:#61676ccc;&quot;&gt;, &lt;&#x2F;span&gt;&lt;span style=&quot;color:#ff8f40;&quot;&gt;label&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color:#86b300;&quot;&gt;&amp;quot;Radium Atoms&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;plt&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;xlabel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#86b300;&quot;&gt;&amp;quot;Time [years]&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;plt&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;ylabel&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#86b300;&quot;&gt;&amp;quot;Number of Atoms&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;plt&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;yscale&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color:#86b300;&quot;&gt;&amp;quot;log&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)
&lt;&#x2F;span&gt;&lt;span&gt;plt&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;legend&lt;&#x2F;span&gt;&lt;span&gt;()
&lt;&#x2F;span&gt;&lt;span&gt;plt&lt;&#x2F;span&gt;&lt;span style=&quot;color:#ed9366;&quot;&gt;.&lt;&#x2F;span&gt;&lt;span style=&quot;color:#f29718;&quot;&gt;show&lt;&#x2F;span&gt;&lt;span&gt;()
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;the-bateman-equation&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;jctree.gitlab.io&#x2F;decay-chain&#x2F;#bateman_eq&quot;&gt;The Bateman Equation&lt;&#x2F;a&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;The Bateman Equation is an exact solution to the system of coupled differential
equations. It is given by
$$
N_i(t)=N_1(0)\left(\prod\limits^{i-1}_{k=1}\lambda_k\right)
\sum\limits^i_{k=1}\frac{e^{-\lambda_kt}}
{\prod\limits^i_{j=1,j\neq k}(\lambda_j-\lambda_k)}
$$
The Bateman Equation solves the decay chain exactly, and is fairly easy to
implement in a computer program. It can cause issues, however, if two isotopes
in the chain have decay constants $\lambda_j\approx\lambda_k$. Floating-point
error can cause the difference to go to zero causing a divide by zero.&lt;&#x2F;p&gt;
&lt;p&gt;The equation as written does not allow for isotopes down the chain to have
non-zero starting numbers. Only the first isotope’s starting number is reflected
in the solution. To treat this case, the chain can be split into components
where each component is a chain with only one of the isotopes having a starting
number of atoms. The component chains can be solved individually, and the
results superimposed on one another. For example, given the chain&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;text&quot; style=&quot;background-color:#fafafa;color:#61676c;&quot; class=&quot;language-text &quot;&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;A ───► B ───► C
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;we can solve three separate chains&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;text&quot; style=&quot;background-color:#fafafa;color:#61676c;&quot; class=&quot;language-text &quot;&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;A ───► 0 ───► 0
&lt;&#x2F;span&gt;&lt;span&gt;0 ───► B ───► 0
&lt;&#x2F;span&gt;&lt;span&gt;0 ───► 0 ───► C
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and sum the results to get $C(t)$.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;branching&quot;&gt;Branching&lt;&#x2F;h3&gt;
&lt;p&gt;If the decay chain has branching, a similar strategy can be employed. Consider
the following chain:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;text&quot; style=&quot;background-color:#fafafa;color:#61676c;&quot; class=&quot;language-text &quot;&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;A
&lt;&#x2F;span&gt;&lt;span&gt;├───── B ───┐ 
&lt;&#x2F;span&gt;&lt;span&gt;│ 25%       │
&lt;&#x2F;span&gt;&lt;span&gt;│           │
&lt;&#x2F;span&gt;&lt;span&gt;└───── C ───┴─ D
&lt;&#x2F;span&gt;&lt;span&gt;  75%  
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The goal is to solve for the number of atoms of isotope D at some time $t$. In
order to do this, all possible paths to the isotope D must be found. For this
simple chain, this task is fairly simple. For more complicated chains, it is
beneficial to understand the structure of the chain. In a decay chain, there are
no cycles. Following the path of decay, there will not be any closed loops
(incidentally, this structure is known as a directed acyclic graph). This
property allows us to employ a depth-first search algorithm to traverse the
chain, finding all paths to the nuclide of interest.&lt;&#x2F;p&gt;
&lt;p&gt;For the chain given above, the two paths are&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;text&quot; style=&quot;background-color:#fafafa;color:#61676c;&quot; class=&quot;language-text &quot;&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;&lt;span&gt;A ───► B ───► D
&lt;&#x2F;span&gt;&lt;span&gt;A ───► C ───► D
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each of these paths can be treated individually with the Bateman equation. This
yields two solutions for the number of atoms of isotope D, D$_1$ and D$_2$ for
the solution of the first and second paths, respectively. In this case, it is
evident that 25% of the number of atoms of D come from the first path, and 75%
come from the second path. The solution for the number of atoms of D is then
$$
\mathrm{D=0.25D_1 + 0.75D_2}
$$&lt;&#x2F;p&gt;
&lt;p&gt;For more complicated chains, with multiple non-trivial paths to the nuclide of
interest, the contribution of each path can be represented as a path weight. The
weight of a path is found as follows. Assume a path $p$ comprising nuclides
$N_1$ to $N_n$. The branching ratio from $N_1$ to $N_2$ is represented as
$b_{1\rightarrow2}$. The weight $w_p$ of the path $p$ is
$$
w_p=\prod\limits_{i=2}^{n}b_{(i-1)\rightarrow i}
$$
Assuming the solution to the Bateman equation for nuclide $n$ on the path $p$ is
$N_{n,p}$, the total number of atoms of nuclide $n$ is
$$
N_n=\sum\limits_{p}w_pN_{n,p}
$$&lt;&#x2F;p&gt;
&lt;h1 id=&quot;references&quot;&gt;References&lt;&#x2F;h1&gt;
&lt;p&gt;&lt;a id=&quot;bateman_eq&quot;&gt;Bateman, H. (1908). The solution of a system of differential
equations occurring in the theory of radio-active transformations. Proceedings
of the Cambridge Philosophical Society, Mathematical and Physical Sciences,
v.15 (1908-1910), 423–427.&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Monte Carlo</title>
        <published>2025-05-02T22:52:00+00:00</published>
        <updated>2025-05-02T22:52:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://jctree.gitlab.io/monte-carlo/"/>
        <id>https://jctree.gitlab.io/monte-carlo/</id>
        
        <content type="html" xml:base="https://jctree.gitlab.io/monte-carlo/">&lt;p&gt;This has no information at the moment. I do have a code though. It lives
&lt;a href=&quot;https:&#x2F;&#x2F;gitlab.com&#x2F;JCTree&#x2F;fixed_source_mc&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Hello World</title>
        <published>2025-05-02T21:00:00+00:00</published>
        <updated>2025-05-02T21:00:00+00:00</updated>
        
        <author>
          <name>
            
              Unknown
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://jctree.gitlab.io/hello-world/"/>
        <id>https://jctree.gitlab.io/hello-world/</id>
        
        <content type="html" xml:base="https://jctree.gitlab.io/hello-world/">&lt;p&gt;I am a student studying nuclear engineering. You can read about me
&lt;a href=&quot;&#x2F;pages&#x2F;about&quot;&gt;here&lt;&#x2F;a&gt;. I am starting this website as a way to record the projects
I am working on. I plan to describe what the projects are and how they work,
both for my own reference and in case someone finds these things interesting.&lt;&#x2F;p&gt;
</content>
        
    </entry>
</feed>
