A monte carlo pin cell spectral code for nuclear engineering applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Material Class Reference

The Material class represents a collection of isotope objects. More...

#include "pinspec/src/Material.h"

Public Member Functions

 Material (char *material_name)
 Material constructor. More...
 
virtual ~Material ()
 Mterial destructor. More...
 
char * getMaterialName ()
 Returns the material name. More...
 
int getUid () const
 Returns the unique ID auto-generated for the material. More...
 
float getMaterialNumberDensity ()
 Returns the total number density for all isotopes within the material. More...
 
IsotopegetIsotope (char *isotope)
 This method takes in a character array specifier for an isotope's name and returns a pointer to the Isotope. More...
 
float getDensity ()
 Returns the material's density. More...
 
float getIsotopeDensity (Isotope *isotope, densityUnit units=NUM_CM3)
 This method takes in a character array specifier for an isotope's name and returns a float for the Isotope's density. More...
 
float getIsotopeDensity (char *isotope, densityUnit units=NUM_CM3)
 This method takes in a character array specifier for an isotope's name and returns a float for the Isotope's density. More...
 
bool containsIsotope (Isotope *isotope)
 This method checks if the material contains a given isotope. More...
 
float getBucklingSquared ()
 Returns the geometric buckling squared for the geometry. More...
 
float getVolume ()
 Returns the total volume of all regions containing this material. More...
 
int getNumXSEnergies (char *xs_type)
 Returns the total number of energies for which cross-sections are defined for one of the material's cross-section types. More...
 
float getTotalMacroXS (float energy)
 Returns the total macroscopic cross-section for the material at some energy (eV). More...
 
float getTotalMacroXS (int energy_index)
 Returns the total macroscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data. More...
 
float getTotalMicroXS (float energy)
 Returns the total microscopic cross-section for the material at some energy (eV). More...
 
float getTotalMicroXS (int energy_index)
 Returns the total microscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data. More...
 
float getElasticMacroXS (float energy)
 Returns the total macroscopic elastic scattering cross-section for the material at some energy (eV). More...
 
float getElasticMacroXS (int energy_index)
 Returns the elastic macroscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data. More...
 
float getElasticMicroXS (float energy)
 Returns the total macroscopic elastic scattering cross-section for the material at some energy (eV). More...
 
float getElasticMicroXS (int energy_index)
 Returns the elastic microscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data. More...
 
float getAbsorptionMacroXS (float energy)
 Returns the total macroscopic absorption cross-section for the material at some energy. More...
 
float getAbsorptionMacroXS (int energy_index)
 Returns the absorption macroscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data. More...
 
float getAbsorptionMicroXS (float energy)
 Returns the total microscopic absorption cross-section for the material at some energy (eV). More...
 
float getAbsorptionMicroXS (int energy_index)
 Returns the absorption microscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data. More...
 
float getCaptureMacroXS (float energy)
 Returns the total macroscopic capture cross-section within this material at some energy (eV). More...
 
float getCaptureMacroXS (int energy_index)
 Returns the capture macroscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data. More...
 
float getCaptureMicroXS (float energy)
 Returns the total microscopic capture cross-section for the material at some energy (eV) More...
 
float getCaptureMicroXS (int energy_index)
 Returns the capture microscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data. More...
 
float getFissionMacroXS (float energy)
 Returns the total macroscopic fission cross-section for the material at some energy (eV). More...
 
float getFissionMacroXS (int energy_index)
 Returns the fission macroscopic cross-section within the Material at some index into the uniform lethargy grid of cross-section data. More...
 
float getFissionMicroXS (float energy)
 Returns the total microscopic fission cross-section for the Material at some energy (eV). More...
 
float getFissionMicroXS (int energy_index)
 Returns the fission microscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data. More...
 
float getTransportMicroXS (float energy)
 Returns the total microscopic transport cross-section for the material at some energy (eV) More...
 
float getTransportMicroXS (int energy_index)
 Returns the transport microscopic cross-section for the material at some index into the uniform lethargy grid. More...
 
float getTransportMacroXS (float energy)
 Returns the total macroscopic transport cross-section for the material at some energy (eV) More...
 
float getTransportMacroXS (int energy_index)
 Returns the transport macroscopic cross-section for the material at some index into the uniform lethargy grid. More...
 
void retrieveXSEnergies (float *energies, int num_xs, char *xs_type)
 Fills an array with cross-section energy values. More...
 
void retrieveXS (float *xs, int num_xs, char *xs_type)
 Fills an array with macroscopic cross-section values. More...
 
void setMaterialName (char *name)
 Sets the name for the material. More...
 
void setDensity (float density, char *unit)
 Sets this material's density. More...
 
void setNumberDensity (float number_density, const char *unit)
 Sets the material's number density. More...
 
void setAtomicMass (float atomic_mass)
 Sets the material's total atomic mass. More...
 
void setBucklingSquared (float buckling_squared)
 Sets the squared geomtric buckling for the geometry in which this material resides. More...
 
void incrementVolume (float volume)
 Increments the volume occupied by this material in the geometry. More...
 
void addIsotope (Isotope *isotope, float atomic_ratio)
 Adds a new isotope to this material with a given atomic ratio. More...
 
Materialclone ()
 This method clones a given material object by executing a deep copy of all of the material's class attributes and giving them to a new material class object. More...
 
float sampleDistanceTraveled (neutron *neutron)
 Samples a random distance to collision within this material. More...
 
void sampleIsotope (neutron *neutron)
 Samples an isotope for a collision. More...
 
void collideNeutron (neutron *neutron)
 Samples an isotope and a reaction rate for a neutron. More...
 

Private Attributes

char * _material_name
 
int _uid
 
float _material_density
 
float _material_number_density
 
float _material_atomic_mass
 
float _buckling_squared
 
float _volume
 
std::map< char *, std::pair
< float, Isotope * > > 
_isotopes
 
std::map< Isotope *, float > _isotopes_AO
 
densityUnit _density_unit
 

Static Private Attributes

static int _n = 1
 

Detailed Description

The Material class represents a collection of isotope objects.

The Material class represents a collection of isotope objects and samples isotopes for collisions with neutrons.

Constructor & Destructor Documentation

Material::Material ( char *  material_name)

Material constructor.

Sets the user-defined name along with default values for the material density (0), material number density (0), material atomic mass (1), buckling (0) and volume (0).

Material::~Material ( )
virtual

Mterial destructor.

Material does not need to delete its isotopes since SWIG handles garbage collection.

Member Function Documentation

void Material::addIsotope ( Isotope isotope,
float  atomic_ratio 
)

Adds a new isotope to this material with a given atomic ratio.

The atomic ratio is the number of atoms of this isotope per equivalent molecule of the material. For example, for a material of UO2 one would add uranium and oxygen isotopes as follows:

uo2.addIsotope(u235, 1.)
uo2.addIsotope(o16, 2.)
Parameters
isotopea pointer to the isotope
atomic_ratiothe atomic ratio of the isotope within the material
Material * Material::clone ( )

This method clones a given material object by executing a deep copy of all of the material's class attributes and giving them to a new material class object.

Returns
a pointer to the new cloned material class object
void Material::collideNeutron ( neutron neutron)

Samples an isotope and a reaction rate for a neutron.

For a given energy, this method calls sampleIsotope() to sample an isotope, then samples a reaction type in that isotope by using Isotope::collideNeutron() method. After this method returns, the neutron's outgoing collision energy has been updated and the neutron has been killed if it was absorbed.

Parameters
neutronthe neutron to collide within the material
bool Material::containsIsotope ( Isotope isotope)

This method checks if the material contains a given isotope.

Parameters
isotopea pointer to the isotope of interest
Returns
true if the material contains the isotope; otherwise false
float Material::getAbsorptionMacroXS ( float  energy)

Returns the total macroscopic absorption cross-section for the material at some energy.

