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

#include <MCGIDI.hpp>

Public Member Functions

LUPI_HOST_DEVICE HeatedCrossSectionsContinuousEnergy ()
LUPI_HOST_DEVICE ~HeatedCrossSectionsContinuousEnergy ()
LUPI_HOST_DEVICE void clear ()
LUPI_HOST void update (LUPI::StatusMessageReporting &a_smr, SetupInfo &a_setupInfo, Transporting::MC const &a_settings, GIDI::Transporting::Particles const &a_particles, DomainHash const &a_domainHash, GIDI::Styles::TemperatureInfos const &a_temperatureInfos, std::vector< GIDI::Reaction const * > const &a_reactions, std::vector< GIDI::Reaction const * > const &a_orphanProducts, bool a_fixedGrid, bool a_zeroReactions)
LUPI_HOST_DEVICE double minimumEnergy () const
LUPI_HOST_DEVICE double maximumEnergy () const
LUPI_HOST_DEVICE Vector< double > const & temperatures () const
Vector< HeatedCrossSectionContinuousEnergy * > & heatedCrossSections ()
LUPI_HOST_DEVICE double threshold (std::size_t a_index) const
LUPI_HOST_DEVICE bool hasURR_probabilityTables () const
LUPI_HOST_DEVICE double URR_domainMin () const
LUPI_HOST_DEVICE double URR_domainMax () const
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables (std::size_t a_index) const
LUPI_HOST_DEVICE double crossSection (URR_protareInfos const &a_URR_protareInfos, int a_URR_index, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling=false) const
LUPI_HOST_DEVICE void crossSectionVector (double a_temperature, double a_userFactor, std::size_t a_numberAllocated, double *a_crossSectionVector) const
LUPI_HOST GIDI::Functions::XYs1d crossSectionAsGIDI_XYs1d (double a_temperature) const
LUPI_HOST_DEVICE double reactionCrossSection (std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling=false) const
LUPI_HOST_DEVICE double reactionCrossSection (std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, double a_temperature, double a_energy_in) const
LUPI_HOST GIDI::Functions::XYs1d reactionCrossSectionAsGIDI_XYs1d (std::size_t a_reactionIndex, double a_temperature) const
template<typename RNG>
LUPI_HOST_DEVICE std::size_t sampleReaction (URR_protareInfos const &a_URR_protareInfos, int a_URR_index, std::size_t a_hashIndex, double a_temperature, double a_energy, double a_crossSection, RNG &&a_rng) const
LUPI_HOST_DEVICE double depositionEnergy (std::size_t a_hashIndex, double a_temperature, double a_energy) const
LUPI_HOST_DEVICE double depositionMomentum (std::size_t a_hashIndex, double a_temperature, double a_energy) const
LUPI_HOST_DEVICE double productionEnergy (std::size_t a_hashIndex, double a_temperature, double a_energy) const
LUPI_HOST_DEVICE double gain (std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex) const
LUPI_HOST_DEVICE double gainViaIntid (std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid) const
LUPI_HOST void setUserParticleIndex (int a_particleIndex, int a_userParticleIndex)
LUPI_HOST void setUserParticleIndexViaIntid (int a_particleIntid, int a_userParticleIndex)
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST void print (ProtareSingle const *a_protareSingle, std::string const &a_indent, std::string const &a_iFormat, std::string const &a_energyFormat, std::string const &a_dFormat) const

Detailed Description

Definition at line 689 of file MCGIDI.hpp.

Constructor & Destructor Documentation

◆ HeatedCrossSectionsContinuousEnergy()

LUPI_HOST_DEVICE MCGIDI::HeatedCrossSectionsContinuousEnergy::HeatedCrossSectionsContinuousEnergy ( )

Definition at line 1040 of file MCGIDI_heatedCrossSections.cc.

1040 :
1041 m_temperatures( ),
1042 m_thresholds( ),
1043 m_heatedCrossSections( ) {
1044
1045}

◆ ~HeatedCrossSectionsContinuousEnergy()

LUPI_HOST_DEVICE MCGIDI::HeatedCrossSectionsContinuousEnergy::~HeatedCrossSectionsContinuousEnergy ( )

Definition at line 1050 of file MCGIDI_heatedCrossSections.cc.

1050 {
1051
1052 clear( );
1053}

Member Function Documentation

◆ clear()

LUPI_HOST_DEVICE void MCGIDI::HeatedCrossSectionsContinuousEnergy::clear ( )

Definition at line 1058 of file MCGIDI_heatedCrossSections.cc.

1058 {
1059
1060 for( Vector<HeatedCrossSectionContinuousEnergy *>::const_iterator iter = m_heatedCrossSections.begin( ); iter != m_heatedCrossSections.end( ); ++iter ) delete *iter;
1061 m_heatedCrossSections.clear( );
1062}

Referenced by ~HeatedCrossSectionsContinuousEnergy().

◆ crossSection()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::crossSection ( URR_protareInfos const & a_URR_protareInfos,
int a_URR_index,
std::size_t a_hashIndex,
double a_temperature,
double a_energy,
bool a_sampling = false ) const

Returns the cross section for target temperature a_temperature and projectile energy a_energy.

Parameters
a_URR_protareInfos[in] URR information.
a_URR_index[in] If not negative, specifies the index in a_URR_protareInfos.
a_hashIndex[in] Specifies projectile energy hash index.
a_temperature[in] The temperature of the target.
a_energy[in] The energy of the projectile.
a_sampling[in] If true the cross section is to be used for sampling, otherwise, just for looking up.

Definition at line 1108 of file MCGIDI_heatedCrossSections.cc.

1109 {
1110
1111 double cross_section;
1112
1113 if( a_temperature <= m_temperatures[0] ) {
1114 cross_section = m_heatedCrossSections[0]->crossSection( a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling ); }
1115 else if( a_temperature >= m_temperatures.back( ) ) {
1116 cross_section = m_heatedCrossSections.back( )->crossSection( a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling ); }
1117 else {
1118 std::size_t i1;
1119 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1120 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1121 cross_section = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->crossSection( a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling )
1122 + fraction * m_heatedCrossSections[i1]->crossSection( a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling );
1123 }
1124
1125 return( cross_section );
1126}
LUPI_HOST_DEVICE double crossSection(URR_protareInfos const &a_URR_protareInfos, int a_URR_index, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling=false) const

Referenced by crossSection().

◆ crossSectionAsGIDI_XYs1d()

LUPI_HOST GIDI::Functions::XYs1d MCGIDI::HeatedCrossSectionsContinuousEnergy::crossSectionAsGIDI_XYs1d ( double a_temperature) const

Returns the total cross section as a GIDI::Functions::XYs1d instance.

Parameters
a_temperature[in] Specifies the temperature requested for the cross section.
Returns
A GIDI::Functions::XYs1d instance.

Definition at line 1174 of file MCGIDI_heatedCrossSections.cc.

1174 {
1175
1176 GIDI::Functions::XYs1d crossSection1;
1177
1178 if( a_temperature <= m_temperatures[0] ) {
1179 crossSection1 = m_heatedCrossSections[0]->crossSectionAsGIDI_XYs1d( ); }
1180 else if( a_temperature >= m_temperatures.back( ) ) {
1181 crossSection1 = m_heatedCrossSections.back( )->crossSectionAsGIDI_XYs1d( ); }
1182 else {
1183 std::size_t i1 = 0;
1184 for( ; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1185 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1186 crossSection1 = m_heatedCrossSections[i1-1]->crossSectionAsGIDI_XYs1d( );
1187 crossSection1 *= ( 1. - fraction );
1188 GIDI::Functions::XYs1d crossSection2( m_heatedCrossSections[i1-1]->crossSectionAsGIDI_XYs1d( ) );
1189 crossSection2 *= fraction;
1190 crossSection1 += crossSection2;
1191 }
1192
1193 return( crossSection1 );
1194}
LUPI_HOST GIDI::Functions::XYs1d crossSectionAsGIDI_XYs1d(double a_temperature) const

Referenced by crossSectionAsGIDI_XYs1d().

◆ crossSectionVector()

LUPI_HOST_DEVICE void MCGIDI::HeatedCrossSectionsContinuousEnergy::crossSectionVector ( double a_temperature,
double a_userFactor,
std::size_t a_numberAllocated,
double * a_crossSectionVector ) const

Adds the energy dependent, total cross section corresponding to the temperature a_temperature multiplied by a_userFactor to a_crossSectionVector. This function only works for fixed-grid data.

Parameters
a_temperature[in] Specifies the temperature of the material.
a_userFactor[in] User factor which all cross sections are multiplied by.
a_numberAllocated[in] The length of memory allocated for a_crossSectionVector.
a_crossSectionVector[in/out] The energy dependent, total cross section to add cross section data to.

Definition at line 1138 of file MCGIDI_heatedCrossSections.cc.

1139 {
1140
1141 std::size_t index1 = 0, index2 = 0;
1142 double fraction = 0.0;
1143
1144 if( a_temperature <= m_temperatures[0] ) {
1145 }
1146 else if( a_temperature >= m_temperatures.back( ) ) {
1147 index1 = index2 = m_temperatures.size( ) - 1;
1148 fraction = 1.0; }
1149 else {
1150 for( ; index2 < m_temperatures.size( ); ++index2 ) if( a_temperature < m_temperatures[index2] ) break;
1151 index1 = index2 - 1;
1152 fraction = ( a_temperature - m_temperatures[index1] ) / ( m_temperatures[index2] - m_temperatures[index1] );
1153 }
1154
1155 Vector<MCGIDI_FLOAT> &totalCrossSection1 = m_heatedCrossSections[index1]->totalCrossSection( );
1156 Vector<MCGIDI_FLOAT> &totalCrossSection2 = m_heatedCrossSections[index2]->totalCrossSection( );
1157 std::size_t size = totalCrossSection1.size( );
1158 double factor1 = a_userFactor * ( 1.0 - fraction ), factor2 = a_userFactor * fraction;
1159
1160 if( a_numberAllocated < totalCrossSection1.size( ) ) LUPI_THROW( "HeatedCrossSectionsContinuousEnergy::crossSectionVector: a_numberAllocated too small." );
1161 for( std::size_t i1 = 0; i1 < size; ++i1 ) {
1162 a_crossSectionVector[i1] += factor1 * totalCrossSection1[i1] + factor2 * totalCrossSection2[i1];
1163 }
1164}
#define LUPI_THROW(arg)

◆ depositionEnergy()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::depositionEnergy ( std::size_t a_hashIndex,
double a_temperature,
double a_energy ) const

Returns the deposition energy for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_hashIndex[in] Specifies projectile energy hash index.
a_temperature[in] The temperature of the target.
a_energy[in] The energy of the projectile.

Definition at line 1282 of file MCGIDI_heatedCrossSections.cc.

1282 {
1283
1284 double deposition_energy;
1285
1286 if( a_temperature <= m_temperatures[0] ) {
1287 deposition_energy = m_heatedCrossSections[0]->depositionEnergy( a_hashIndex, a_energy ); }
1288 else if( a_temperature >= m_temperatures.back( ) ) {
1289 deposition_energy = m_heatedCrossSections.back( )->depositionEnergy( a_hashIndex, a_energy ); }
1290 else {
1291 std::size_t i1;
1292 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1293 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1294 deposition_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->depositionEnergy( a_hashIndex, a_energy )
1295 + fraction * m_heatedCrossSections[i1]->depositionEnergy( a_hashIndex, a_energy );
1296 }
1297
1298 return( deposition_energy );
1299}
LUPI_HOST_DEVICE double depositionEnergy(std::size_t a_hashIndex, double a_temperature, double a_energy) const

Referenced by depositionEnergy().

◆ depositionMomentum()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::depositionMomentum ( std::size_t a_hashIndex,
double a_temperature,
double a_energy ) const

Returns the deposition momentum for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_hashIndex[in] Specifies projectile energy hash index.
a_temperature[in] The temperature of the target.
a_energy[in] The energy of the projectile.

Definition at line 1309 of file MCGIDI_heatedCrossSections.cc.

1309 {
1310
1311 double deposition_momentum;
1312
1313 if( a_temperature <= m_temperatures[0] ) {
1314 deposition_momentum = m_heatedCrossSections[0]->depositionMomentum( a_hashIndex, a_energy ); }
1315 else if( a_temperature >= m_temperatures.back( ) ) {
1316 deposition_momentum = m_heatedCrossSections.back( )->depositionMomentum( a_hashIndex, a_energy ); }
1317 else {
1318 std::size_t i1;
1319 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1320 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1321 deposition_momentum = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->depositionMomentum( a_hashIndex, a_energy )
1322 + fraction * m_heatedCrossSections[i1]->depositionMomentum( a_hashIndex, a_energy );
1323 }
1324
1325 return( deposition_momentum );
1326}
LUPI_HOST_DEVICE double depositionMomentum(std::size_t a_hashIndex, double a_temperature, double a_energy) const

Referenced by depositionMomentum().

◆ gain()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::gain ( std::size_t a_hashIndex,
double a_temperature,
double a_energy,
int a_particleIndex ) const

Returns the gain for particle with index a_particleIndex for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_hashIndex[in] Specifies projectile energy hash index.
a_temperature[in] The temperature of the target.
a_energy[in] The energy of the projectile.
a_particleIndex[in] The index of the particle whose gain is requested.

Definition at line 1364 of file MCGIDI_heatedCrossSections.cc.

1365 {
1366
1367 double production_energy;
1368
1369 if( a_temperature <= m_temperatures[0] ) {
1370 production_energy = m_heatedCrossSections[0]->gain( a_hashIndex, a_energy, a_particleIndex ); }
1371 else if( a_temperature >= m_temperatures.back( ) ) {
1372 production_energy = m_heatedCrossSections.back( )->gain( a_hashIndex, a_energy, a_particleIndex ); }
1373 else {
1374 std::size_t i1;
1375 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1376 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1377 production_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->gain( a_hashIndex, a_energy, a_particleIndex )
1378 + fraction * m_heatedCrossSections[i1]->gain( a_hashIndex, a_energy, a_particleIndex );
1379 }
1380
1381 return( production_energy );
1382}
LUPI_HOST_DEVICE double gain(std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIndex) const

Referenced by gain().

◆ gainViaIntid()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::gainViaIntid ( std::size_t a_hashIndex,
double a_temperature,
double a_energy,
int a_particleIntid ) const

Returns the gain for particle with intid a_particleIntid for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_hashIndex[in] Specifies projectile energy hash index.
a_temperature[in] The temperature of the target.
a_energy[in] The energy of the projectile.
a_particleIntid[in] The intid of the particle whose gain is requested.

Definition at line 1393 of file MCGIDI_heatedCrossSections.cc.

1394 {
1395
1396 double production_energy;
1397
1398 if( a_temperature <= m_temperatures[0] ) {
1399 production_energy = m_heatedCrossSections[0]->gainViaIntid( a_hashIndex, a_energy, a_particleIntid ); }
1400 else if( a_temperature >= m_temperatures.back( ) ) {
1401 production_energy = m_heatedCrossSections.back( )->gainViaIntid( a_hashIndex, a_energy, a_particleIntid ); }
1402 else {
1403 std::size_t i1;
1404 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1405 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1406 production_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->gainViaIntid( a_hashIndex, a_energy, a_particleIntid )
1407 + fraction * m_heatedCrossSections[i1]->gainViaIntid( a_hashIndex, a_energy, a_particleIntid );
1408 }
1409
1410 return( production_energy );
1411}
LUPI_HOST_DEVICE double gainViaIntid(std::size_t a_hashIndex, double a_temperature, double a_energy, int a_particleIntid) const

Referenced by gainViaIntid().

◆ hasURR_probabilityTables()

LUPI_HOST_DEVICE bool MCGIDI::HeatedCrossSectionsContinuousEnergy::hasURR_probabilityTables ( ) const
inline

Definition at line 714 of file MCGIDI.hpp.

714{ return( m_heatedCrossSections[0]->hasURR_probabilityTables( ) ); }
LUPI_HOST_DEVICE bool hasURR_probabilityTables() const
Definition MCGIDI.hpp:714

Referenced by hasURR_probabilityTables().

◆ heatedCrossSections()

Vector< HeatedCrossSectionContinuousEnergy * > & MCGIDI::HeatedCrossSectionsContinuousEnergy::heatedCrossSections ( )
inline

Definition at line 711 of file MCGIDI.hpp.

711{ return( m_heatedCrossSections ); }

Referenced by print().

◆ maximumEnergy()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::maximumEnergy ( ) const
inline

Returns the maximum cross section domain.

Definition at line 708 of file MCGIDI.hpp.

Referenced by maximumEnergy().

◆ minimumEnergy()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::minimumEnergy ( ) const
inline

Returns the minimum cross section domain.

Definition at line 706 of file MCGIDI.hpp.

Referenced by minimumEnergy().

◆ print()

LUPI_HOST void MCGIDI::HeatedCrossSectionsContinuousEnergy::print ( ProtareSingle const * a_protareSingle,
std::string const & a_indent,
std::string const & a_iFormat,
std::string const & a_energyFormat,
std::string const & a_dFormat ) const

Print to std::cout the content of this. This is mainly meant for debugging.

Parameters
a_protareSingle[in] The GIDI::ProtareSingle instance that contains this.
a_indent[in] The buffer to read or write data to depending on a_mode.
a_iFormat[in] C printf format specifier for any interger that is printed (e.g., "%3d").
a_energyFormat[in] C printf format specifier for any interger that is printed (e.g., "%20.12e").
a_dFormat[in] C printf format specifier for any interger that is printed (e.g., "%14.7e").

Definition at line 1483 of file MCGIDI_heatedCrossSections.cc.

1484 {
1485
1486 std::cout << "Temperatures present:" << std::endl;
1487 for( auto temperatureIter = m_temperatures.begin( ); temperatureIter != m_temperatures.end( ); ++temperatureIter ) {
1488 std::cout << LUPI::Misc::argumentsToString( a_dFormat.c_str( ), *temperatureIter ) << std::endl;
1489 }
1490 std::cout << "Reaction thresholds:" << std::endl;
1491 for( auto reactionIter = m_thresholds.begin( ); reactionIter != m_thresholds.end( ); ++reactionIter ) {
1492 std::cout << LUPI::Misc::argumentsToString( a_dFormat.c_str( ), *reactionIter ) << std::endl;
1493 }
1494 for( auto heatedCrossSections = m_heatedCrossSections.begin( ); heatedCrossSections != m_heatedCrossSections.end( ); ++heatedCrossSections ) {
1495 (*heatedCrossSections)->print( a_protareSingle, a_indent, a_iFormat, a_energyFormat, a_dFormat );
1496 }
1497}
Vector< HeatedCrossSectionContinuousEnergy * > & heatedCrossSections()
Definition MCGIDI.hpp:711
std::string argumentsToString(char const *a_format,...)
Definition LUPI_misc.cc:305

◆ productionEnergy()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::productionEnergy ( std::size_t a_hashIndex,
double a_temperature,
double a_energy ) const

Returns the production momentum for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_hashIndex[in] Specifies projectile energy hash index.
a_temperature[in] The temperature of the target.
a_energy[in] The energy of the projectile.

Definition at line 1336 of file MCGIDI_heatedCrossSections.cc.

1336 {
1337
1338 double production_energy;
1339
1340 if( a_temperature <= m_temperatures[0] ) {
1341 production_energy = m_heatedCrossSections[0]->productionEnergy( a_hashIndex, a_energy ); }
1342 else if( a_temperature >= m_temperatures.back( ) ) {
1343 production_energy = m_heatedCrossSections.back( )->productionEnergy( a_hashIndex, a_energy ); }
1344 else {
1345 std::size_t i1;
1346 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1347 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1348 production_energy = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->productionEnergy( a_hashIndex, a_energy )
1349 + fraction * m_heatedCrossSections[i1]->productionEnergy( a_hashIndex, a_energy );
1350 }
1351
1352 return( production_energy );
1353}
LUPI_HOST_DEVICE double productionEnergy(std::size_t a_hashIndex, double a_temperature, double a_energy) const

Referenced by productionEnergy().

◆ reactionCrossSection() [1/2]

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::reactionCrossSection ( std::size_t a_reactionIndex,
URR_protareInfos const & a_URR_protareInfos,
int a_URR_index,
double a_temperature,
double a_energy_in ) const

Definition at line 1254 of file MCGIDI_heatedCrossSections.cc.

1255 {
1256
1257 double cross_section;
1258
1259 if( a_temperature <= m_temperatures[0] ) {
1260 cross_section = m_heatedCrossSections[0]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_energy_in ); }
1261 else if( a_temperature >= m_temperatures.back( ) ) {
1262 cross_section = m_heatedCrossSections.back( )->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_energy_in ); }
1263 else {
1264 std::size_t i1;
1265 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1266 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1267 cross_section = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_energy_in )
1268 + fraction * m_heatedCrossSections[i1]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_energy_in );
1269 }
1270
1271 return( cross_section );
1272}
LUPI_HOST_DEVICE double reactionCrossSection(std::size_t a_reactionIndex, URR_protareInfos const &a_URR_protareInfos, int a_URR_index, std::size_t a_hashIndex, double a_temperature, double a_energy, bool a_sampling=false) const

