diff --git a/.travis.yml b/.travis.yml index acec278ed..b99ce540b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ before_install: - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda info -a - - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy h5py pandas + - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy h5py=2.5 pandas - source activate test-environment # Install GCC, MPICH, HDF5, PHDF5 diff --git a/docs/source/pythonapi/energy_groups.rst b/docs/source/pythonapi/energy_groups.rst deleted file mode 100644 index 28ca6f3fe..000000000 --- a/docs/source/pythonapi/energy_groups.rst +++ /dev/null @@ -1,8 +0,0 @@ -.. _pythonapi_energy_groups: - -============= -Energy Groups -============= - -.. automodule:: openmc.mgxs.groups - :members: diff --git a/docs/source/pythonapi/index.rst b/docs/source/pythonapi/index.rst index 6dd2ae10d..864b48c55 100644 --- a/docs/source/pythonapi/index.rst +++ b/docs/source/pythonapi/index.rst @@ -19,6 +19,7 @@ on a given module or class. :maxdepth: 1 ace + mgxs_library **Creating input files:** @@ -65,8 +66,6 @@ on a given module or class. :maxdepth: 1 mgxs - energy_groups - mgxs_library **Example Jupyter Notebooks:** diff --git a/docs/source/pythonapi/mgxs.rst b/docs/source/pythonapi/mgxs.rst index c7084e565..2a0bb52ba 100644 --- a/docs/source/pythonapi/mgxs.rst +++ b/docs/source/pythonapi/mgxs.rst @@ -4,31 +4,57 @@ Multi-Group Cross Sections ========================== -.. currentmodule:: openmc.mgxs.mgxs - ---------------------------- Summary of Available Classes ---------------------------- +Energy Groups +------------- + +.. currentmodule:: openmc.mgxs.groups + .. autosummary:: - MGXS - AbsorptionXS - CaptureXS - Chi - FissionXS - NuFissionXS - NuScatterXS - NuScatterMatrixXS - ScatterXS - ScatterMatrixXS - TotalXS - TransportXS + EnergyGroups + +Multi-group Cross Sections +-------------------------- + +.. currentmodule:: openmc.mgxs.mgxs + +.. autosummary:: + + MGXS + AbsorptionXS + CaptureXS + Chi + FissionXS + NuFissionXS + NuScatterXS + NuScatterMatrixXS + ScatterXS + ScatterMatrixXS + TotalXS + TransportXS + +Multi-group Cross Section Libraries +----------------------------------- + +.. currentmodule:: openmc.mgxs.library + +.. autosummary:: + + Library ------------------- Class Documentation ------------------- +.. automodule:: openmc.mgxs.groups + :members: + +.. currentmodule:: openmc.mgxs.mgxs + .. autoclass:: MGXS :members: @@ -64,3 +90,6 @@ Class Documentation .. autoclass:: TransportXS :members: + +.. automodule:: openmc.mgxs.library + :members: diff --git a/docs/source/pythonapi/mgxs_library.rst b/docs/source/pythonapi/mgxs_library.rst index 8ac545700..bdcdc364c 100644 --- a/docs/source/pythonapi/mgxs_library.rst +++ b/docs/source/pythonapi/mgxs_library.rst @@ -1,8 +1,8 @@ .. _pythonapi_mgxs_library: -============ -MGXS Library -============ +============================== +Multi-group Cross Section Data +============================== -.. automodule:: openmc.mgxs.library +.. automodule:: openmc.mgxs_library :members: diff --git a/openmc/material.py b/openmc/material.py index e51586205..9db2f03f0 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -723,9 +723,8 @@ class MaterialsFile(object): material.make_isotropic_in_lab() def _create_material_subelements(self): - subelement = ET.SubElement(self._materials_file, "default_xs") - if self._default_xs is not None: + subelement = ET.SubElement(self._materials_file, "default_xs") subelement.text = self._default_xs for material in self._materials: diff --git a/openmc/mgxs_library.py b/openmc/mgxs_library.py index 06b369c68..7f140dd21 100644 --- a/openmc/mgxs_library.py +++ b/openmc/mgxs_library.py @@ -87,8 +87,9 @@ class XSdata(object): ---------- name : str, optional Name of the mgxs data set. - - representation : {'isotropic', 'angle'} + energy_groups : openmc.mgxs.EnergyGroups + Energygroup structure + representation : {'isotropic', 'angle'}, optional Method used in generating the MGXS (isotropic or angle-dependent flux weighting). Defaults to 'isotropic' @@ -99,10 +100,10 @@ class XSdata(object): alias : str Separate unique identifier for the xsdata object kT : float - Temperature (in units of MeV) of this data set. - energy_groups : EnergyGroups + Temperature (in units of MeV). + energy_groups : openmc.mgxs.EnergyGroups Energy group structure - fissionable : boolean + fissionable : bool Whether or not this is a fissionable data set. scatt_type : {'legendre', 'histogram', or 'tabular'} Angular distribution representation (legendre, histogram, or tabular) @@ -115,6 +116,85 @@ class XSdata(object): Legendre polynomial form). Dict contains two keys: 'enable' and 'num_points'. 'enable' is a boolean and 'num_points' is the number of points to use, if 'enable' is True. + num_azimuthal : int + Number of equal width angular bins that the azimuthal angular domain is + subdivided into. This only applies when ``representation`` is "angle". + num_polar : int + Number of equal width angular bins that the polar angular domain is + subdivided into. This only applies when ``representation`` is "angle". + total : numpy.ndarray + Group-wise total cross section ordered by increasing group index (i.e., + fast to thermal). If ``representation`` is "isotropic", then the length + of this list should equal the number of groups described in the + ``groups`` element. If ``representation`` is "angle", then the length + of this list should equal the number of groups times the number of + azimuthal angles times the number of polar angles, with the + inner-dimension being groups, intermediate-dimension being azimuthal + angles and outer-dimension being the polar angles. + absorption : numpy.ndarray + Group-wise absorption cross section ordered by increasing group index + (i.e., fast to thermal). If ``representation`` is "isotropic", then the + length of this list should equal the number of groups described in the + ``groups`` attribute. If ``representation`` is "angle", then the length + of this list should equal the number of groups times the number of + azimuthal angles times the number of polar angles, with the + inner-dimension being groups, intermediate-dimension being azimuthal + angles and outer-dimension being the polar angles. + scatter : numpy.ndarray + Scattering moment matrices presented with the columns representing + incoming group and rows representing the outgoing group. That is, + down-scatter will be above the diagonal of the resultant matrix. This + matrix is repeated for every Legendre order (in order of increasing + orders) if ``scatt_type`` is "legendre"; otherwise, this matrix is + repeated for every bin of the histogram or tabular representation. + Finally, if ``representation`` is "angle", the above is repeated for + every azimuthal angle and every polar angle, in that order. + multiplicity : numpy.ndarray + Ratio of neutrons produced in scattering collisions to the neutrons + which undergo scattering collisions; that is, the multiplicity provides + the code with a scaling factor to account for neutrons being produced in + (n,xn) reactions. This information is assumed isotropic and therefore + does not need to be repeated for every Legendre moment or + histogram/tabular bin. This matrix follows the same arrangement as + described for the ``scatter`` attribute, with the exception of the data + needed to provide the scattering type information. + fission : numpy.ndarray + Group-wise fission cross section ordered by increasing group index + (i.e., fast to thermal). If ``representation`` is "isotropic", then the + length of this list should equal the number of groups described in the + ``groups`` attribute. If ``representation`` is "angle", then the length + of this list should equal the number of groups times the number of + azimuthal angles times the number of polar angles, with the + inner-dimension being groups, intermediate-dimension being azimuthal + angles and outer-dimension being the polar angles. + k_fission : numpy.ndarray + Group-wise kappa-fission cross section ordered by increasing group index + (i.e., fast to thermal). If ``representation`` is "isotropic", then the + length of this list should equal the number of groups described in the + ``groups`` attribute. If ``representation`` is "angle", then the length + of this list should equal the number of groups times the number of + azimuthal angles times the number of polar angles, with the + inner-dimension being groups, intermediate-dimension being azimuthal + angles and outer-dimension being the polar angles. + chi : numpy.ndarray + Group-wise fission spectra ordered by increasing group index (i.e., fast + to thermal). This attribute should be used if making the common + approximation that the fission spectra does not depend on incoming + energy. If the user does not wish to make this approximation, then this + should not be provided and this information included in the + ``nu_fission`` element instead. If ``representation`` is "isotropic", + then the length of this list should equal the number of groups described + in the ``groups`` element. If ``representation`` is "angle", then the + length of this list should equal the number of groups times the number + of azimuthal angles times the number of polar angles, with the + inner-dimension being groups, intermediate-dimension being azimuthal + angles and outer-dimension being the polar angles. + nu_fission : numpy.ndarray + Group-wise fission production cross section vector (i.e., if ``chi`` is + provided), or is the group-wise fission production matrix. If providing + the vector, it should be ordered the same as the ``fission`` data. If + providing the matrix, it should be ordered the same as the + ``multiplicity`` matrix. """ def __init__(self, name, energy_groups, representation="isotropic"): @@ -577,8 +657,6 @@ class MGXSLibraryFile(object): Energy group structure. inverse_velocities : Iterable of Real Inverse of velocities, units of sec/cm - filename : str - XML file to write to. xsdatas : Iterable of XSdata Iterable of multi-Group cross section data objects """ @@ -717,6 +795,3 @@ class MGXSLibraryFile(object): tree = ET.ElementTree(self._cross_sections_file) tree.write(filename, xml_declaration=True, encoding='utf-8', method="xml") - - - diff --git a/tests/test_source/inputs_true.dat b/tests/test_source/inputs_true.dat index 01130ed2e..69a1e2ea8 100644 --- a/tests/test_source/inputs_true.dat +++ b/tests/test_source/inputs_true.dat @@ -1 +1 @@ -5c2fdde85affcd44c1b02c07c300acb8e5c189c1adbf7aa079e37a68e8b8313678fc292bd7f6e0d0957f723e05b8146bd165cf3315dde5f6b2f88ebc954cd65e \ No newline at end of file +526c91551d9a80dc01216e5cb04162253f12ec684cc2b4912ca18cfc510f1ea2e5303029f1c1607882082b0c2c8a47f25dd5be14678f449a1579e3601d1bdec5 \ No newline at end of file