A monte carlo pin cell spectral code for nuclear engineering applications.
|
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... | |
Isotope * | getIsotope (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... | |
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. 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 |
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.
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).
|
virtual |
Mterial destructor.
Material does not need to delete its isotopes since SWIG handles garbage collection.
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:
isotope | a pointer to the isotope |
atomic_ratio | the 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.
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.
neutron | the neutron to collide within the material |
bool Material::containsIsotope | ( | Isotope * | isotope | ) |
This method checks if the material contains a given isotope.
isotope | a pointer to the isotope of interest |
float Material::getAbsorptionMacroXS | ( | float | energy | ) |
Returns the total macroscopic absorption cross-section for the material at some energy.
energy | the energy of interest (eV) |
energy | energy of interest (eV) |
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.
energy_index | the index into the uniform lethargy grid |
float Material::getAbsorptionMicroXS | ( | float | energy | ) |
Returns the total microscopic absorption cross-section for the material at some energy (eV).
energy | the energy of interest (eV) |
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.
energy_index | the index into the uniform lethargy grid. |
float Material::getBucklingSquared | ( | ) |
Returns the geometric buckling squared for the geometry.
float Material::getCaptureMacroXS | ( | float | energy | ) |
Returns the total macroscopic capture cross-section within this material at some energy (eV).
energy | the energy of interest (eV) |
energy | energy of interest (eV) |
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.
energy_index | the index into the uniform lethargy grid. |
float Material::getCaptureMicroXS | ( | float | energy | ) |
Returns the total microscopic capture cross-section for the material at some energy (eV)
energy | the energy of interest (eV) |
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.
energy_index | the inex into the uniform lethargy grid |
float Material::getDensity | ( | ) |
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).
energy | the energy of interest (eV) |
energy | energy of interest (eV) |
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.
energy_index | the index into the uniform lethargy grid |
float Material::getElasticMicroXS | ( | float | energy | ) |
Returns the total macroscopic elastic scattering cross-section for the material at some energy (eV).
energy | the energy of interest (eV) |
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.
energy_index | the index into the uniform lethargy grid |
float Material::getFissionMacroXS | ( | float | energy | ) |
Returns the total macroscopic fission cross-section for the material at some energy (eV).
energy | the energy of interest (eV) |
energy | energy of interest (eV) |
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.
energy_index | index into the uniform lethargy grid |
float Material::getFissionMicroXS | ( | float | energy | ) |
Returns the total microscopic fission cross-section for the Material at some energy (eV).
energy | the energy of interest (eV) |
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.
energy_index | the index into the uniform lethargy grid |
Isotope * Material::getIsotope | ( | char * | 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.
isotope | pointer to the isotope of interest |
units | the isotope density units (ie, NUM_CM3 by default) |
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.
isotope | the name of the isotope |
units | the isotope density units (ie, NUM_CM3 by default) |
char * Material::getMaterialName | ( | ) |
Returns the material name.
float Material::getMaterialNumberDensity | ( | ) |
Returns the total number density for all isotopes within the material.
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.
xs_type | a character array for the cross-section type of interest |
float Material::getTotalMacroXS | ( | float | energy | ) |
Returns the total macroscopic cross-section for the material at some energy (eV).
energy | energy of interest (eV) |
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.
energy_index | the index into the uniform lethargy grid |
float Material::getTotalMicroXS | ( | float | energy | ) |
Returns the total microscopic cross-section for the material at some energy (eV).
energy | energy of interest (eV) |
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.
energy_index | index into the uniform lethargy grid |
float Material::getTransportMacroXS | ( | float | energy | ) |
Returns the total macroscopic transport cross-section for the material at some energy (eV)
energy | the energy of interest (eV) |
float Material::getTransportMacroXS | ( | int | energy_index | ) |
Returns the transport macroscopic cross-section for the material at some index into the uniform lethargy grid.
energy_index | the index into the uniform lethargy grid |
float Material::getTransportMicroXS | ( | float | energy | ) |
Returns the total microscopic transport cross-section for the material at some energy (eV)
energy | the energy of interest (eV) |
float Material::getTransportMicroXS | ( | int | energy_index | ) |
Returns the transport microscopic cross-section for the material at some index into the uniform lethargy grid.
energy_index | the index into the uniform lethargy grid |
int Material::getUid | ( | ) | const |
Returns the unique ID auto-generated for the material.
float Material::getVolume | ( | ) |
Returns the total volume of all regions containing 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.
volume | the 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:
xs | an array to fill with the macroscopic cross-section data |
num_xs | the number of cross-section values |
xs_type | the 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:
energies | an array to fill with the cross-section energies |
num_xs | the number of cross-section values |
xs_type | the 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:
neutron | the 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.
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 .
atomic_mass | the 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.
buckling_squared | the squared geometric buckling for the geometry |
void Material::setDensity | ( | float | density, |
char * | unit | ||
) |
Sets this material's density.
density | the density of the material |
unit | the density units ('g/cc' or 'at/cc' or 'at/barncm') |
void Material::setMaterialName | ( | char * | name | ) |
Sets the name for the material.
name | a character array for the material's name |
void Material::setNumberDensity | ( | float | density, |
const char * | unit | ||
) |
Sets the material's number density.
number_density | the number density of material (at/barncm) |
unit | the density units ('g/cc' or 'at/cc' or 'at/barncm') |
|
private |
The geometric buckling squared - used to sample leakage
|
private |
The units for the material's density (ie, 'g/cc' or 'at/cc')
|
private |
Map relating isotope name to number density / isotope pairs
|
private |
Map relating isotope pointers to atomic ratios within the material
|
private |
The material atomic mass (sum of all isotope masses according to their abundance in the material
|
private |
The material density in g/cc
|
private |
The name of the material arbitrarily defined by the user
|
private |
The material number density in num/cc
|
staticprivate |
A static class variable to generate a UID for each new material
|
private |
The material's unique identifier
|
private |
The total volume of all regions containing this material