◆ reactionCrossSection() [2/2]

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::reactionCrossSection ( std::size_t a_reactionIndex,
URR_protareInfos const & a_URR_protareInfos,
int a_URR_index,
std::size_t a_hashIndex,
double a_temperature,
double a_energy,
bool a_sampling = false ) const

Definition at line 1231 of file MCGIDI_heatedCrossSections.cc.

1232 {
1233
1234 double cross_section;
1235
1236 if( a_temperature <= m_temperatures[0] ) {
1237 cross_section = m_heatedCrossSections[0]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling ); }
1238 else if( a_temperature >= m_temperatures.back( ) ) {
1239 cross_section = m_heatedCrossSections.back( )->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling ); }
1240 else {
1241 std::size_t i1;
1242 for( i1 = 0; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1243 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1244 cross_section = ( 1. - fraction ) * m_heatedCrossSections[i1-1]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling )
1245 + fraction * m_heatedCrossSections[i1]->reactionCrossSection( a_reactionIndex, a_URR_protareInfos, a_URR_index, a_hashIndex, a_energy, a_sampling );
1246 }
1247
1248 return( cross_section );
1249}

Referenced by reactionCrossSection(), and reactionCrossSection().

◆ reactionCrossSectionAsGIDI_XYs1d()

LUPI_HOST GIDI::Functions::XYs1d MCGIDI::HeatedCrossSectionsContinuousEnergy::reactionCrossSectionAsGIDI_XYs1d ( std::size_t a_reactionIndex,
double a_temperature ) const

