Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
MCGIDI::Sampling::Upscatter::ModelDBRC_data Class Reference

#include <MCGIDI_sampling.hpp>

Public Member Functions

LUPI_HOST_DEVICE ModelDBRC_data ()
LUPI_HOST ModelDBRC_data (double a_neutronMass, double a_targetMass, Vector< double > const &a_energies, Vector< double > const &a_crossSections, DomainHash const &a_domainHash)
LUPI_HOST_DEVICE ~ModelDBRC_data ()
LUPI_HOST_DEVICE double evaluate (double a_energy)
LUPI_HOST_DEVICE double targetThermalSpeed (double a_temperature)
LUPI_HOST_DEVICE double crossSectionMax (double a_energy, double a_targetThermalSpeed)
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)

Public Attributes

double m_neutronMass
double m_targetMass
Vector< double > m_energies
Vector< double > m_crossSections
Vector< std::size_t > m_hashIndices
MCGIDI::DomainHash m_domainHash

Detailed Description

This class is used to store the cross section for the elastic scattering upscatter model B with Doppler Broadening Rejection Correction (DBRC) with enum MCGIDI::Sampling::Upscatter::DBRC.

Definition at line 72 of file MCGIDI_sampling.hpp.

Constructor & Destructor Documentation

◆ ModelDBRC_data() [1/2]

LUPI_HOST_DEVICE MCGIDI::Sampling::Upscatter::ModelDBRC_data::ModelDBRC_data ( )

◆ ModelDBRC_data() [2/2]

LUPI_HOST MCGIDI::Sampling::Upscatter::ModelDBRC_data::ModelDBRC_data ( double a_neutronMass,
double a_targetMass,
Vector< double > const & a_energies,
Vector< double > const & a_crossSections,
DomainHash const & a_domainHash )

Definition at line 104 of file MCGIDI_sampling.cc.

105 :
106 m_neutronMass( a_neutronMass ),
107 m_targetMass( a_targetMass ),
108 m_energies( a_energies ),
109 m_crossSections( a_crossSections ),
110 m_hashIndices( a_domainHash.map( a_energies ) ),
111 m_domainHash( 4000, 1e-8, 10 ) {
112
113}

◆ ~ModelDBRC_data()

LUPI_HOST_DEVICE MCGIDI::Sampling::Upscatter::ModelDBRC_data::~ModelDBRC_data ( )

Definition at line 118 of file MCGIDI_sampling.cc.

118 {
119
120}

Member Function Documentation

◆ crossSectionMax()

LUPI_HOST_DEVICE double MCGIDI::Sampling::Upscatter::ModelDBRC_data::crossSectionMax ( double a_energy,
double a_targetThermalSpeed )

This method sets a_crossSectionMin and a_crossSectionMax to the minimum and maximum cross section values for the cross section in the window (a_speed - 4 * a_targetThermalSpeed) < speed < (a_speed + 4 * a_targetThermalSpeed). If (a_speed - 4 * a_targetThermalSpeed) is less than the lowest speed in the data, then it is replaced with the lowest speed.

Parameters
a_energy[in] The energy of the projectile (i.e., incident neutron).
a_targetThermalSpeed[in] The thermal speed of the target.
Returns
The maximum cross section in the search window.

Definition at line 164 of file MCGIDI_sampling.cc.

164 {
165
166 double crossSectionMax2 = 0.0;
167 double energyFraction;
168 double a_speed = MCGIDI_particleBeta( m_neutronMass, a_energy );
169
170 double speedMin = a_speed - 4 * a_targetThermalSpeed;
171 if( speedMin < 0.0 ) speedMin = 0.0;
172 double energyMin = 0.5 * m_neutronMass * speedMin * speedMin;
173 std::size_t hashIndex = m_domainHash.index( energyMin );
174 std::size_t indexMin = evaluationForHashIndex( hashIndex, m_hashIndices, energyMin, m_energies, &energyFraction );
175
176 double speedMax = a_speed + 4 * a_targetThermalSpeed;
177 double energyMax = 0.5 * m_neutronMass * speedMax * speedMax;
178 hashIndex = m_domainHash.index( energyMax );
179 std::size_t indexMax = evaluationForHashIndex( hashIndex, m_hashIndices, energyMax, m_energies, &energyFraction );
180 if( indexMax < m_energies.size( ) ) ++indexMax;
181
182 for( std::size_t index = indexMin; index < indexMax; ++index ) {
183 if( crossSectionMax2 < m_crossSections[index] ) crossSectionMax2 = m_crossSections[index];
184 }
185
186 return( crossSectionMax2 );
187}
#define MCGIDI_particleBeta(a_mass_unitOfEnergy, a_kineticEnergy)
Definition MCGIDI.hpp:71
LUPI_HOST_DEVICE std::size_t evaluationForHashIndex(std::size_t a_hashIndex, Vector< std::size_t > const &a_hashIndices, double a_energy, Vector< double > const &a_energies, double *a_energyFraction)

