Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:09:08

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/model/NeutronInelasticModel.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <functional>
0010 
0011 #include "corecel/data/CollectionMirror.hh"
0012 #include "celeritas/Quantities.hh"
0013 #include "celeritas/inp/Grid.hh"
0014 #include "celeritas/mat/IsotopeView.hh"
0015 #include "celeritas/mat/MaterialView.hh"
0016 #include "celeritas/neutron/data/NeutronInelasticData.hh"
0017 #include "celeritas/phys/AtomicNumber.hh"
0018 #include "celeritas/phys/Model.hh"
0019 
0020 namespace celeritas
0021 {
0022 struct CascadeOptions;
0023 class MaterialParams;
0024 class ParticleParams;
0025 
0026 //---------------------------------------------------------------------------//
0027 /*!
0028  * Set up and launch the neutron inelastic model interaction.
0029  *
0030  * Only neutron-neutron (proton-proton) and neutron-proton channels are
0031  * tabulated in [10, 320] (MeV) where pion production is not likely. The cross
0032  * sections below 10 MeV will be calculated on the fly using the Stepanov's
0033  * function. Tabulated data of cross sections and parameters at the low energy
0034  * are from G4CascadePPChannel, G4CascadeNPChannel and G4CascadeNNChannel of
0035  * the Geant4 11.2 release while angular c.d.f data are from G4PP2PPAngDst and
0036  * G4NP2NPAngDst. Also note that the channel cross sections of nucleon-nucleon
0037  * are same as their total cross sections in the energy range and the
0038  * proton-proton channel is same as the neutron-neutron channel based on the
0039  * charge-independence hypothesis of the nuclear force.
0040  * See \cite{bertini-1963,hess-1958}.
0041  */
0042 class NeutronInelasticModel final : public Model, public StaticConcreteAction
0043 {
0044   public:
0045     //!@{
0046     using AtomicMassNumber = IsotopeView::AtomicMassNumber;
0047     using MevEnergy = units::MevEnergy;
0048     using ReadData = std::function<inp::Grid(AtomicNumber)>;
0049     using HostRef = NeutronInelasticHostRef;
0050     using DeviceRef = NeutronInelasticDeviceRef;
0051     //!@}
0052 
0053   public:
0054     // Construct from model ID and other necessary data
0055     NeutronInelasticModel(ActionId id,
0056                           ParticleParams const& particles,
0057                           MaterialParams const& materials,
0058                           CascadeOptions const& options,
0059                           ReadData load_data);
0060 
0061     // Particle types and energy ranges that this model applies to
0062     SetApplicability applicability() const final;
0063 
0064     // Get the microscopic cross sections for the given particle and material
0065     MicroXsBuilders micro_xs(Applicability) const final;
0066 
0067     //! Apply the interaction kernel to host data
0068     void step(CoreParams const&, CoreStateHost&) const final;
0069 
0070     // Apply the interaction kernel to device data
0071     void step(CoreParams const&, CoreStateDevice&) const final;
0072 
0073     //!@{
0074     //! Access model data
0075     HostRef const& host_ref() const { return data_.host_ref(); }
0076     DeviceRef const& device_ref() const { return data_.device_ref(); }
0077     //!@}
0078 
0079   private:
0080     //// DATA ////
0081 
0082     // Host/device storage and reference
0083     CollectionMirror<NeutronInelasticData> data_;
0084 
0085     //// TYPES ////
0086 
0087     using HostXsData = HostVal<NeutronInelasticData>;
0088 
0089     //// HELPER FUNCTIONS ////
0090 
0091     StepanovParameters const& get_channel_params(ChannelId id);
0092     inp::Grid const& get_channel_xs(ChannelId id);
0093     inp::TwodGrid const& get_channel_cdf(ChannelId id);
0094 };
0095 
0096 //---------------------------------------------------------------------------//
0097 }  // namespace celeritas