This MATLAB script computes the steady-state neutron flux distribution in a 2D homogeneous rectangular reactor core using Two-Group Neutron Diffusion Theory. The continuous differential equations are discretized using the Finite Difference Method (FDM) and solved as a coupled system of linear algebraic equations.
The neutron energy spectrum is divided into two energy groups: Group 1 (Fast Neutrons) and Group 2 (Thermal Neutrons). We assume a fixed, independent source
Fast Group (Group 1):
Where:
-
$D_1$ is the fast diffusion coefficient. -
$\Sigma_{R1} = \Sigma_{a1} + \Sigma_{s1\to2}$ is the macroscopic removal cross-section (representing fast neutrons lost to absorption and scattering down to the thermal group). -
$S_1(x,y)$ is the external fast neutron source.
Thermal Group (Group 2):
Where:
-
$D_2$ is the thermal diffusion coefficient. -
$\Sigma_{a2}$ is the thermal absorption cross-section. - The term
$\Sigma_{s1\to2} \phi_1(x,y)$ acts as the volumetric source for the thermal group, representing fast neutrons that have thermalized.
The continuous Laplacian operator
Applying this to a generic group diffusion equation (
The code enforces Dirichlet boundary conditions where the flux vanishes at the extrapolated boundaries of the reactor:
To implement this efficiently, the system matrix is formulated only for the unknown interior nodes. The boundary values (zeros) are inherently enforced by their absence from the right-hand side of the interior node equations, and are appended purely for post-processing and visualization.
To solve the 2D grid as a 1D vector system (
Where:
-
$D_{xx}$ and$D_{yy}$ are 1D tridiagonal second-derivative matrices for the$x$ and$y$ directions. -
$I_x$ and$I_y$ are identity matrices of sizes$N_x \times N_x$ and$N_y \times N_y$ .
This allows us to concisely define the system matrices for both energy groups:
The physical source
Because there is no up-scattering (thermal neutrons do not gain energy to become fast neutrons), the system is lower-triangular and can be solved sequentially without iteration:
- Solve Fast Group:
- Calculate Thermal Source:
- Solve Thermal Group: