An open source method of characteristics neutron transport code.
Material Class Reference

The Material class represents a unique material and its relevant nuclear data (i.e., multigroup cross-sections) for neutron transport. More...

#include "src/Material.h"

Public Member Functions

 Material (int id=0, const char *name="")
 Constructor sets the ID and unique ID for the Material. More...
 
virtual ~Material ()
 Destructor deletes all cross-section data structures from memory.
 
int getId () const
 Return the Material's user-defined ID. More...
 
char * getName () const
 Return the user-defined name of the Material. More...
 
double getVolume ()
 Return the aggregate volume/area of all instances of this Material. More...
 
int getNumInstances ()
 Return the number of instances of this Material in the Geometry. More...
 
int getNumEnergyGroups () const
 Returns the number of energy groups for this Material's nuclear data. More...
 
FP_PRECISION * getSigmaT ()
 Return the array of the Material's total cross-sections. More...
 
FP_PRECISION getMaxSigmaT ()
 Return the maximum of the Material's total cross-sections. More...
 
FP_PRECISION * getSigmaS ()
 Return the array of the Material's scattering cross-section matrix. More...
 
FP_PRECISION * getSigmaA ()
 Return the array of the Material's absorption group cross-sections. More...
 
FP_PRECISION * getSigmaF ()
 Return the array of the Material's fission cross-sections. More...
 
FP_PRECISION * getNuSigmaF ()
 Return the array of the Material's fission cross-sections multiplied by nu $ \nu $. More...
 
FP_PRECISION * getChi ()
 Return the array of the Material's chi $ \chi $. More...
 
FP_PRECISION * getFissionMatrix ()
 Return the array of the Material's fission matrix. More...
 
FP_PRECISION getSigmaTByGroup (int group)
 Get the Material's total cross section for some energy group. More...
 
FP_PRECISION getSigmaSByGroup (int origin, int destination)
 Get the Material's scattering cross section for some energy group. More...
 
FP_PRECISION getSigmaAByGroup (int group)
 Get the Material's absorption cross section for some energy group. More...
 
FP_PRECISION getSigmaFByGroup (int group)
 Get the Material's fission cross section for some energy group. More...
 
FP_PRECISION getNuSigmaFByGroup (int group)
 Get the Material's nu-fission cross section for some energy group. More...
 
FP_PRECISION getChiByGroup (int group)
 Get the Material's fission spectrum for some energy group. More...
 
FP_PRECISION getFissionMatrixByGroup (int origin, int destination)
 Get the Material's fission matrix for some energy group. More...
 
bool isFissionable ()
 Returns whether or not the Material contains a fissionable (non-zero) fission cross-section. More...
 
bool isDataAligned ()
 Returns true if the data is vector aligned, false otherwise (default). More...
 
int getNumVectorGroups ()
 Returns the rounded up number of energy groups to fill an integral number of vector lengths. More...
 
void setName (const char *name)
 Sets the name of the Material. More...
 
void setVolume (double volume)
 Set the volume/area of the Material. More...
 
void incrementVolume (double volume)
 Increment the volume/area of the Material by some amount. More...
 
void setNumInstances (int num_instances)
 Set the number of instances of this Material. More...
 
void incrementNumInstances ()
 Increment the number of instances of this Material. More...
 
void setNumEnergyGroups (const int num_groups)
 Set the number of energy groups for this Material. More...
 
void setSigmaT (double *xs, int num_groups)
 Set the Material's array of total cross-sections. More...
 
void setSigmaS (double *xs, int num_groups)
 Set the Material's 2D array of scattering cross-sections. More...
 
void setSigmaF (double *xs, int num_groups)
 Set the Material's array of fission cross-sections. More...
 
void setNuSigmaF (double *xs, int num_groups)
 Set the Material's array of fission cross-sections multiplied by $ \nu $. More...
 
void setChi (double *xs, int num_groups)
 Set the Material's array of chi $ \chi $ values. More...
 
void setSigmaTByGroup (double xs, int group)
 Set the Material's total cross-section for some energy group. More...
 
void setSigmaFByGroup (double xs, int group)
 Set the Material's fission cross-section for some energy group. More...
 
void setNuSigmaFByGroup (double xs, int group)
 Set the Material's fission cross-section multiplied by $ \nu $ for some energy group. More...
 
void setSigmaSByGroup (double xs, int origin, int destination)
 Set the Material's scattering cross-section for some energy group. More...
 
void setChiByGroup (double xs, int group)
 Set the Material's chi value for some energy group. More...
 
void setSigmaAByGroup (double xs, int group)
 Set the Material's absorption cross-section for some energy group. More...
 
void buildFissionMatrix ()
 Builds the fission matrix from chi and the fission cross-section. More...
 
void transposeProductionMatrices ()
 Transposes the scattering and fission matrices. More...
 
void alignData ()
 Reallocates the Material's cross-section data structures along word-aligned boundaries. More...
 
Materialclone ()
 Create a duplicate of the Material. More...
 
std::string toString ()
 Converts this Material's attributes to a character array representation. More...
 
void printString ()
 Prints a string representation of all of the Material's attributes to the console.
 

Detailed Description

The Material class represents a unique material and its relevant nuclear data (i.e., multigroup cross-sections) for neutron transport.

Constructor & Destructor Documentation

◆ Material()

Material::Material ( int  id = 0,
const char *  name = "" 
)

Constructor sets the ID and unique ID for the Material.

Parameters
idthe user-specified optional Material ID
namethe user-specified optional Material name

Member Function Documentation

◆ alignData()

void Material::alignData ( )

Reallocates the Material's cross-section data structures along word-aligned boundaries.

This method is used to assist with SIMD auto-vectorization of the MOC routines in the Solver classes. Rather than using the assigned number of energy groups, this method adds "dummy" energy groups such that the total number of groups is some multiple of VEC_LENGTH (typically 4, 8, or 16). As a result, the SIMD-vectorized Solver subclasses can break up loops over energy groups in such a way to "expose" the SIMD nature of the algorithm.

◆ buildFissionMatrix()

void Material::buildFissionMatrix ( )

Builds the fission matrix from chi and the fission cross-section.

The fission matrix is constructed as the outer product of the chi and fission cross-section vectors. This routine is intended for internal use and is called by the Solver at runtime.

◆ clone()

Material * Material::clone ( )

Create a duplicate of the Material.

Returns
a pointer to the clone

◆ getChi()

FP_PRECISION * Material::getChi ( )

Return the array of the Material's chi $ \chi $.

Returns
the pointer to the Material's array of chi $ \chi $ values

◆ getChiByGroup()

FP_PRECISION Material::getChiByGroup ( int  group)

Get the Material's fission spectrum for some energy group.

Parameters
groupthe energy group
Returns
the fission spectrum

◆ getFissionMatrix()

FP_PRECISION * Material::getFissionMatrix ( )

Return the array of the Material's fission matrix.

Returns
the pointer to the Material's fission matrix array

◆ getFissionMatrixByGroup()

FP_PRECISION Material::getFissionMatrixByGroup ( int  origin,
int  destination 
)

Get the Material's fission matrix for some energy group.

Parameters
originthe incoming energy group $ E_{0} $
destinationthe outgoing energy group $ E_{1} $
Returns
the fission matrix entry $ \nu\Sigma_{f}(E_{0}) * \chi(E_{1})$

◆ getId()

int Material::getId ( ) const

Return the Material's user-defined ID.

Returns
the Material's user-defined ID

◆ getMaxSigmaT()

FP_PRECISION Material::getMaxSigmaT ( )

Return the maximum of the Material's total cross-sections.

Returns
the maximum of the Material's total cross-sections.

◆ getName()

char * Material::getName ( ) const

Return the user-defined name of the Material.

Returns
the Material name

◆ getNumEnergyGroups()

int Material::getNumEnergyGroups ( ) const

Returns the number of energy groups for this Material's nuclear data.

Returns
the number of energy groups

◆ getNumInstances()

int Material::getNumInstances ( )

Return the number of instances of this Material in the Geometry.

The number of instances of this Material in the Geometry is determined during track generation.

Returns
the number of material instances

◆ getNumVectorGroups()

int Material::getNumVectorGroups ( )

Returns the rounded up number of energy groups to fill an integral number of vector lengths.

Returns
The number of vector-aligned energy groups

◆ getNuSigmaF()

FP_PRECISION * Material::getNuSigmaF ( )

Return the array of the Material's fission cross-sections multiplied by nu $ \nu $.

Returns
the pointer to the Material's array of fission cross-sections multiplied by nu $ \nu $

◆ getNuSigmaFByGroup()

FP_PRECISION Material::getNuSigmaFByGroup ( int  group)

Get the Material's nu-fission cross section for some energy group.

Parameters
groupthe energy group
Returns
the nu-fission cross section

◆ getSigmaA()

FP_PRECISION * Material::getSigmaA ( )

Return the array of the Material's absorption group cross-sections.

Returns
the pointer to the Material's array of absorption cross-sections

◆ getSigmaAByGroup()

FP_PRECISION Material::getSigmaAByGroup ( int  group)

Get the Material's absorption cross section for some energy group.

Parameters
groupthe energy group
Returns
the absorption cross section

◆ getSigmaF()

FP_PRECISION * Material::getSigmaF ( )

Return the array of the Material's fission cross-sections.

Returns
the pointer to the Material's array of fission cross-sections

◆ getSigmaFByGroup()

FP_PRECISION Material::getSigmaFByGroup ( int  group)

Get the Material's fission cross section for some energy group.

Parameters
groupthe energy group
Returns
the fission cross section

◆ getSigmaS()

FP_PRECISION * Material::getSigmaS ( )

Return the array of the Material's scattering cross-section matrix.

Returns
the pointer to the Material's array of scattering cross-sections

◆ getSigmaSByGroup()

FP_PRECISION Material::getSigmaSByGroup ( int  origin,
int  destination 
)

Get the Material's scattering cross section for some energy group.

Parameters
originthe incoming energy group
destinationthe outgoing energy group
Returns
the scattering cross section

◆ getSigmaT()

FP_PRECISION * Material::getSigmaT ( )

Return the array of the Material's total cross-sections.

Returns
the pointer to the Material's array of total cross-sections

◆ getSigmaTByGroup()

FP_PRECISION Material::getSigmaTByGroup ( int  group)

Get the Material's total cross section for some energy group.

Parameters
groupthe energy group
Returns
the total cross section

◆ getVolume()

double Material::getVolume ( )

Return the aggregate volume/area of all instances of this Material.

The volume/area of the Material is computed from track segments which overlap this Material during track generation.

Returns
the volume/area of the Material

◆ incrementNumInstances()

void Material::incrementNumInstances ( )

Increment the number of instances of this Material.

This routine is called by the TrackGenerator during track generation and segmentation.

◆ incrementVolume()

void Material::incrementVolume ( double  volume)

Increment the volume/area of the Material by some amount.

This routine is called by the TrackGenerator during track generation and segmentation.

Parameters
volumethe amount to increment the current volume by

◆ isDataAligned()

bool Material::isDataAligned ( )

Returns true if the data is vector aligned, false otherwise (default).

Returns
Whether or not the Material's data is vector aligned

◆ isFissionable()

bool Material::isFissionable ( )

Returns whether or not the Material contains a fissionable (non-zero) fission cross-section.

Returns
true if fissionable, false otherwise

◆ setChi()

void Material::setChi ( double *  xs,
int  num_groups 
)

Set the Material's array of chi $ \chi $ values.

This method is a helper function to allow OpenMOC users to assign the Material's nuclear data in Python. A user must initialize a NumPy array of the correct size (e.g., a float64 array the length of the number of energy groups) as input to this function. This function then fills the NumPy array with the data values for the Material's chi distribution. An example of how this function might be called in Python is as follows:

chi = numpy.array([0.05, 0.1, 0.15, ... ])
material = openmoc.Material(openmoc.material_id())
material.setChi(chi)
Parameters
xsthe array of chi $ \chi $ values
num_groupsthe number of energy groups

◆ setChiByGroup()

void Material::setChiByGroup ( double  xs,
int  group 
)

Set the Material's chi value for some energy group.

Parameters
xsthe chi value ( $ \Chi $)
groupthe energy group

◆ setName()

void Material::setName ( const char *  name)

Sets the name of the Material.

Parameters
namethe Material name string

◆ setNumEnergyGroups()

void Material::setNumEnergyGroups ( const int  num_groups)

Set the number of energy groups for this Material.

Parameters
num_groupsthe number of energy groups.

◆ setNumInstances()

void Material::setNumInstances ( int  num_instances)

Set the number of instances of this Material.

Parameters
num_instancesthe number of instances of this Material in the Geometry

◆ setNuSigmaF()

void Material::setNuSigmaF ( double *  xs,
int  num_groups 
)

Set the Material's array of fission cross-sections multiplied by $ \nu $.

Parameters
xsthe array of fission cross-sections multiplied by nu $ \nu $
num_groupsthe number of energy groups

◆ setNuSigmaFByGroup()

void Material::setNuSigmaFByGroup ( double  xs,
int  group 
)

Set the Material's fission cross-section multiplied by $ \nu $ for some energy group.

This method is a helper function to allow OpenMOC users to assign the Material's nuclear data in Python. A user must initialize a NumPy array of the correct size (e.g., a float64 array the length of the number of energy groups) as input to this function. This function then fills the NumPy array with the data values for the Material's nu*fission cross-sections. An example of how this function might be called in Python is as follows:

nu_sigma_f = numpy.array([0.05, 0.1, 0.15, ... ])
material = openmoc.Material(openmoc.material_id())
material.setNuSigmaF(nu_sigma_f)
Parameters
xsthe fission cross-section multiplied by nu $ \nu $
groupthe energy group

◆ setSigmaAByGroup()

void Material::setSigmaAByGroup ( double  xs,
int  group 
)

Set the Material's absorption cross-section for some energy group.

The absorption cross section is computed by OpenMOC when needed, but the user can set it manually, to replace absorption by another cross section as absorption is not needed when determining Keff from fission rates.

Parameters
xsthe absorption cross-section
groupthe energy group

◆ setSigmaF()

void Material::setSigmaF ( double *  xs,
int  num_groups 
)

Set the Material's array of fission cross-sections.

This method is a helper function to allow OpenMOC users to assign the Material's nuclear data in Python. A user must initialize a NumPy array of the correct size (e.g., a float64 array the length of the number of energy groups) as input to this function. This function then fills the NumPy array with the data values for the Material's fission cross-sections. An example of how this function might be called in Python is as follows:

sigma_f = numpy.array([0.05, 0.1, 0.15, ... ])
material = openmoc.Material(openmoc.material_id())
material.setSigmaF(sigma_f)
Parameters
xsthe array of fission cross-sections
num_groupsthe number of energy groups

◆ setSigmaFByGroup()

void Material::setSigmaFByGroup ( double  xs,
int  group 
)

Set the Material's fission cross-section for some energy group.

Parameters
xsthe fission cross-section
groupthe energy group

◆ setSigmaS()

void Material::setSigmaS ( double *  xs,
int  num_groups_squared 
)

Set the Material's 2D array of scattering cross-sections.

The array should be passed to OpenMOC as a 1D array in column-major order. This assumes the standard convention, where column index is the origin group and the row index is the destination group. That is, the array should be ordered as follows: 1 -> 1 1 -> 2 1 -> 3 ... 2 -> 1 2 -> 2 ...

Note that if the scattering matrix is defined in NumPy by the standard convention, "flat" will put the matrix into row major order. Thus, one should transpose the matrix before flattening.

For cache efficiency, the transpose of the input is actually stored in OpenMOC.

This method is a helper function to allow OpenMOC users to assign the Material's nuclear data in Python. A user must initialize a NumPy array of the correct size (e.g., a float64 array the length of the square of the number of energy groups) as input to this function. This function then fills the NumPy array with the data values for the Material's scattering cross-sections. An example of how this function might be called in Python is as follows:

sigma_s = numpy.array([[0.05, 0, 0, ... ],
[0.10, 0.08, ... ... ],
...
[... ... ... ]])
sigma_s = numpy.transpose(sigma_s)
material = openmoc.Material(openmoc.material_id())
material.setSigmaS(sigma_s.flat)
Parameters
xsthe array of scattering cross-sections
num_groups_squaredthe number of energy groups squared

◆ setSigmaSByGroup()

void Material::setSigmaSByGroup ( double  xs,
int  origin,
int  destination 
)

Set the Material's scattering cross-section for some energy group.

Parameters
xsthe scattering cross-section
originthe column index in the scattering matrix
destinationthe row index in the scattering matrix

◆ setSigmaT()

void Material::setSigmaT ( double *  xs,
int  num_groups 
)

Set the Material's array of total cross-sections.

This method is a helper function to allow OpenMOC users to assign the Material's nuclear data in Python. A user must initialize a NumPy array of the correct size (e.g., a float64 array the length of the number of energy groups) as input to this function. This function then fills the NumPy array with the data values for the Material's total cross-sections. An example of how this function might be called in Python is as follows:

sigma_t = numpy.array([0.05, 0.1, 0.15, ...])
material = openmoc.Material(openmoc.material_id())
material.setSigmaT(sigma_t)
     NOTE: This routine will override any zero-valued cross-sections
     (e.g., in void or gap regions) with a minimum value of 1E-10 to
     avoid numerical issues in the MOC solver.
Parameters
xsthe array of total cross-sections
num_groupsthe number of energy groups

◆ setSigmaTByGroup()

void Material::setSigmaTByGroup ( double  xs,
int  group 
)

Set the Material's total cross-section for some energy group.

Parameters
xsthe total cross-section
groupthe energy group

◆ setVolume()

void Material::setVolume ( double  volume)

Set the volume/area of the Material.

Parameters
volumethe volume/area of the Material

◆ toString()

std::string Material::toString ( )

Converts this Material's attributes to a character array representation.

The character array returned includes the user-defined ID, and each of the absorption, total, fission, nu multiplied by fission and scattering cross-sections and chi for all energy groups.

Returns
character array of this Material's attributes

◆ transposeProductionMatrices()

void Material::transposeProductionMatrices ( )

Transposes the scattering and fission matrices.

This routine is used by the Solver when performing adjoint flux caclulations.


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