Returns the reaction's cross section as GIDI::Functions::XYs1d instance.

Parameters
a_reactionIndex[in] Specifies the indexs of the reaction whose cross section is requested.
a_temperature[in] Specifies the temperature requested for the cross section.
Returns
A GIDI::Functions::XYs1d instance.

Definition at line 1205 of file MCGIDI_heatedCrossSections.cc.

1206 {
1207
1208 GIDI::Functions::XYs1d crossSection1;
1209
1210 if( a_temperature <= m_temperatures[0] ) {
1211 crossSection1 = m_heatedCrossSections[0]->reactionCrossSectionAsGIDI_XYs1d( a_reactionIndex ); }
1212 else if( a_temperature >= m_temperatures.back( ) ) {
1213 crossSection1 = m_heatedCrossSections.back( )->reactionCrossSectionAsGIDI_XYs1d( a_reactionIndex ); }
1214 else {
1215 std::size_t i1 = 0;
1216 for( ; i1 < m_temperatures.size( ); ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
1217 double fraction = ( a_temperature - m_temperatures[i1-1] ) / ( m_temperatures[i1] - m_temperatures[i1-1] );
1218 crossSection1 = m_heatedCrossSections[i1-1]->reactionCrossSectionAsGIDI_XYs1d( a_reactionIndex );
1219 crossSection1 *= ( 1. - fraction );
1220 GIDI::Functions::XYs1d crossSection2( m_heatedCrossSections[i1-1]->reactionCrossSectionAsGIDI_XYs1d( a_reactionIndex ) );
1221 crossSection2 *= fraction;
1222 crossSection1 += crossSection2;
1223 }
1224
1225 return( crossSection1 );
1226}
LUPI_HOST GIDI::Functions::XYs1d reactionCrossSectionAsGIDI_XYs1d(std::size_t a_reactionIndex, double a_temperature) const

Referenced by reactionCrossSectionAsGIDI_XYs1d().

◆ reactionHasURR_probabilityTables()

LUPI_HOST_DEVICE bool MCGIDI::HeatedCrossSectionsContinuousEnergy::reactionHasURR_probabilityTables ( std::size_t a_index) const
inline

Definition at line 717 of file MCGIDI.hpp.

717{ return( m_heatedCrossSections[0]->reactionHasURR_probabilityTables( a_index ) ); }
LUPI_HOST_DEVICE bool reactionHasURR_probabilityTables(std::size_t a_index) const
Definition MCGIDI.hpp:717

Referenced by reactionHasURR_probabilityTables().

◆ sampleReaction()

template<typename RNG>
LUPI_HOST_DEVICE std::size_t MCGIDI::HeatedCrossSectionsContinuousEnergy::sampleReaction ( URR_protareInfos const & a_URR_protareInfos,
int a_URR_index,
std::size_t a_hashIndex,
double a_temperature,
double a_energy,
double a_crossSection,
RNG && a_rng ) const
inline

Returns the requested reaction's multi-group cross section for target temperature a_temperature and projectile multi-group a_hashIndex.

Parameters
a_URR_protareInfos[in] URR information.
a_URR_index[in] If not negative, specifies the index in a_URR_protareInfos.
a_hashIndex[in] Specifies projectile energy hash index.
a_temperature[in] The temperature of the target.
a_energy[in] The energy of the projectile.
a_crossSection[in] The total cross section for the protare at a_temperature and a_energy.
a_rng[in] The random number generator function that returns a double in the range [0, 1.0).

Definition at line 2187 of file MCGIDI_headerSource.hpp.

2188 {
2189
2190 std::size_t sampled_reaction_index, temperatureIndex1, temperatureIndex2, number_of_temperatures = m_temperatures.size( );
2191 double sampleCrossSection = a_crossSection * a_rng( );
2192
2193 if( a_temperature <= m_temperatures[0] ) {
2194 temperatureIndex1 = 0;
2195 temperatureIndex2 = temperatureIndex1; }
2196 else if( a_temperature >= m_temperatures.back( ) ) {
2197 temperatureIndex1 = m_temperatures.size( ) - 1;
2198 temperatureIndex2 = temperatureIndex1; }
2199 else {
2200 std::size_t i1 = 0;
2201 for( ; i1 < number_of_temperatures; ++i1 ) if( a_temperature < m_temperatures[i1] ) break;
2202 temperatureIndex1 = i1 - 1;
2203 temperatureIndex2 = i1;
2204 }
2205
2206 std::size_t numberOfReactions = m_heatedCrossSections[0]->numberOfReactions( );
2207 double energyFraction1, energyFraction2, crossSectionSum = 0.0;
2208
2209 HeatedCrossSectionContinuousEnergy &heatedCrossSection1 = *m_heatedCrossSections[temperatureIndex1];
2210 std::size_t energyIndex1 = heatedCrossSection1.evaluationInfo( a_hashIndex, a_energy, &energyFraction1 );
2211
2212 if( temperatureIndex1 == temperatureIndex2 ) {
2213 for( sampled_reaction_index = 0; sampled_reaction_index < numberOfReactions; ++sampled_reaction_index ) {
2214 crossSectionSum += heatedCrossSection1.reactionCrossSection2( sampled_reaction_index, a_URR_protareInfos, a_URR_index, a_energy,
2215 energyIndex1, energyFraction1 );
2216 if( crossSectionSum >= sampleCrossSection ) break;
2217 } }
2218 else {
2219 double temperatureFraction2 = ( a_temperature - m_temperatures[temperatureIndex1] )
2220 / ( m_temperatures[temperatureIndex2] - m_temperatures[temperatureIndex1] );
2221 double temperatureFraction1 = 1.0 - temperatureFraction2;
2222 HeatedCrossSectionContinuousEnergy &heatedCrossSection2 = *m_heatedCrossSections[temperatureIndex2];
2223 std::size_t energyIndex2 = heatedCrossSection2.evaluationInfo( a_hashIndex, a_energy, &energyFraction2 );
2224
2225 for( sampled_reaction_index = 0; sampled_reaction_index < numberOfReactions; ++sampled_reaction_index ) {
2226 if( m_thresholds[sampled_reaction_index] >= a_energy ) continue;
2227 crossSectionSum += temperatureFraction1 * heatedCrossSection1.reactionCrossSection2( sampled_reaction_index, a_URR_protareInfos,
2228 a_URR_index, a_energy, energyIndex1, energyFraction1 );
2229 crossSectionSum += temperatureFraction2 * heatedCrossSection2.reactionCrossSection2( sampled_reaction_index, a_URR_protareInfos,
2230 a_URR_index, a_energy, energyIndex2, energyFraction2 );
2231 if( crossSectionSum >= sampleCrossSection ) break;
2232 }
2233 }
2234
2235 if( sampled_reaction_index == numberOfReactions ) {
2236 if( crossSectionSum < ( 1.0 - crossSectionSumError ) * a_crossSection ) {
2237#if LUPI_ON_GPU
2238 MCGIDI_PRINTF( "HeatedCrossSectionsContinuousEnergy::sampleReaction: crossSectionSum %.17e less than a_crossSection = %.17e.",
2239 crossSectionSum, a_crossSection );
2240#else
2241 std::string errorString = "HeatedCrossSectionsContinuousEnergy::sampleReaction: crossSectionSum "
2242 + LUPI::Misc::doubleToString3( "%.17e", crossSectionSum ) + " less than a_crossSection = "
2243 + LUPI::Misc::doubleToString3( "%.17e", a_crossSection ) + ".";
2244 LUPI_THROW( errorString.c_str( ) );
2245#endif
2246 }
2247 for( sampled_reaction_index = 0; sampled_reaction_index < numberOfReactions; ++sampled_reaction_index ) { // This should rarely happen so just pick the first reaction with non-zero cross section.
2248 if( heatedCrossSection1.reactionCrossSection2( sampled_reaction_index, a_URR_protareInfos, a_URR_index, a_energy, energyIndex1,
2249 energyFraction1, true ) > 0 ) break;
2250 }
2251 }
2252
2253 return( sampled_reaction_index );
2254}
#define MCGIDI_PRINTF
Definition MCGIDI.hpp:40
#define crossSectionSumError
std::string doubleToString3(char const *a_format, double a_value, bool a_reduceBits=false)
Definition LUPI_misc.cc:327

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::HeatedCrossSectionsContinuousEnergy::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 1445 of file MCGIDI_heatedCrossSections.cc.

1445 {
1446
1447 DATA_MEMBER_VECTOR_DOUBLE( m_temperatures, a_buffer, a_mode );
1448 DATA_MEMBER_VECTOR_DOUBLE( m_thresholds, a_buffer, a_mode );
1449
1450 std::size_t vectorSize = m_heatedCrossSections.size( );
1451 int vectorSizeInt = (int) vectorSize;
1452 DATA_MEMBER_INT( vectorSizeInt, a_buffer, a_mode );
1453 vectorSize = (std::size_t) vectorSizeInt;
1454
1455 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) m_heatedCrossSections.resize( vectorSize, &a_buffer.m_placement );
1456 if( a_mode == LUPI::DataBuffer::Mode::Memory ) a_buffer.m_placement += m_heatedCrossSections.internalSize();
1457 for( std::size_t memberIndex = 0; memberIndex < vectorSize; ++memberIndex ) {
1458 if( a_mode == LUPI::DataBuffer::Mode::Unpack ) {
1459 if( a_buffer.m_placement != nullptr ) {
1460 m_heatedCrossSections[memberIndex] = new(a_buffer.m_placement) HeatedCrossSectionContinuousEnergy;
1461 a_buffer.incrementPlacement( sizeof( HeatedCrossSectionContinuousEnergy ) ); }
1462 else {
1463 m_heatedCrossSections[memberIndex] = new HeatedCrossSectionContinuousEnergy;
1464 }
1465 }
1466 if( a_mode == LUPI::DataBuffer::Mode::Memory ) {
1467 a_buffer.incrementPlacement( sizeof( HeatedCrossSectionContinuousEnergy ) );
1468 }
1469 m_heatedCrossSections[memberIndex]->serialize( a_buffer, a_mode );
1470 }
1471}
#define DATA_MEMBER_VECTOR_DOUBLE(member, buf, mode)
#define DATA_MEMBER_INT( member, buf, mode)
LUPI_HOST_DEVICE void incrementPlacement(std::size_t a_delta)

◆ setUserParticleIndex()

LUPI_HOST void MCGIDI::HeatedCrossSectionsContinuousEnergy::setUserParticleIndex ( int a_particleIndex,
int a_userParticleIndex )

Updates the m_userParticleIndex to a_userParticleIndex for all particles with PoPs index a_particleIndex.

Parameters
a_particleIndex[in] The index of the particle whose user index is to be set.
a_userParticleIndex[in] The particle index specified by the user.

Definition at line 1420 of file MCGIDI_heatedCrossSections.cc.

1420 {
1421
1422 for( auto iter = m_heatedCrossSections.begin( ); iter != m_heatedCrossSections.end( ); ++iter ) (*iter)->setUserParticleIndex( a_particleIndex, a_userParticleIndex );
1423}

◆ setUserParticleIndexViaIntid()

LUPI_HOST void MCGIDI::HeatedCrossSectionsContinuousEnergy::setUserParticleIndexViaIntid ( int a_particleIntid,
int a_userParticleIndex )

Updates the m_userParticleIndex to a_userParticleIndex for all particles with PoPs intid a_particleIntid.

Parameters
a_particleIntid[in] The intid of the particle whose user index is to be set.
a_userParticleIndex[in] The particle index specified by the user.

Definition at line 1432 of file MCGIDI_heatedCrossSections.cc.

1432 {
1433
1434 for( auto iter = m_heatedCrossSections.begin( ); iter != m_heatedCrossSections.end( ); ++iter ) (*iter)->setUserParticleIndexViaIntid( a_particleIntid, a_userParticleIndex );
1435}

◆ temperatures()

LUPI_HOST_DEVICE Vector< double > const & MCGIDI::HeatedCrossSectionsContinuousEnergy::temperatures ( ) const
inline

Returns the value of the m_temperatures.

Definition at line 710 of file MCGIDI.hpp.

◆ threshold()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::threshold ( std::size_t a_index) const
inline

Returns the threshold for the reaction at index a_index.

Definition at line 713 of file MCGIDI.hpp.

Referenced by update().

◆ update()

LUPI_HOST void MCGIDI::HeatedCrossSectionsContinuousEnergy::update ( LUPI::StatusMessageReporting & a_smr,
SetupInfo & a_setupInfo,
Transporting::MC const & a_settings,
GIDI::Transporting::Particles const & a_particles,
DomainHash const & a_domainHash,
GIDI::Styles::TemperatureInfos const & a_temperatureInfos,
std::vector< GIDI::Reaction const * > const & a_reactions,
std::vector< GIDI::Reaction const * > const & a_orphanProducts,
bool a_fixedGrid,
bool a_zeroReactions )

Fills in this with the requested temperature data.

Parameters
a_smr[Out] If errors are not to be thrown, then the error is reported via this instance.
a_setupInfo[in] Used internally when constructing a Protare to pass information to other components.
a_settings[in] Used to pass user options to the this to instruct it which data are desired.
a_particles[in] List of transporting particles and their information (e.g., multi-group boundaries and fluxes).
a_domainHash[in] The hash data used when looking up a cross section.
a_temperatureInfos[in] The list of temperatures to use.
a_reactions[in] The list of reactions to use.
a_orphanProducts[in] The list of orphan products to use.
a_fixedGrid[in] If true, the specified fixed grid is used; otherwise, grid in the file is used.
a_zeroReactions[in] Special case where no reaction in a protare is wanted so the first one is used but its cross section is set to 0.0 at all energies.

Definition at line 1079 of file MCGIDI_heatedCrossSections.cc.

1082 {
1083
1084 m_temperatures.reserve( a_temperatureInfos.size( ) );
1085 m_heatedCrossSections.reserve( a_temperatureInfos.size( ) );
1086
1087 for( GIDI::Styles::TemperatureInfos::const_iterator iter = a_temperatureInfos.begin( ); iter != a_temperatureInfos.end( ); ++iter ) {
1088 m_temperatures.push_back( iter->temperature( ).value( ) );
1089 m_heatedCrossSections.push_back( new HeatedCrossSectionContinuousEnergy( a_setupInfo, a_settings, a_particles, a_domainHash, *iter,
1090 a_reactions, a_orphanProducts, a_fixedGrid, a_zeroReactions ) );
1091 }
1092
1093 m_thresholds.resize( m_heatedCrossSections[0]->numberOfReactions( ) );
1094 for( std::size_t i1 = 0; i1 < m_heatedCrossSections[0]->numberOfReactions( ); ++i1 ) m_thresholds[i1] = m_heatedCrossSections[0]->threshold( i1 );
1095}
LUPI_HOST_DEVICE double threshold(std::size_t a_index) const
Definition MCGIDI.hpp:713

◆ URR_domainMax()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::URR_domainMax ( ) const
inline

Definition at line 716 of file MCGIDI.hpp.

716{ return( m_heatedCrossSections[0]->URR_domainMax( ) ); }
LUPI_HOST_DEVICE double URR_domainMax() const
Definition MCGIDI.hpp:716

Referenced by URR_domainMax().

◆ URR_domainMin()

LUPI_HOST_DEVICE double MCGIDI::HeatedCrossSectionsContinuousEnergy::URR_domainMin ( ) const
inline

Definition at line 715 of file MCGIDI.hpp.

715{ return( m_heatedCrossSections[0]->URR_domainMin( ) ); }
LUPI_HOST_DEVICE double URR_domainMin() const
Definition MCGIDI.hpp:715

Referenced by URR_domainMin().


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