-
Notifications
You must be signed in to change notification settings - Fork 3
Materials
A material in PINSPEC is made up of one or more isotopes. Creating a material involves initializing it, setting its density and adding the isotopes and their relative densities one at a time. A material can be initialized using the Material constructor, with whatever name the user desires as its argument. This name will be the title to whatever plots are associated with the material.
>>> mix = Material('Fuel Moderator Homogeneous Mix')
The density of the material is set using the setDensity() command with the number density as the first argument and the units as the second argument. The units currently supported are 'g/cc' (grams per cubic centimeter) and 'at/cc' (grams per cubic centimeter).
>>> mix.setDensity(5., 'g/cc')
To check this, or retrieve the density of a material at some later point, one case use the getDensity() command:
>>> mix.getDensity()
5.0
Isotopes are added to materials using the "addIsotope" function, in which isotopes are defined by the name given to them in the isotope initialization section. The relative number density (or atomic ratio) of said isotope is the second argument in the function. Below is an example of adding the isotopes created int he previous tutorial to a single material.
>>> mix.addIsotope(o16, 1.0)
>>> mix.addIsotope(h1, 1.0)
>>> mix.addIsotope(u238, 0.01)
>>> mix.addIsotope(u235, .0025)
To check if that these have been set properly, or to check that a material contains an isotope, use the containsIsotope() commands, which takes the isotope handle as an argument and returns true or false:
>>> mix.containsIsotope(u235)
True
>>> mix.containsIsotope(zr90)
False
Note that the second command will return false ONLY if the isotope was created, but not added to the material. If the isotope in question hasn't been initialized as an isotope yet, this will return a python error, but in either case, you'll know it is incorrect.
##Retrieving Macroscopic Cross Sections One property worth retrieving from a material is the macroscopic cross section. Once a material is defined, all the isotopes and their cross sections are used in conjunction with their number densities to create macroscopic data. There are two options available for retrieving cross sections; pulling arrays of cross sections or pulling single values.
To retrieve an array of cross sections, the retrieveXS() and retrieveXSEnergies() commands can be used. Both take in an empty array as the first argument, the integer number of energies or cross sections, and a character array representing the reaction type. Available reaction types are 'capture', 'elastic', 'fission', 'absorption', and 'total'.
The getNumXSEnergies() command returns the total number of energies for which the cross section is defined, and the argument is a character array describing the type of reaction with the same options as the retrieve commands. This number is used to construct a correctly sized matrix in which the cross section values will fill when the retrieveXS() command is called. Since the number of energies and cross sections for a set are the same, this number is also used to build both the array for the cross section and the corresponding cross section energies.
>>> num_xs = mix.getNumXSEnergies('capture')
>>> xs = numpy.zeros(num_xs)
>>> mix.retrieveXS(xs, num_xs, 'capture')
>>> num_energies = mix.getNumXSEnergies()
>>> energies = numpy.zeros(num_energies)
>>> mix.retrieveXSEnergies(energies, num_energies, 'capture')
For pulling individual macroscopic cross sections for a material, the 'getTypeMacroXS()' series is available. Types available include Capture, Elastic, Fission, Absorption, Total, and Transport, as shown below. The argument, if a float, is the energy for the desired cross section, and if an integer is used, it is the index location in the cross section array. the units of the macroscopic cross section are reported in cm^-1, or inverse centimeters.
>>> mix.getCaptureMacroXS(0.0253)
0.09140656888484955
>>> mix.getElasticMacroXS(0.0253)
4.566489219665527
>>> mix.getFissionMacroXS(0.0253)
0.2207542359828949
>>> mix.getAbsorptionMacroXS(0.0253)
0.31216078996658325
>>> mix.getTotalMacroXS(0.0253)
4.878650665283203
>>> mix.getTransportMacroXS(0.0253)
1.8474187850952148
##More Material Options PINSPEC is not limited to the examples that are given above. To view the other capabilities of the Material class, see the documentation.
If a static script is used instead of an interpreter, the material section may look like:
mix = Material('Fuel Moderator Homogeneous Mix')
mix.setDensity(5., 'g/cc')
mix.addIsotope(o16, 1.0)
mix.addIsotope(h1, 1.0)
mix.addIsotope(u238, 0.01)
mix.addIsotope(u235, .0025)