File indexing completed on 2026-12-01 10:04:53
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include "corecel/Assert.hh"
0010 #include "corecel/Macros.hh"
0011 #include "corecel/Types.hh"
0012 #include "corecel/cont/Span.hh"
0013 #include "celeritas/mat/MaterialView.hh"
0014
0015 #include "WentzelHelper.hh"
0016
0017 namespace celeritas
0018 {
0019
0020
0021
0022
0023
0024
0025
0026 class WentzelTransportXsCalculator
0027 {
0028 public:
0029
0030
0031 using XsUnits = units::Native;
0032 using Mass = units::MevMass;
0033 using MomentumSq = units::MevMomentumSq;
0034
0035
0036 public:
0037
0038 inline CELER_FUNCTION WentzelTransportXsCalculator(
0039 ParticleTrackView const& particle, WentzelHelper const& helper);
0040
0041
0042 inline CELER_FUNCTION real_type operator()(real_type cos_thetamax) const;
0043
0044 private:
0045
0046
0047 AtomicNumber z_;
0048 real_type screening_coeff_;
0049 real_type cos_thetamax_elec_;
0050 real_type beta_sq_;
0051 real_type kin_factor_;
0052
0053
0054
0055
0056 real_type calc_xs_contribution(real_type cos_thetamax) const;
0057
0058
0059 static CELER_CONSTEXPR_FUNCTION real_type limit() { return 0.1; }
0060 };
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073 CELER_FUNCTION WentzelTransportXsCalculator::WentzelTransportXsCalculator(
0074 ParticleTrackView const& particle, WentzelHelper const& helper)
0075 : z_(helper.atomic_number())
0076 , screening_coeff_(2 * helper.screening_coefficient())
0077 , cos_thetamax_elec_(helper.cos_thetamax_electron())
0078 , beta_sq_(particle.beta_sq())
0079 , kin_factor_(helper.kin_factor())
0080 {
0081 }
0082
0083
0084
0085
0086
0087 CELER_FUNCTION real_type WentzelTransportXsCalculator::operator()(
0088 real_type cos_thetamax) const
0089 {
0090 CELER_EXPECT(cos_thetamax <= 1);
0091
0092
0093 real_type xs_nuc = this->calc_xs_contribution(cos_thetamax);
0094 real_type xs_elec = cos_thetamax_elec_ > cos_thetamax
0095 ? this->calc_xs_contribution(cos_thetamax_elec_)
0096 : xs_nuc;
0097 real_type result = kin_factor_ * (xs_elec + z_.get() * xs_nuc);
0098
0099 CELER_ENSURE(result >= 0);
0100 return result;
0101 }
0102
0103
0104
0105
0106
0107 CELER_FUNCTION real_type WentzelTransportXsCalculator::calc_xs_contribution(
0108 real_type cos_thetamax) const
0109 {
0110 using namespace celeritas::literals;
0111
0112 real_type result;
0113 real_type const spin = 0.5_r;
0114 real_type x = (1 - cos_thetamax) / screening_coeff_;
0115 if (x < WentzelTransportXsCalculator::limit())
0116 {
0117 real_type x_sq = ipow<2>(x);
0118 result = 0.5_r * x_sq
0119 * ((1 - 4.0_r / 3.0_r * x + 1.5_r * x_sq)
0120 - screening_coeff_ * spin * beta_sq_ * x
0121 * (2.0_r / 3.0_r - x));
0122 }
0123 else
0124 {
0125 real_type x_1 = x / (1 + x);
0126 real_type log_x = std::log(1 + x);
0127 result = log_x - x_1
0128 - screening_coeff_ * spin * beta_sq_ * (x + x_1 - 2 * log_x);
0129 }
0130 return clamp_to_nonneg(result);
0131 }
0132
0133
0134 }