forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NeutronInelasticData.hh
119 lines (101 loc) · 3.73 KB
/
NeutronInelasticData.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//----------------------------------*-C++-*----------------------------------//
// Copyright 2024 UT-Battelle, LLC, and other Celeritas developers.
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file celeritas/neutron/data/NeutronInelasticData.hh
//---------------------------------------------------------------------------//
#pragma once
#include "corecel/Macros.hh"
#include "corecel/Types.hh"
#include "corecel/data/Collection.hh"
#include "corecel/math/Quantity.hh"
#include "celeritas/Quantities.hh"
#include "celeritas/Types.hh"
#include "celeritas/grid/GenericGridData.hh"
namespace celeritas
{
//---------------------------------------------------------------------------//
/*!
* Scalar data for neutron-nucleus inelastic interactions.
*/
struct NeutronInelasticScalars
{
// Action and particle IDs
ActionId action_id;
ParticleId neutron_id;
// Particle mass * c^2 [MeV]
units::MevMass neutron_mass;
//! Number of nucleon-nucleon channels
static CELER_CONSTEXPR_FUNCTION size_type num_channels() { return 3; }
//! Model's maximum energy limit [MeV]
static CELER_CONSTEXPR_FUNCTION units::MevEnergy max_valid_energy()
{
// Below the pion production threshold
return units::MevEnergy{320};
}
//! Whether data are assigned
explicit CELER_FUNCTION operator bool() const
{
return action_id && neutron_id && neutron_mass > zero_quantity();
}
};
//---------------------------------------------------------------------------//
/*!
* Parameters of Stepanov's function to fit nucleon-nucleon cross sections
* below 10 MeV.
*/
struct StepanovParameters
{
real_type xs_zero; //!< nucleon-nucleon cross section at the zero energy
real_type slope; //!< parameter used for the low energy threshold
Real3 coeffs; //!< coefficients of a second order Stepanov's function
};
//---------------------------------------------------------------------------//
/*!
* Device data for creating an interactor.
*/
template<Ownership W, MemSpace M>
struct NeutronInelasticData
{
template<class T>
using Items = Collection<T, W, M>;
template<class T>
using ElementItems = Collection<T, W, M, ElementId>;
template<class T>
using ChannelItems = Collection<T, W, M, ChannelId>;
//// MEMBER DATA ////
// Scalar data
NeutronInelasticScalars scalars;
// Microscopic (element) cross section data (G4PARTICLEXS/neutron/inelZ)
ElementItems<GenericGridData> micro_xs;
// Tabulated nucleon-nucleon cross section data
ChannelItems<GenericGridData> nucleon_xs;
// Parameters of necleon-nucleon cross sections below 10 MeV
ChannelItems<StepanovParameters> xs_params;
// Backend data
Items<real_type> reals;
//! Whether the data are assigned
explicit CELER_FUNCTION operator bool() const
{
return scalars && !micro_xs.empty() && !nucleon_xs.empty()
&& !xs_params.empty() && !reals.empty();
}
//! Assign from another set of data
template<Ownership W2, MemSpace M2>
NeutronInelasticData& operator=(NeutronInelasticData<W2, M2> const& other)
{
CELER_EXPECT(other);
scalars = other.scalars;
micro_xs = other.micro_xs;
nucleon_xs = other.nucleon_xs;
xs_params = other.xs_params;
reals = other.reals;
return *this;
}
};
using NeutronInelasticHostRef = HostCRef<NeutronInelasticData>;
using NeutronInelasticDeviceRef = DeviceCRef<NeutronInelasticData>;
using NeutronInelasticRef = NativeCRef<NeutronInelasticData>;
//---------------------------------------------------------------------------//
} // namespace celeritas