File indexing completed on 2025-02-22 10:31:15
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include "corecel/Macros.hh"
0011 #include "corecel/cont/Array.hh"
0012 #include "corecel/data/Collection.hh"
0013 #include "celeritas/Quantities.hh"
0014 #include "celeritas/Types.hh"
0015 #include "celeritas/grid/XsGridData.hh"
0016
0017 #include "CommonCoulombData.hh"
0018
0019 namespace celeritas
0020 {
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 struct UrbanMscParameters
0031 {
0032 using Energy = units::MevEnergy;
0033
0034 real_type tau_small{1e-16};
0035 real_type tau_big{8};
0036 real_type tau_limit{1e-6};
0037 real_type safety_tol{0.01};
0038 real_type geom_limit{5e-8 * units::millimeter};
0039 Energy low_energy_limit{0};
0040 Energy high_energy_limit{0};
0041
0042
0043 static CELER_CONSTEXPR_FUNCTION real_type dtrl() { return 0.05; }
0044
0045
0046 static CELER_CONSTEXPR_FUNCTION real_type limit_min_fix()
0047 {
0048 return real_type(0.01) * units::nanometer;
0049 }
0050
0051
0052 static CELER_CONSTEXPR_FUNCTION real_type limit_min()
0053 {
0054 return 10 * limit_min_fix();
0055 }
0056
0057
0058 static CELER_CONSTEXPR_FUNCTION real_type min_step()
0059 {
0060 return 1 * units::nanometer;
0061 }
0062
0063
0064 static CELER_CONSTEXPR_FUNCTION Energy min_sampling_energy()
0065 {
0066 return units::MevEnergy{1e-6};
0067 }
0068
0069
0070 static CELER_CONSTEXPR_FUNCTION Energy min_scaling_energy()
0071 {
0072 return units::MevEnergy(5e-3);
0073 }
0074 };
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085 struct UrbanMscMaterialData
0086 {
0087 using Real2 = Array<real_type, 2>;
0088 using Real3 = Array<real_type, 3>;
0089
0090
0091 Real2 stepmin_coeff{0, 0};
0092
0093
0094 Real2 theta_coeff{0, 0};
0095 Real3 tail_coeff{0, 0, 0};
0096 real_type tail_corr{0};
0097 };
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110 struct UrbanMscParMatData
0111 {
0112 real_type scaled_zeff{};
0113 real_type d_over_r{};
0114
0115
0116 explicit CELER_FUNCTION operator bool() const { return scaled_zeff > 0; }
0117 };
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127 template<Ownership W, MemSpace M>
0128 struct UrbanMscData
0129 {
0130
0131
0132 template<class T>
0133 using Items = Collection<T, W, M>;
0134 template<class T>
0135 using MaterialItems = celeritas::Collection<T, W, M, MaterialId>;
0136
0137
0138
0139
0140 CoulombIds ids;
0141
0142 units::MevMass electron_mass;
0143
0144 UrbanMscParameters params;
0145
0146 MaterialItems<UrbanMscMaterialData> material_data;
0147
0148 Items<UrbanMscParMatData> par_mat_data;
0149
0150 Items<XsGridData> xs;
0151
0152
0153 Items<real_type> reals;
0154
0155
0156
0157
0158 explicit CELER_FUNCTION operator bool() const
0159 {
0160 return ids && electron_mass > zero_quantity() && !material_data.empty()
0161 && !par_mat_data.empty() && !xs.empty() && !reals.empty();
0162 }
0163
0164
0165 template<Ownership W2, MemSpace M2>
0166 UrbanMscData& operator=(UrbanMscData<W2, M2> const& other)
0167 {
0168 CELER_EXPECT(other);
0169 ids = other.ids;
0170 electron_mass = other.electron_mass;
0171 params = other.params;
0172 material_data = other.material_data;
0173 par_mat_data = other.par_mat_data;
0174 xs = other.xs;
0175 reals = other.reals;
0176 return *this;
0177 }
0178
0179
0180 template<class T>
0181 CELER_FUNCTION ItemId<T> at(MaterialId mat, ParticleId par) const
0182 {
0183 CELER_EXPECT(mat && par);
0184 size_type result = mat.unchecked_get() * 2;
0185 result += (par == this->ids.electron ? 0 : 1);
0186 CELER_ENSURE(result < this->par_mat_data.size());
0187 return ItemId<T>{result};
0188 }
0189 };
0190
0191 }