Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 37

Multigroup Down-scattering in Slab Geometry

Recommended resources

Introduction

In our previous lesson, we mapped out the complete iterative algorithm used in deterministic transport codes, revealing a nested structure of loops for handling fission, inter-group scattering, and within-group scattering. We saw how this architecture systematically resolves the complex couplings inherent in the multigroup transport equations.

Today, we will translate that theoretical framework into practice. Our objective is to implement the full multigroup solution algorithm for a simple down-scattering problem in slab geometry. This is a pivotal step, bridging the gap between the formal equations and a working computational tool. Because we are focusing on a problem with only down-scattering and a fixed external source, the algorithm simplifies considerably. The outermost fission source loop is not needed, and the group iteration collapses into a single, sequential sweep from high energy to low energy. This provides the perfect entry point into multigroup programming, allowing us to focus on the core logic of coupling the energy groups.


The Test Problem: A Two-Group Slab

To ground our implementation, we'll use a concrete, well-defined benchmark problem. The image below describes a one-dimensional slab of 100 cm, composed of four different material regions. It is a two-group problem, meaning the energy domain is split into a high-energy group (group 1) and a low-energy group (group 2).

Material properties for a two-group problem in a 100 cm slab geometry. The properties include total cross-sections (\(\sigma_t\)), within-group scattering (\(\sigma_{s,g \to g}\)), group-to-group scattering (\(\sigma_{s,g' \to g}\)), and external sources (\(Q_g\)).

Material properties for a two-group problem in a 100 cm slab geometry. The properties include total cross-sections (), within-group scattering (), group-to-group scattering (), and external sources ().

Take a close look at the scattering cross-sections. You will notice that there are values for in each region , representing scattering from group 1 down to group 2. However, there is no term for ; it is implicitly zero. This confirms we are dealing with a pure down-scattering problem, which is why we can solve the groups sequentially.

Your first task in implementation will be to represent this information in Python. You'll need to define data structures (e.g., NumPy arrays) for:

  • A spatial grid defining the cell boundaries and centers across the 100 cm slab.
  • Material properties for each region, including total and scattering cross-sections. Since properties change at 20, 56, and 80 cm, you'll need to map these properties onto your spatial grid.
  • The group-to-group scattering matrix, . For this 2-group problem, it's a 2x2 matrix for each spatial cell.
  • The external source, , for each group in each cell.

The Multigroup Solution Algorithm

As we established, for a pure down-scattering problem, the algorithm simplifies to an energy sweep. We solve for the flux in group 1 first, then use that result to help solve for the flux in group 2.

Here is the algorithm in pseudocode:

  1. Initialization:

    • Create arrays to store the scalar flux phi[g, i] and angular flux psi[g, i, m] for each group g, spatial cell i, and discrete angle m. Initialize them to zero.
    • Load the problem definition: cross-sections, sources, geometry, and angular quadrature set.
  2. Loop over Energy Groups (g = 1 to G):

    • a. Compute the total source for the current group g:

      • Start with the external source for group g: TotalSource_g = ExternalSource_g.
      • Add the down-scattering source from all higher-energy groups g' < g. For our two-group case, when solving for group 2, this is: Since was already computed in the first step of the loop, this term is known.
      • TotalSource_g = TotalSource_g + DownScatterSource_g.
    • b. Solve the one-group S problem for group g:

      • Call a "one-group solver" function, passing it the TotalSource_g, the within-group scattering cross-section , and the total cross-section .
      • This solver will perform the inner (source) iteration that we discussed in Module 6 and the previous lesson, iterating until the within-group flux and source are consistent.
      • The function returns the converged scalar flux and angular flux .
    • c. Store the results:

      • Save the converged fluxes phi[g] and psi[g] before moving to the next group.
  3. Post-processing:

    • Once the loop is finished, you have the converged flux for all groups. You can now plot the results or compute other quantities of interest.

This structure elegantly wraps the single-group S solver you are already familiar with inside an energy-dependent loop. The only new "physics" is the calculation of the down-scattering source that couples the groups.


Implementing the Within-Group S Solver

The core of the algorithm is the solve_one_group function, which handles the source iteration for a single energy group. This is the "inner iteration" from our general algorithm flowchart. You have implemented this before, but it's worth reviewing the process in detail. A PhD thesis by L. R. C. Moraes provides an excellent, clear description of a standard S implementation, which you can use as a guide. While the thesis focuses on an advanced "nonclassical" transport model, its description of the underlying numerical S solver is standard and directly applicable.

SPECTRAL DISCRETE ORDINATES METHOD WITH LAGUERRE POLYNOMIAL TRUNCATION OF ORDER N (SPECTRAL-LTSN) SOLUTIONS TO THE GENERALIZED LINEAR BOLTZMANN EQUATION

This thesis provides a very clear breakdown of the components of a 1D S_N solver. We will use it as a reference for the numerical method. You should ignore the physics related to the "nonclassical GLBE," "free-path variable s," and "Laguerre moments." Focus solely on the structure of the numerical algorithm for space and angle.

First, quickly read the description of the slab geometry problem and boundary conditions in section 3.1.2. This sets the stage. Next, read section 3.1.5, "Numerical Discretization." Pay close attention to the list of steps in the source iteration. This is precisely the inner loop for your solve_one_group function. Then, study the section titled "Diamond-Difference Sweep Formulation" on the following page. This explains the spatial sweep equations for positive (\mu_l > 0) and negative (\mu_l < 0) directions, which are the heart of the S_N method. Finally, review the more detailed algorithm in the section "Numerical Implementation...", specifically steps 1, 2, and 3. This combines all the pieces into a complete computational pipeline for a single-group problem.

The Python code in Appendix A of that thesis provides a complete, working example of a one-group solver. It is an invaluable resource for structuring your solve_one_group function.


Your Implementation Task

Now it's your turn to build the solver. You should create a Python script that implements the multigroup algorithm described above. Here is a suggested structure for your code:

import numpy as np
# You might need np.polynomial.legendre.leggauss for the quadrature set

def solve_one_group(total_source, sigma_t, sigma_s_gg, mesh_data, quadrature_data):
    """
    Solves the 1D S_N equations for a single energy group using source iteration.

    Args:
        total_source (np.array): The fixed source (external + down-scattering).
        sigma_t (np.array): Total cross-section for this group on the spatial grid.
        sigma_s_gg (np.array): Within-group scattering cross-section.
        # ... other necessary parameters like grid spacing, angular weights etc.

    Returns:
        phi (np.array): Converged scalar flux for the group.
        psi (np.array): Converged angular flux for the group.
    """
    # 1. Initialize scalar flux phi_g and angular flux psi_g to zero.
    
    # 2. Start source iteration loop (e.g., for k in range(max_iterations):)
    #    a. Store the old scalar flux for convergence checks.
    #    b. Calculate the within-group scattering source: S_gg = sigma_s_gg * phi_g
    #    c. Form the total source for the sweep: S_total = total_source + S_gg
    #    d. Perform the S_N transport sweep (using Diamond Difference):
    #       - Loop over angles mu_m > 0 (left-to-right sweep)
    #       - Loop over angles mu_m < 0 (right-to-left sweep)
    #       - Update the angular flux psi_g at each cell edge.
    #    e. Recompute the scalar flux phi_g by integrating the new angular flux psi_g.
    #    f. Check for convergence by comparing the new and old scalar fluxes.
    #       If converged, break the loop.

    # 3. Return the converged phi and psi.
    pass # Replace with your implementation

def main():
    # --- Setup ---
    # Define spatial grid, angular quadrature (e.g., S8 Gauss-Legendre).
    # Define number of groups (G=2).
    # Create arrays and load the cross-section and source data from the image.
    # This involves mapping the four material regions to your spatial grid.
    
    # --- Solver ---
    # Initialize global flux arrays phi[g, i] and psi[g, i, m].
    
    # Loop over groups from g = 0 to G-1 (in Python indexing)
    for g in range(num_groups):
        print(f"Solving for group {g+1}...")
        
        # Calculate down-scattering source from higher energy groups
        downscatter_source = np.zeros_like(x_centers)
        for g_prime in range(g):
            downscatter_source += sigma_s[g_prime, g, :] * phi[g_prime, :]
            
        # Total fixed source for this group
        fixed_source = external_source[g, :] + downscatter_source
        
        # Solve the one-group problem
        phi_g, psi_g = solve_one_group(fixed_source, sigma_t[g, :], sigma_s[g, g, :], ...)
        
        # Store the results
        phi[g, :] = phi_g
        psi[g, :, :] = psi_g
        
    # --- Results ---
    # Plot the scalar flux for each group as a function of position.
    # e.g., plt.plot(x_centers, phi[0, :], label='Group 1 Flux')
    #      plt.plot(x_centers, phi[1, :], label='Group 2 Flux')
    #      ...

if __name__ == "__main__":
    main()

When you run your completed code, you should see a physically sensible result. The group 1 flux should be highest in the first region (0-20 cm) where the source is strong and then attenuate through the other materials. The group 2 flux has a source in the first region as well, but it should also show an increase in regions where the group 1 flux is high, as down-scattering from group 1 acts as an additional source for group 2.


Conclusion

In this lesson, you have taken the final and most important step in understanding multigroup deterministic methods: you have implemented one yourself. By building a solver for a fixed-source, down-scattering problem, you have put the theoretical pieces from the last several modules into a functional whole.

Key Takeaways:

  • For problems with only down-scattering, the multigroup system can be solved with a single sequential pass through the energy groups, from highest to lowest energy.
  • The core of the multigroup algorithm is a loop that, for each group, (1) calculates the scattering source from already-solved higher-energy groups, and (2) calls a standard one-group S solver.
  • The one-group solver uses source iteration to converge the within-group scattering source, relying on a spatial sweep (like Diamond-Difference) to update the angular flux at each step.
  • The overall structure combines an outer loop over energy with an inner loop over the within-group source, directly reflecting the physics of particle transport.

Preview of the Next Lesson:

We have now reached the end of our exploration of deterministic transport methods. While powerful, they have limitations, especially in complex 3D geometries. We will now pivot to an entirely different and complementary approach to solving the transport problem. In the next lesson, we will lay the foundations of Monte Carlo simulation, exploring the statistical principles like the Law of Large Numbers and Central Limit Theorem that allow us to simulate particle transport as a probabilistic game of chance.