From 549cc0973c9002da86c91564b2951a1c3f5c2d4b Mon Sep 17 00:00:00 2001 From: Adam Nelson <1037107+nelsonag@users.noreply.github.com> Date: Tue, 14 Jan 2025 09:51:47 -0600 Subject: [PATCH] Enable the LegendreFilter filter to be used in photon tallies for orders greater than P0. (#3245) Co-authored-by: Paul Romano --- src/physics.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/physics.cpp b/src/physics.cpp index 69e74f2eafd..34dc4ce1cbb 100644 --- a/src/physics.cpp +++ b/src/physics.cpp @@ -293,8 +293,8 @@ void sample_photon_reaction(Particle& p) // Coherent (Rayleigh) scattering prob += micro.coherent; if (prob > cutoff) { - double mu = element.rayleigh_scatter(alpha, p.current_seed()); - p.u() = rotate_angle(p.u(), mu, nullptr, p.current_seed()); + p.mu() = element.rayleigh_scatter(alpha, p.current_seed()); + p.u() = rotate_angle(p.u(), p.mu(), nullptr, p.current_seed()); p.event() = TallyEvent::SCATTER; p.event_mt() = COHERENT; return; @@ -303,10 +303,10 @@ void sample_photon_reaction(Particle& p) // Incoherent (Compton) scattering prob += micro.incoherent; if (prob > cutoff) { - double alpha_out, mu; + double alpha_out; int i_shell; element.compton_scatter( - alpha, true, &alpha_out, &mu, &i_shell, p.current_seed()); + alpha, true, &alpha_out, &p.mu(), &i_shell, p.current_seed()); // Determine binding energy of shell. The binding energy is 0.0 if // doppler broadening is not used. @@ -322,9 +322,9 @@ void sample_photon_reaction(Particle& p) double E_electron = (alpha - alpha_out) * MASS_ELECTRON_EV - e_b; int electron = static_cast(ParticleType::electron); if (E_electron >= settings::energy_cutoff[electron]) { - double mu_electron = (alpha - alpha_out * mu) / + double mu_electron = (alpha - alpha_out * p.mu()) / std::sqrt(alpha * alpha + alpha_out * alpha_out - - 2.0 * alpha * alpha_out * mu); + 2.0 * alpha * alpha_out * p.mu()); Direction u = rotate_angle(p.u(), mu_electron, &phi, p.current_seed()); p.create_secondary(p.wgt(), u, E_electron, ParticleType::electron); } @@ -338,7 +338,7 @@ void sample_photon_reaction(Particle& p) phi += PI; p.E() = alpha_out * MASS_ELECTRON_EV; - p.u() = rotate_angle(p.u(), mu, &phi, p.current_seed()); + p.u() = rotate_angle(p.u(), p.mu(), &phi, p.current_seed()); p.event() = TallyEvent::SCATTER; p.event_mt() = INCOHERENT; return;