Parameters
energythe energy of interest (eV)
Returns
the total macroscopic absorption cross-section $ (cm^{-1}) $
Parameters
energyenergy of interest (eV)
Returns
the total macroscopic absorption cross-section (cm^-1)
float Material::getAbsorptionMacroXS ( int  energy_index)

Returns the absorption macroscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data.

Parameters
energy_indexthe index into the uniform lethargy grid
Returns
the absorption macroscopic cross-section $ (cm^{-1}) $
float Material::getAbsorptionMicroXS ( float  energy)

Returns the total microscopic absorption cross-section for the material at some energy (eV).

Parameters
energythe energy of interest (eV)
Returns
the total microscopic absorption cross-section
float Material::getAbsorptionMicroXS ( int  energy_index)

Returns the absorption microscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data.

Parameters
energy_indexthe index into the uniform lethargy grid.
Returns
the absorption microscopic cross-section
float Material::getBucklingSquared ( )

Returns the geometric buckling squared for the geometry.

Returns
the geometric buckling squared
float Material::getCaptureMacroXS ( float  energy)

Returns the total macroscopic capture cross-section within this material at some energy (eV).

Parameters
energythe energy of interest (eV)
Returns
the total macroscopic capture cross-section $ (cm^{-1}) $
Parameters
energyenergy of interest (eV)
Returns
the total macroscopic capture cross-section (cm^-1)
float Material::getCaptureMacroXS ( int  energy_index)

Returns the capture macroscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data.

Parameters
energy_indexthe index into the uniform lethargy grid.
Returns
the capture macroscopic cross-section $ (cm^{-1}) $
float Material::getCaptureMicroXS ( float  energy)

Returns the total microscopic capture cross-section for the material at some energy (eV)

Parameters
energythe energy of interest (eV)
Returns
the total microscopic capture cross-section
float Material::getCaptureMicroXS ( int  energy_index)

Returns the capture microscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data.

Parameters
energy_indexthe inex into the uniform lethargy grid
Returns
the capture microscopic cross-section
float Material::getDensity ( )

Returns the material's density.

Returns
the material's density
float Material::getElasticMacroXS ( float  energy)

Returns the total macroscopic elastic scattering cross-section for the material at some energy (eV).

Parameters
energythe energy of interest (eV)
Returns
the total macroscopic elastic scattering cross-section $ (cm^{-1}) $
Parameters
energyenergy of interest (eV)
Returns
the total elastic macroscopic scattering cross-section (cm^-1)
float Material::getElasticMacroXS ( int  energy_index)

Returns the elastic macroscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data.

Parameters
energy_indexthe index into the uniform lethargy grid
Returns
the elastic macroscopic cross-section $ (cm^{-1}) $
float Material::getElasticMicroXS ( float  energy)

Returns the total macroscopic elastic scattering cross-section for the material at some energy (eV).

Parameters
energythe energy of interest (eV)
Returns
the total elastic microscopic scattering cross-section
float Material::getElasticMicroXS ( int  energy_index)

Returns the elastic microscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data.

Parameters
energy_indexthe index into the uniform lethargy grid
Returns
the elastic microscopic cross-section
float Material::getFissionMacroXS ( float  energy)

Returns the total macroscopic fission cross-section for the material at some energy (eV).

Parameters
energythe energy of interest (eV)
Returns
the total macroscopic fission cross-section $ (cm^{-1}) $
Parameters
energyenergy of interest (eV)
Returns
the total macroscopic fission cross-section (cm^-1)
float Material::getFissionMacroXS ( int  energy_index)

Returns the fission macroscopic cross-section within the Material at some index into the uniform lethargy grid of cross-section data.

Parameters
energy_indexindex into the uniform lethargy grid
Returns
the fission macroscopic cross-section $ (cm^{-1}) $
float Material::getFissionMicroXS ( float  energy)

Returns the total microscopic fission cross-section for the Material at some energy (eV).

Parameters
energythe energy of interest (eV)
Returns
the total microscopic fission cross-section
float Material::getFissionMicroXS ( int  energy_index)

Returns the fission microscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data.

Parameters
energy_indexthe index into the uniform lethargy grid
Returns
the fission microscopic cross-section
Isotope * Material::getIsotope ( char *  isotope)

This method takes in a character array specifier for an isotope's name and returns a pointer to the Isotope.

An example of how this would be called in python is as follows:

h1 = material.getIsotope('H-1')
Parameters
isotopethe name of the isotope
Returns
a pointer to the Isotope
float Material::getIsotopeDensity ( Isotope isotope,
densityUnit  units = NUM_CM3 
)

This method takes in a character array specifier for an isotope's name and returns a float for the Isotope's density.

Parameters
isotopepointer to the isotope of interest
unitsthe isotope density units (ie, NUM_CM3 by default)
Returns
the isotope's density
float Material::getIsotopeDensity ( char *  isotope,
densityUnit  units = NUM_CM3 
)

This method takes in a character array specifier for an isotope's name and returns a float for the Isotope's density.

Parameters
isotopethe name of the isotope
unitsthe isotope density units (ie, NUM_CM3 by default)
Returns
the isotope's density
char * Material::getMaterialName ( )

Returns the material name.

Returns
the name of this material
float Material::getMaterialNumberDensity ( )

Returns the total number density for all isotopes within the material.

Returns
the total number density $ \frac{at}{cm^3} $.
int Material::getNumXSEnergies ( char *  xs_type)

Returns the total number of energies for which cross-sections are defined for one of the material's cross-section types.

This method assumes that each isotope contains cross-sections defined on a uniform lethargy grid (100,000 points by default). The method queries the first isotope in the material's collection of isotopes to determine the number of cross-sections. The method will return the number of values for 'capture', 'elastic', 'fission', 'absorption' and 'total' cross-section types.

Parameters
xs_typea character array for the cross-section type of interest
Returns
then number of cross-section values
float Material::getTotalMacroXS ( float  energy)

Returns the total macroscopic cross-section for the material at some energy (eV).

Parameters
energyenergy of interest (eV)
Returns
the total macroscopic cross-section $ (cm^{-1}) $
float Material::getTotalMacroXS ( int  energy_index)

Returns the total macroscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data.

Parameters
energy_indexthe index into the uniform lethargy grid
Returns
the total macroscopic cross-section $ (cm^{-1}) $
float Material::getTotalMicroXS ( float  energy)

Returns the total microscopic cross-section for the material at some energy (eV).

Parameters
energyenergy of interest (eV)
Returns
the total microscopic cross-section
float Material::getTotalMicroXS ( int  energy_index)

Returns the total microscopic cross-section for the material at some index into the uniform lethargy grid of cross-section data.

Parameters
energy_indexindex into the uniform lethargy grid
Returns
the total microscopic cross-section
float Material::getTransportMacroXS ( float  energy)

Returns the total macroscopic transport cross-section for the material at some energy (eV)

Parameters
energythe energy of interest (eV)
Returns
the total macroscopic transport cross-section $ (cm^{-1}) $
float Material::getTransportMacroXS ( int  energy_index)

Returns the transport macroscopic cross-section for the material at some index into the uniform lethargy grid.

Parameters
energy_indexthe index into the uniform lethargy grid
Returns
the transport macroscopic cross-section $ (cm^{-1}) $
float Material::getTransportMicroXS ( float  energy)

Returns the total microscopic transport cross-section for the material at some energy (eV)

Parameters
energythe energy of interest (eV)
Returns
the total microscopic transport cross-section
float Material::getTransportMicroXS ( int  energy_index)

Returns the transport microscopic cross-section for the material at some index into the uniform lethargy grid.

Parameters
energy_indexthe index into the uniform lethargy grid
Returns
the transport microscopic cross-section
int Material::getUid ( ) const

Returns the unique ID auto-generated for the material.

Returns
a unique ID for the material
float Material::getVolume ( )

Returns the total volume of all regions containing this material.

Returns
the total volume defined by this material
void Material::incrementVolume ( float  volume)

Increments the volume occupied by this material in the geometry.

This is used when a material is added to more than one region, as is the case for a heterogeneous pin cell with multiple radial regions of the same material.

Parameters
volumethe volume to add to the total material volume
void Material::retrieveXS ( float *  xs,
int  num_xs,
char *  xs_type 
)

Fills an array with macroscopic cross-section values.

This method is a helper function to allow PINSPEC users to get access to the material's nuclear data in Python. A user must initialize a numpy array of the correct size (ie, a float64 array the length of the number of cross-section values) as input to this function. This function then fills the numpy array with the data values for one of the isotope's cross-sections. An example of how this function might be called in Python is as follows:

num_xs = material.getNumXSEnergies()
xs = material.retrieveXS(num_xs, 'capture')
Parameters
xsan array to fill with the macroscopic cross-section data
num_xsthe number of cross-section values
xs_typethe type of cross-section
void Material::retrieveXSEnergies ( float *  energies,
int  num_xs,
char *  xs_type 
)

Fills an array with cross-section energy values.

This method is a helper function to allow PINSPEC users to get access to the material's nuclear data in Python. A user must initialize a numpy array of the correct size (ie, a float64 array the length of the number of cross-section values) as input to this function. This function then fills the numpy array with the energy values for the isotope's cross-section data. An example of how this function might be called in Python is as follows:

num_energies = material.getNumXSEnergies()
energies = material.retrieveXSEnergies(num_energies, 'capture')
Parameters
energiesan array to fill with the cross-section energies
num_xsthe number of cross-section values
xs_typethe type of cross-section
float Material::sampleDistanceTraveled ( neutron neutron)

Samples a random distance to collision within this material.

Samples a random distance to the nearest collision in this material at some neutron energy using direct sampling from: $ \frac{-log(\xi)}{\Sigma_t(E)} $

Parameters
neutronthe neutron of interest
void Material::sampleIsotope ( neutron neutron)

Samples an isotope for a collision.

The probability for collision with an isotope isbased on the ratios of each isotope's total cross-section to the total cross-section of all isotope's in this Material.

Returns
a pointer to the sampled isotope
void Material::setAtomicMass ( float  atomic_mass)

Sets the material's total atomic mass.

If the material is a molecule this is equivalent to setting the molecular mass. For example, for UO2, the material atomic mass would be $ 235 + 16 + 16 = 267 $.

Parameters
atomic_massthe material's total atomic mass
void Material::setBucklingSquared ( float  buckling_squared)

Sets the squared geomtric buckling for the geometry in which this material resides.

This is used such that leakage can be sampled within isotopes in the same way as all other reaction rates.

Parameters
buckling_squaredthe squared geometric buckling for the geometry
void Material::setDensity ( float  density,
char *  unit 
)

Sets this material's density.

Parameters
densitythe density of the material
unitthe density units ('g/cc' or 'at/cc' or 'at/barncm')
void Material::setMaterialName ( char *  name)

Sets the name for the material.

Parameters
namea character array for the material's name
void Material::setNumberDensity ( float  density,
const char *  unit 
)

Sets the material's number density.

Parameters
number_densitythe number density of material (at/barncm)
unitthe density units ('g/cc' or 'at/cc' or 'at/barncm')

Member Data Documentation

float Material::_buckling_squared
private

The geometric buckling squared - used to sample leakage

densityUnit Material::_density_unit
private

The units for the material's density (ie, 'g/cc' or 'at/cc')

std::map<char*, std::pair<float, Isotope*> > Material::_isotopes
private

Map relating isotope name to number density / isotope pairs

std::map<Isotope*, float> Material::_isotopes_AO
private

Map relating isotope pointers to atomic ratios within the material

float Material::_material_atomic_mass
private

The material atomic mass (sum of all isotope masses according to their abundance in the material

float Material::_material_density
private

The material density in g/cc

char* Material::_material_name
private

The name of the material arbitrarily defined by the user

float Material::_material_number_density
private

The material number density in num/cc

int Material::_n = 1
staticprivate

A static class variable to generate a UID for each new material

int Material::_uid
private

The material's unique identifier

float Material::_volume
private

The total volume of all regions containing this material


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