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

#include <MCGIDI_distributions.hpp>

Inheritance diagram for MCGIDI::Distributions::IncoherentElasticTNSL:

Public Member Functions

LUPI_HOST_DEVICE IncoherentElasticTNSL ()
LUPI_HOST IncoherentElasticTNSL (GIDI::DoubleDifferentialCrossSection::n_ThermalNeutronScatteringLaw::IncoherentElastic const *a_incoherentElasticTNSL, SetupInfo &a_setupInfo)
LUPI_HOST_DEVICE ~IncoherentElasticTNSL ()
template<typename RNG>
LUPI_HOST_DEVICE void sample (double a_energy, Sampling::Input &a_input, RNG &&a_rng) const
template<typename RNG>
LUPI_HOST_DEVICE double angleBiasing (Reaction const *a_reaction, double a_temperature, double a_energy_in, double a_mu_lab, RNG &&a_rng, double &a_energy_out) const
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
Functions::Function1dDebyeWallerIntegral ()
Functions::Function1d const * DebyeWallerIntegral () const
template<typename RNG>
LUPI_HOST_DEVICE double angleBiasing (LUPI_maybeUnused Reaction const *a_reaction, double a_temperature, double a_energy_in, double a_mu_lab, LUPI_maybeUnused RNG &&a_rng, double &a_energy_out) const
Public Member Functions inherited from MCGIDI::Distributions::Distribution
LUPI_HOST_DEVICE Distribution ()
LUPI_HOST Distribution (Type a_type, GIDI::Distributions::Distribution const &a_distribution, SetupInfo &a_setupInfo)
LUPI_HOST Distribution (Type a_type, GIDI::Frame a_productFrame, SetupInfo &a_setupInfo)
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION ~Distribution () MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE Type type () const
LUPI_HOST_DEVICE GIDI::Frame productFrame () const
LUPI_HOST_DEVICE double projectileMass () const
LUPI_HOST_DEVICE double targetMass () const
LUPI_HOST_DEVICE double productMass () const
LUPI_HOST void setModelDBRC_data (Sampling::Upscatter::ModelDBRC_data *a_modelDBRC_data)
template<typename RNG>
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION void sample (double a_X, Sampling::Input &a_input, RNG &&a_rng) const MCGIDI_TRUE_VIRTUAL
template<typename RNG>
LUPI_HOST_DEVICE MCGIDI_VIRTUAL_FUNCTION double angleBiasing (Reaction const *a_reaction, double a_temperature, double a_energy_in, double a_mu_lab, RNG &&a_rng, double &a_energy_out) const MCGIDI_TRUE_VIRTUAL
LUPI_HOST_DEVICE void serialize (LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
template<typename RNG>
LUPI_HOST_DEVICE void sample (double a_X, MCGIDI::Sampling::Input &a_input, RNG &&a_rng) const
template<typename RNG>
LUPI_HOST_DEVICE double angleBiasing (Reaction const *a_reaction, double a_temperature, double a_energy_in, double a_mu_lab, RNG &&a_rng, double &a_energy_out) const

Detailed Description

This class represents the distribution for an outgoing product whose distribution is TNSL incoherent elastic scattering. This class samples directly from the Debye/Waller function.

Definition at line 409 of file MCGIDI_distributions.hpp.

Constructor & Destructor Documentation

◆ IncoherentElasticTNSL() [1/2]

LUPI_HOST_DEVICE MCGIDI::Distributions::IncoherentElasticTNSL::IncoherentElasticTNSL ( )

Constructor for the IncoherentElasticTNSL class.

Definition at line 1337 of file MCGIDI_distributions.cc.

1337 :
1338 m_temperatureToMeV_K( 1.0 ),
1339 m_DebyeWallerIntegral( nullptr ) {
1340
1341}

◆ IncoherentElasticTNSL() [2/2]

LUPI_HOST MCGIDI::Distributions::IncoherentElasticTNSL::IncoherentElasticTNSL ( GIDI::DoubleDifferentialCrossSection::n_ThermalNeutronScatteringLaw::IncoherentElastic const * a_incoherentElasticTNSL,
SetupInfo & a_setupInfo )

Constructor for the IncoherentElasticTNSL class.

Parameters
a_incoherentElasticTNSL[in] GIDI::IncoherentElastic instance containing the Debye/Waller data.
a_setupInfo[in] Used internally when constructing a Protare to pass information to other constructors.

Definition at line 1350 of file MCGIDI_distributions.cc.

1351 :
1353 m_temperatureToMeV_K( 1.0 ),
1354 m_DebyeWallerIntegral( nullptr ) {
1355
1356 GIDI::DoubleDifferentialCrossSection::n_ThermalNeutronScatteringLaw::DebyeWallerIntegral const &debyeWallerIntegral = a_incoherentElasticTNSL->debyeWallerIntegral( );
1357 m_DebyeWallerIntegral = Functions::parseFunction1d_d1( debyeWallerIntegral.function1d( ) );
1358 GIDI::Axes const &axes = debyeWallerIntegral.function1d( )->axes( );
1359 GIDI::Axis const *axis = dynamic_cast<GIDI::Axis const *>( axes[0] );
1360 if( axis->unit( ) == "K" ) m_temperatureToMeV_K = 8.617330337217212e-11; // This is a kludge until units are properly supported.
1361}
Axes const & axes() const
Definition GIDI.hpp:1012
LUPI_HOST Function1d_d1 * parseFunction1d_d1(Transporting::MC const &a_settings, GIDI::Suite const &a_suite)
const axis_t axis_to_type< N >::axis
Definition pugixml.cc:9668

◆ ~IncoherentElasticTNSL()

LUPI_HOST_DEVICE MCGIDI::Distributions::IncoherentElasticTNSL::~IncoherentElasticTNSL ( )
inline

Definition at line 419 of file MCGIDI_distributions.hpp.

419{}

Member Function Documentation

◆ angleBiasing() [1/2]

template<typename RNG>
LUPI_HOST_DEVICE double MCGIDI::Distributions::IncoherentElasticTNSL::angleBiasing ( LUPI_maybeUnused Reaction const * a_reaction,
double a_temperature,
double a_energy_in,
double a_mu_lab,
LUPI_maybeUnused RNG && a_rng,
double & a_energy_out ) const

Returns the probability for a projectile with energy a_energy_in to cause a particle to be emitted at angle a_mu_lab as seen in the lab frame. a_energy_out is the sampled outgoing energy.

Parameters
a_reaction[in] The reaction containing the particle which this distribution describes.
a_temperature[in] The temperature of the material.
a_energy_in[in] The energy of the incident particle.
a_mu_lab[in] The desired mu in the lab frame for the emitted particle.
a_rng[in] The random number generator function that returns a double in the range [0, 1.0).
a_energy_out[in] The energy of the emitted outgoing particle.
Returns
The probability of emitting outgoing particle into lab angle a_mu_lab.

Definition at line 1532 of file MCGIDI_headerSource.hpp.

1533 {
1534
1535 double temperature = a_temperature / m_temperatureToMeV_K;
1536 double W_prime = m_DebyeWallerIntegral->evaluate( temperature );
1537 double twoEW = 2 * a_energy_in * W_prime;
1538 double probability = exp( -twoEW * ( 1.0 - a_mu_lab ) ) * twoEW / ( 1.0 - exp( -2 * twoEW ) );
1539
1540 a_energy_out = a_energy_in;
1541
1542 return( probability );
1543}

◆ angleBiasing() [2/2]

template<typename RNG>
LUPI_HOST_DEVICE double MCGIDI::Distributions::IncoherentElasticTNSL::angleBiasing ( Reaction const * a_reaction,
double a_temperature,
double a_energy_in,
double a_mu_lab,
RNG && a_rng,
double & a_energy_out ) const

◆ DebyeWallerIntegral() [1/2]

Functions::Function1d * MCGIDI::Distributions::IncoherentElasticTNSL::DebyeWallerIntegral ( )
inline

Definition at line 428 of file MCGIDI_distributions.hpp.

428{ return( m_DebyeWallerIntegral ); }

◆ DebyeWallerIntegral() [2/2]

Functions::Function1d const * MCGIDI::Distributions::IncoherentElasticTNSL::DebyeWallerIntegral ( ) const
inline

Definition at line 429 of file MCGIDI_distributions.hpp.

429{ return( m_DebyeWallerIntegral ); }

◆ sample()

template<typename RNG>
LUPI_HOST_DEVICE void MCGIDI::Distributions::IncoherentElasticTNSL::sample ( double a_energy,
Sampling::Input & a_input,
RNG && a_rng ) const

This method samples the outgoing neutron data for incoherent elastic TSNL from the Debye/Waller function.

Parameters
a_energy[in] The energy of the projectile.
a_input[in] Sample options requested by user.
a_rng[in] The random number generator function that returns a double in the range [0, 1.0).

Definition at line 1494 of file MCGIDI_headerSource.hpp.

1495 {
1496
1497 double temperature = a_input.temperature( ) / m_temperatureToMeV_K;
1498 double W_prime = m_DebyeWallerIntegral->evaluate( temperature );
1499 double twoEW = 2 * a_energy * W_prime;
1500 double expOfTwice_twoEW = exp( -2 * twoEW );
1501 double sampled_cdf = a_rng( );
1502
1503 if( sampled_cdf > ( 1 - 1e-5 ) ) {
1504 double Variable = ( 1.0 - sampled_cdf ) * ( 1.0 - expOfTwice_twoEW );
1505 a_input.m_mu = 1.0 - Variable * ( 1.0 + 0.5 * Variable ) / twoEW; }
1506 else if( sampled_cdf < expOfTwice_twoEW ) {
1507 a_input.m_mu = -1.0 + log( sampled_cdf / expOfTwice_twoEW * ( 1.0 - expOfTwice_twoEW ) + 1.0 ) / twoEW; }
1508 else {
1509 a_input.m_mu = 1.0 + log( expOfTwice_twoEW + sampled_cdf * ( 1.0 - expOfTwice_twoEW ) ) / twoEW;
1510 }
1511
1512 a_input.setSampledType( Sampling::SampledType::uncorrelatedBody );
1513 a_input.m_energyOut1 = a_energy;
1514 a_input.m_phi = 2.0 * M_PI * a_rng( );
1515}
#define M_PI
Definition SbMath.h:33

◆ serialize()

LUPI_HOST_DEVICE void MCGIDI::Distributions::IncoherentElasticTNSL::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 1371 of file MCGIDI_distributions.cc.

1371 {
1372
1373 Distribution::serialize( a_buffer, a_mode );
1374
1375 DATA_MEMBER_DOUBLE( m_temperatureToMeV_K, a_buffer, a_mode );
1376 m_DebyeWallerIntegral = serializeFunction1d_d1( a_buffer, a_mode, m_DebyeWallerIntegral );
1377}
#define DATA_MEMBER_DOUBLE(member, buf, mode)
LUPI_HOST_DEVICE void serialize(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode)
LUPI_HOST_DEVICE Functions::Function1d_d1 * serializeFunction1d_d1(LUPI::DataBuffer &a_buffer, LUPI::DataBuffer::Mode a_mode, Functions::Function1d_d1 *a_function1d)

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