◆ evaluate()

LUPI_HOST_DEVICE double MCGIDI::Sampling::Upscatter::ModelDBRC_data::evaluate ( double a_energy)

This method returns the cross section evaluate at the projectile speed a_speed.

Parameters
a_temperature[in] The temperature of the target.
Returns
The thermal speed of the target.

Definition at line 130 of file MCGIDI_sampling.cc.

130 {
131
132 double energyFraction;
133 std::size_t hashIndex = m_domainHash.index( a_energy );
134 std::size_t index = evaluationForHashIndex( hashIndex, m_hashIndices, a_energy, m_energies, &energyFraction );
135
136 return( energyFraction * m_crossSections[index] + ( 1.0 - energyFraction ) * m_crossSections[index+1] );
137}

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::Sampling::Upscatter::ModelDBRC_data::serialize ( LUPI::DataBuffer & a_buffer,
LUPI::DataBuffer::Mode a_mode )

This method serializes this for broadcasting as needed for MPI and GPUs. The method can count the number of required bytes, pack this or unpack this depending on a_mode.

Parameters
a_buffer[in] The buffer to read or write data to depending on a_mode.
a_mode[in] Specifies the action of this method.

Definition at line 197 of file MCGIDI_sampling.cc.

197 {
198
199 DATA_MEMBER_DOUBLE( m_neutronMass, a_buffer, a_mode );
200 DATA_MEMBER_DOUBLE( m_targetMass, a_buffer, a_mode );
201 DATA_MEMBER_VECTOR_DOUBLE( m_energies, a_buffer, a_mode );
202 DATA_MEMBER_VECTOR_DOUBLE( m_crossSections, a_buffer, a_mode );
203 DATA_MEMBER_VECTOR_SIZE_T( m_hashIndices, a_buffer, a_mode );
204 m_domainHash.serialize( a_buffer, a_mode );
205}
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode)
#define DATA_MEMBER_VECTOR_SIZE_T(member, buf, mode)
#define DATA_MEMBER_DOUBLE(member, buf, mode)

Referenced by MCGIDI::Sampling::Upscatter::serializeModelDBRC_data().

◆ targetThermalSpeed()

LUPI_HOST_DEVICE double MCGIDI::Sampling::Upscatter::ModelDBRC_data::targetThermalSpeed ( double a_temperature)

This method returns the thermal speed of the target with temperature a_temperature.

Parameters
a_temperature[in] The temperature of the target.
Returns
The thermal speed of the target.

Definition at line 147 of file MCGIDI_sampling.cc.

147 {
148
149 return( sqrt( 2.0 * a_temperature / m_targetMass ) );
150}

Member Data Documentation

◆ m_crossSections

Vector<double> MCGIDI::Sampling::Upscatter::ModelDBRC_data::m_crossSections

The cross sections corresponding to the energy grid.

Definition at line 78 of file MCGIDI_sampling.hpp.

Referenced by crossSectionMax(), evaluate(), ModelDBRC_data(), ModelDBRC_data(), and serialize().

◆ m_domainHash

MCGIDI::DomainHash MCGIDI::Sampling::Upscatter::ModelDBRC_data::m_domainHash

The hash "function".

Definition at line 80 of file MCGIDI_sampling.hpp.

Referenced by crossSectionMax(), evaluate(), ModelDBRC_data(), and serialize().

◆ m_energies

Vector<double> MCGIDI::Sampling::Upscatter::ModelDBRC_data::m_energies

The energy grid for the cross section.

Definition at line 77 of file MCGIDI_sampling.hpp.

Referenced by crossSectionMax(), evaluate(), ModelDBRC_data(), ModelDBRC_data(), and serialize().

◆ m_hashIndices

Vector<std::size_t> MCGIDI::Sampling::Upscatter::ModelDBRC_data::m_hashIndices

The indicies for the energy hash function.

Definition at line 79 of file MCGIDI_sampling.hpp.

Referenced by crossSectionMax(), evaluate(), ModelDBRC_data(), ModelDBRC_data(), and serialize().

◆ m_neutronMass

double MCGIDI::Sampling::Upscatter::ModelDBRC_data::m_neutronMass

The mass of the neutron.

Definition at line 75 of file MCGIDI_sampling.hpp.

Referenced by crossSectionMax(), ModelDBRC_data(), ModelDBRC_data(), and serialize().

◆ m_targetMass

double MCGIDI::Sampling::Upscatter::ModelDBRC_data::m_targetMass

The mass of the target.

Definition at line 76 of file MCGIDI_sampling.hpp.

Referenced by ModelDBRC_data(), ModelDBRC_data(), serialize(), and targetThermalSpeed().


The documentation for this class was generated from the following files: