Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:31:26

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file celeritas/neutron/model/NeutronInelasticModel.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <functional>
0011 
0012 #include "corecel/data/CollectionMirror.hh"
0013 #include "celeritas/Quantities.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 struct ImportPhysicsVector;
0024 class MaterialParams;
0025 class ParticleParams;
0026 
0027 //---------------------------------------------------------------------------//
0028 /*!
0029  * Set up and launch the neutron inelastic model interaction.
0030  */
0031 class NeutronInelasticModel final : public Model, public StaticConcreteAction
0032 {
0033   public:
0034     //!@{
0035     using AtomicMassNumber = IsotopeView::AtomicMassNumber;
0036     using MevEnergy = units::MevEnergy;
0037     using ReadData = std::function<ImportPhysicsVector(AtomicNumber)>;
0038     using HostRef = NeutronInelasticHostRef;
0039     using DeviceRef = NeutronInelasticDeviceRef;
0040     //!@}
0041 
0042   public:
0043     // Construct from model ID and other necessary data
0044     NeutronInelasticModel(ActionId id,
0045                           ParticleParams const& particles,
0046                           MaterialParams const& materials,
0047                           CascadeOptions const& options,
0048                           ReadData load_data);
0049 
0050     // Particle types and energy ranges that this model applies to
0051     SetApplicability applicability() const final;
0052 
0053     // Get the microscopic cross sections for the given particle and material
0054     MicroXsBuilders micro_xs(Applicability) const final;
0055 
0056     //! Apply the interaction kernel to host data
0057     void step(CoreParams const&, CoreStateHost&) const final;
0058 
0059     // Apply the interaction kernel to device data
0060     void step(CoreParams const&, CoreStateDevice&) const final;
0061 
0062     //!@{
0063     //! Access model data
0064     HostRef const& host_ref() const { return data_.host_ref(); }
0065     DeviceRef const& device_ref() const { return data_.device_ref(); }
0066     //!@}
0067 
0068   private:
0069     //// DATA ////
0070 
0071     // Host/device storage and reference
0072     CollectionMirror<NeutronInelasticData> data_;
0073 
0074     //// TYPES ////
0075 
0076     using HostXsData = HostVal<NeutronInelasticData>;
0077 
0078     struct ChannelData
0079     {
0080         StepanovParameters par;
0081         Array<double, 13> xs;
0082         Array<double, 6 * 19> cdf;  //! [energy][angle]
0083     };
0084 
0085     //// HELPER FUNCTIONS ////
0086 
0087     Span<double const> get_xs_energy_bins() const;
0088     static ChannelData const& get_channel_data(ChannelId id);
0089 
0090     Span<double const> get_cdf_energy_bins() const;
0091     Span<double const> get_cos_theta_bins() const;
0092 };
0093 
0094 //---------------------------------------------------------------------------//
0095 }  // namespace celeritas