Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/celeritas/neutron/xs/NucleonNucleonXsCalculator.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/neutron/xs/NucleonNucleonXsCalculator.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Macros.hh"
0010 #include "corecel/Types.hh"
0011 #include "corecel/math/PolyEvaluator.hh"
0012 #include "corecel/math/Quantity.hh"
0013 #include "celeritas/Quantities.hh"
0014 #include "celeritas/Types.hh"
0015 #include "celeritas/grid/NonuniformGridCalculator.hh"
0016 #include "celeritas/neutron/data/NeutronInelasticData.hh"
0017 
0018 namespace celeritas
0019 {
0020 //---------------------------------------------------------------------------//
0021 /*!
0022  * Calculate nucleon-nucleon (NN) cross sections from NeutronInelasticData
0023  */
0024 class NucleonNucleonXsCalculator
0025 {
0026   public:
0027     //!@{
0028     //! \name Type aliases
0029     using ParamsRef = NeutronInelasticRef;
0030     using Energy = units::MevEnergy;
0031     using BarnXs = units::BarnXs;
0032     //!@}
0033 
0034   public:
0035     // Construct with shared and state data
0036     inline CELER_FUNCTION NucleonNucleonXsCalculator(ParamsRef const& shared);
0037 
0038     // Compute cross section
0039     inline CELER_FUNCTION BarnXs operator()(ChannelId el_id,
0040                                             Energy energy) const;
0041 
0042     static CELER_CONSTEXPR_FUNCTION Energy high_otf_energy()
0043     {
0044         return Energy{10};
0045     }
0046 
0047     static CELER_CONSTEXPR_FUNCTION Energy low_otf_energy()
0048     {
0049         return Energy{1};
0050     }
0051 
0052   private:
0053     // Shared constant physics properties
0054     NeutronInelasticRef const& shared_;
0055 };
0056 
0057 //---------------------------------------------------------------------------//
0058 // INLINE DEFINITIONS
0059 //---------------------------------------------------------------------------//
0060 /*!
0061  * Construct with shared and state data.
0062  */
0063 CELER_FUNCTION NucleonNucleonXsCalculator::NucleonNucleonXsCalculator(
0064     ParamsRef const& shared)
0065     : shared_(shared)
0066 {
0067 }
0068 
0069 //---------------------------------------------------------------------------//
0070 /*!
0071  * Compute nucleon-nucleon (NN) cross section
0072  *
0073  * The parameterization of nucleon-nucleon cross sections below 10 MeV takes
0074  * the following functional form,
0075  * \f[
0076  *  SF(E) = coeffs[0] + coeffs[1]/E + coeffs[2]/E^{2}
0077  * \f]
0078  * where the kinetic energy of the incident nucleon, \em E is in [1, 10] MeV.
0079  * Below 1 MeV, \f$ SF(E) = slope/E \f$ down to \f$ E = slope/xs_zero \f$ while
0080  * \f$ SF(E) = xs_zero \f$ if \em E is in [0, slope/xs_zero] MeV.
0081  */
0082 CELER_FUNCTION auto NucleonNucleonXsCalculator::operator()(
0083     ChannelId ch_id, Energy energy) const -> BarnXs
0084 {
0085     CELER_EXPECT(ch_id < shared_.nucleon_xs.size());
0086     real_type result;
0087 
0088     if (energy < this->high_otf_energy())
0089     {
0090         // Calculate NN cross section according to the Stepanov's function
0091         // for the incident nucleon kinetic energy below 10 MeV
0092         StepanovParameters const& par = shared_.xs_params[ch_id];
0093 
0094         if (energy <= this->low_otf_energy())
0095         {
0096             result = celeritas::min(par.slope / energy.value(), par.xs_zero);
0097         }
0098         else
0099         {
0100             using namespace celeritas::literals;
0101             using StepanovFunction = PolyEvaluator<real_type, 2>;
0102             result = StepanovFunction(par.coeffs)(1_r / energy.value());
0103         }
0104     }
0105     else
0106     {
0107         // Get tabulated NN cross section data for the given channel
0108         NonuniformGridRecord grid = shared_.nucleon_xs[ch_id];
0109 
0110         // Calculate NN cross section at the given energy
0111         NonuniformGridCalculator calc_xs(grid, shared_.reals);
0112         result = calc_xs(energy.value());
0113     }
0114 
0115     return BarnXs{result};
0116 }
0117 
0118 //---------------------------------------------------------------------------//
0119 }  // namespace celeritas