diff --git a/docs/source/pythonapi/base.rst b/docs/source/pythonapi/base.rst index 0a6fbbbc0..2c0ac8797 100644 --- a/docs/source/pythonapi/base.rst +++ b/docs/source/pythonapi/base.rst @@ -124,7 +124,7 @@ Constructing Tallies openmc.ZernikeFilter openmc.ZernikeRadialFilter openmc.ParticleFilter - openmc.Mesh + openmc.RegularMesh openmc.RectilinearMesh openmc.Trigger openmc.TallyDerivative diff --git a/examples/jupyter/mdgxs-part-ii.ipynb b/examples/jupyter/mdgxs-part-ii.ipynb index 4c2cc4048..23ee4d251 100644 --- a/examples/jupyter/mdgxs-part-ii.ipynb +++ b/examples/jupyter/mdgxs-part-ii.ipynb @@ -22,9 +22,7 @@ { "cell_type": "code", "execution_count": 1, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", @@ -82,9 +80,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Create a materials collection and export to XML\n", @@ -102,9 +98,7 @@ { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Create cylinders for the fuel and clad\n", @@ -167,9 +161,7 @@ { "cell_type": "code", "execution_count": 6, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Create a Universe to encapsulate a control rod guide tube\n", @@ -204,9 +196,7 @@ { "cell_type": "code", "execution_count": 7, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Create fuel assembly Lattice\n", @@ -225,9 +215,7 @@ { "cell_type": "code", "execution_count": 8, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Create array indices for guide tube locations in lattice\n", @@ -254,9 +242,7 @@ { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Create root Cell\n", @@ -280,9 +266,7 @@ { "cell_type": "code", "execution_count": 10, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Create Geometry and export to XML\n", @@ -300,9 +284,7 @@ { "cell_type": "code", "execution_count": 11, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# OpenMC simulation parameters\n", @@ -336,9 +318,7 @@ { "cell_type": "code", "execution_count": 12, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -383,9 +363,7 @@ { "cell_type": "code", "execution_count": 13, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Instantiate a 20-group EnergyGroups object\n", @@ -407,14 +385,11 @@ { "cell_type": "code", "execution_count": 14, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Instantiate a tally mesh \n", - "mesh = openmc.Mesh(mesh_id=1)\n", - "mesh.type = 'regular'\n", + "mesh = openmc.RegularMesh(mesh_id=1)\n", "mesh.dimension = [17, 17, 1]\n", "mesh.lower_left = [-10.71, -10.71, -10000.]\n", "mesh.width = [1.26, 1.26, 20000.]\n", @@ -464,9 +439,7 @@ { "cell_type": "code", "execution_count": 15, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -635,9 +608,7 @@ { "cell_type": "code", "execution_count": 16, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Load the last statepoint file\n", @@ -654,9 +625,7 @@ { "cell_type": "code", "execution_count": 17, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Initialize MGXS Library with OpenMC statepoint data\n", @@ -687,9 +656,7 @@ { "cell_type": "code", "execution_count": 18, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stderr", @@ -923,9 +890,7 @@ { "cell_type": "code", "execution_count": 19, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -1110,9 +1075,7 @@ { "cell_type": "code", "execution_count": 20, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stderr", @@ -1189,7 +1152,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python [default]", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -1203,9 +1166,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.5.2" + "version": "3.6.7" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/examples/jupyter/mg-mode-part-i.ipynb b/examples/jupyter/mg-mode-part-i.ipynb index 8e5278787..23227b1ed 100644 --- a/examples/jupyter/mg-mode-part-i.ipynb +++ b/examples/jupyter/mg-mode-part-i.ipynb @@ -86,9 +86,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# The scattering matrix is ordered with incoming groups as rows and outgoing groups as columns\n", @@ -158,9 +156,7 @@ { "cell_type": "code", "execution_count": 5, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# For every cross section data set in the library, assign an openmc.Macroscopic object to a material\n", @@ -207,9 +203,7 @@ { "cell_type": "code", "execution_count": 7, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Create the surface used for each pin\n", @@ -249,9 +243,7 @@ { "cell_type": "code", "execution_count": 8, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "lattices = {}\n", @@ -352,9 +344,7 @@ { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "lattices['Core'] = openmc.RectLattice(name='3x3 core lattice')\n", @@ -396,9 +386,7 @@ { "cell_type": "code", "execution_count": 10, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -426,9 +414,7 @@ { "cell_type": "code", "execution_count": 11, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Create Geometry and set root Universe\n", @@ -456,8 +442,7 @@ "tallies_file = openmc.Tallies()\n", "\n", "# Instantiate a tally Mesh\n", - "mesh = openmc.Mesh()\n", - "mesh.type = 'regular'\n", + "mesh = openmc.RegularMesh()\n", "mesh.dimension = [17 * 2, 17 * 2]\n", "mesh.lower_left = [-32.13, -10.71]\n", "mesh.upper_right = [+10.71, +32.13]\n", @@ -489,9 +474,7 @@ { "cell_type": "code", "execution_count": 13, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# OpenMC simulation parameters\n", @@ -533,9 +516,7 @@ { "cell_type": "code", "execution_count": 14, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -649,9 +630,7 @@ { "cell_type": "code", "execution_count": 15, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -714,7 +693,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.0" + "version": "3.6.7" } }, "nbformat": 4, diff --git a/examples/jupyter/mg-mode-part-ii.ipynb b/examples/jupyter/mg-mode-part-ii.ipynb index e2df6fd3d..85a8d7367 100644 --- a/examples/jupyter/mg-mode-part-ii.ipynb +++ b/examples/jupyter/mg-mode-part-ii.ipynb @@ -564,8 +564,7 @@ ], "source": [ "# Instantiate a tally Mesh\n", - "mesh = openmc.Mesh()\n", - "mesh.type = 'regular'\n", + "mesh = openmc.RegularMesh()\n", "mesh.dimension = [17, 17]\n", "mesh.lower_left = [-10.71, -10.71]\n", "mesh.upper_right = [+10.71, +10.71]\n", @@ -1518,9 +1517,9 @@ ], "metadata": { "kernelspec": { - "display_name": "openmc", + "display_name": "Python 3", "language": "python", - "name": "openmc" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -1532,7 +1531,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.6.7" } }, "nbformat": 4, diff --git a/examples/jupyter/mg-mode-part-iii.ipynb b/examples/jupyter/mg-mode-part-iii.ipynb index 7487b842c..2cf998188 100644 --- a/examples/jupyter/mg-mode-part-iii.ipynb +++ b/examples/jupyter/mg-mode-part-iii.ipynb @@ -545,8 +545,7 @@ "outputs": [], "source": [ "# Instantiate a tally Mesh\n", - "mesh = openmc.Mesh()\n", - "mesh.type = 'regular'\n", + "mesh = openmc.RegularMesh()\n", "mesh.dimension = [10, 10]\n", "mesh.lower_left = [0., 0.]\n", "mesh.upper_right = [length, length]\n", @@ -1417,9 +1416,9 @@ ], "metadata": { "kernelspec": { - "display_name": "openmc", + "display_name": "Python 3", "language": "python", - "name": "openmc" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -1431,7 +1430,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.6.7" } }, "nbformat": 4, diff --git a/examples/jupyter/mgxs-part-iii.ipynb b/examples/jupyter/mgxs-part-iii.ipynb index d3e90d094..5ffb66d3a 100644 --- a/examples/jupyter/mgxs-part-iii.ipynb +++ b/examples/jupyter/mgxs-part-iii.ipynb @@ -586,8 +586,7 @@ "outputs": [], "source": [ "# Instantiate a tally Mesh\n", - "mesh = openmc.Mesh(mesh_id=1)\n", - "mesh.type = 'regular'\n", + "mesh = openmc.RegularMesh(mesh_id=1)\n", "mesh.dimension = [17, 17]\n", "mesh.lower_left = [-10.71, -10.71]\n", "mesh.upper_right = [+10.71, +10.71]\n", @@ -1527,9 +1526,9 @@ "metadata": { "anaconda-cloud": {}, "kernelspec": { - "display_name": "openmc", + "display_name": "Python 3", "language": "python", - "name": "openmc" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -1541,7 +1540,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.6.7" } }, "nbformat": 4, diff --git a/examples/jupyter/pandas-dataframes.ipynb b/examples/jupyter/pandas-dataframes.ipynb index b8b10311c..80a0b880f 100644 --- a/examples/jupyter/pandas-dataframes.ipynb +++ b/examples/jupyter/pandas-dataframes.ipynb @@ -341,8 +341,7 @@ "outputs": [], "source": [ "# Instantiate a tally Mesh\n", - "mesh = openmc.Mesh(mesh_id=1)\n", - "mesh.type = 'regular'\n", + "mesh = openmc.RegularMesh(mesh_id=1)\n", "mesh.dimension = [17, 17]\n", "mesh.lower_left = [-10.71, -10.71]\n", "mesh.width = [1.26, 1.26]\n", @@ -1986,7 +1985,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.6" + "version": "3.6.7" } }, "nbformat": 4, diff --git a/examples/jupyter/post-processing.ipynb b/examples/jupyter/post-processing.ipynb index 1223f67f3..a6d134b54 100644 --- a/examples/jupyter/post-processing.ipynb +++ b/examples/jupyter/post-processing.ipynb @@ -319,7 +319,7 @@ "outputs": [], "source": [ "# Create mesh which will be used for tally\n", - "mesh = openmc.Mesh()\n", + "mesh = openmc.RegularMesh()\n", "mesh.dimension = [100, 100]\n", "mesh.lower_left = [-0.63, -0.63]\n", "mesh.upper_right = [0.63, 0.63]\n", diff --git a/examples/jupyter/tally-arithmetic.ipynb b/examples/jupyter/tally-arithmetic.ipynb index 2bccf73f2..35c096ba4 100644 --- a/examples/jupyter/tally-arithmetic.ipynb +++ b/examples/jupyter/tally-arithmetic.ipynb @@ -284,9 +284,7 @@ { "cell_type": "code", "execution_count": 11, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "# Run openmc in plotting mode\n", @@ -296,9 +294,7 @@ { "cell_type": "code", "execution_count": 12, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -376,8 +372,7 @@ "tallies_file.append(tally)\n", "\n", "# Instantiate a tally mesh\n", - "mesh = openmc.Mesh(mesh_id=1)\n", - "mesh.type = 'regular'\n", + "mesh = openmc.RegularMesh(mesh_id=1)\n", "mesh.dimension = [1, 1, 1]\n", "mesh.lower_left = [-0.63, -0.63, -100.]\n", "mesh.width = [1.26, 1.26, 200.]\n", @@ -485,9 +480,7 @@ { "cell_type": "code", "execution_count": 20, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stderr", @@ -518,7 +511,6 @@ "cell_type": "code", "execution_count": 21, "metadata": { - "collapsed": false, "scrolled": true }, "outputs": [ @@ -674,9 +666,7 @@ { "cell_type": "code", "execution_count": 23, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -740,9 +730,7 @@ { "cell_type": "code", "execution_count": 24, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -807,9 +795,7 @@ { "cell_type": "code", "execution_count": 25, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -873,9 +859,7 @@ { "cell_type": "code", "execution_count": 26, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -939,9 +923,7 @@ { "cell_type": "code", "execution_count": 27, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -1004,9 +986,7 @@ { "cell_type": "code", "execution_count": 28, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -1066,9 +1046,7 @@ { "cell_type": "code", "execution_count": 29, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -1128,9 +1106,7 @@ { "cell_type": "code", "execution_count": 30, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -1210,9 +1186,7 @@ { "cell_type": "code", "execution_count": 32, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -1358,9 +1332,7 @@ { "cell_type": "code", "execution_count": 33, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1390,9 +1362,7 @@ { "cell_type": "code", "execution_count": 34, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1414,9 +1384,7 @@ { "cell_type": "code", "execution_count": 35, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -1445,9 +1413,7 @@ { "cell_type": "code", "execution_count": 36, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -1539,9 +1505,7 @@ { "cell_type": "code", "execution_count": 37, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -1709,7 +1673,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.0" + "version": "3.6.7" } }, "nbformat": 4, diff --git a/examples/python/lattice/nested/build-xml.py b/examples/python/lattice/nested/build-xml.py index 37483a939..06641f5ac 100644 --- a/examples/python/lattice/nested/build-xml.py +++ b/examples/python/lattice/nested/build-xml.py @@ -150,8 +150,7 @@ plot_file.export_to_xml() ############################################################################### # Instantiate a tally mesh -mesh = openmc.Mesh(mesh_id=1) -mesh.type = 'regular' +mesh = openmc.RegularMesh(mesh_id=1) mesh.dimension = [4, 4] mesh.lower_left = [-2, -2] mesh.width = [1, 1] @@ -164,6 +163,7 @@ tally = openmc.Tally(tally_id=1) tally.filters = [mesh_filter] tally.scores = ['total'] -# Instantiate a Tallies collection, register Tally/Mesh, and export to XML +# Instantiate a Tallies collection, register Tally/RegularMesh, and export to +# XML tallies_file = openmc.Tallies([tally]) tallies_file.export_to_xml() diff --git a/examples/python/lattice/simple/build-xml.py b/examples/python/lattice/simple/build-xml.py index 1cdfa24f3..17544b87f 100644 --- a/examples/python/lattice/simple/build-xml.py +++ b/examples/python/lattice/simple/build-xml.py @@ -143,8 +143,7 @@ plot_file.export_to_xml() ############################################################################### # Instantiate a tally mesh -mesh = openmc.Mesh(mesh_id=1) -mesh.type = 'regular' +mesh = openmc.RegularMesh(mesh_id=1) mesh.dimension = [4, 4] mesh.lower_left = [-2, -2] mesh.width = [1, 1] diff --git a/examples/python/pincell/build-xml.py b/examples/python/pincell/build-xml.py index c728d5f36..072cc911f 100644 --- a/examples/python/pincell/build-xml.py +++ b/examples/python/pincell/build-xml.py @@ -106,7 +106,7 @@ bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1] uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True) settings_file.source = openmc.source.Source(space=uniform_dist) -entropy_mesh = openmc.Mesh() +entropy_mesh = openmc.RegularMesh() entropy_mesh.lower_left = [-0.39218, -0.39218, -1.e50] entropy_mesh.upper_right = [0.39218, 0.39218, 1.e50] entropy_mesh.dimension = [10, 10, 1] @@ -119,8 +119,7 @@ settings_file.export_to_xml() ############################################################################### # Instantiate a tally mesh -mesh = openmc.Mesh() -mesh.type = 'regular' +mesh = openmc.RegularMesh() mesh.dimension = [100, 100, 1] mesh.lower_left = [-0.62992, -0.62992, -1.e50] mesh.upper_right = [0.62992, 0.62992, 1.e50] diff --git a/examples/python/pincell_depletion/restart_depletion.py b/examples/python/pincell_depletion/restart_depletion.py index f9324a8cb..d5a0e2234 100644 --- a/examples/python/pincell_depletion/restart_depletion.py +++ b/examples/python/pincell_depletion/restart_depletion.py @@ -47,7 +47,7 @@ bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1] uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True) settings_file.source = openmc.source.Source(space=uniform_dist) -entropy_mesh = openmc.Mesh() +entropy_mesh = openmc.RegularMesh() entropy_mesh.lower_left = [-0.39218, -0.39218, -1.e50] entropy_mesh.upper_right = [0.39218, 0.39218, 1.e50] entropy_mesh.dimension = [10, 10, 1] diff --git a/examples/python/pincell_depletion/run_depletion.py b/examples/python/pincell_depletion/run_depletion.py index c1ad9d20a..5a018cda1 100644 --- a/examples/python/pincell_depletion/run_depletion.py +++ b/examples/python/pincell_depletion/run_depletion.py @@ -119,7 +119,7 @@ bounds = [-0.62992, -0.62992, -1, 0.62992, 0.62992, 1] uniform_dist = openmc.stats.Box(bounds[:3], bounds[3:], only_fissionable=True) settings_file.source = openmc.source.Source(space=uniform_dist) -entropy_mesh = openmc.Mesh() +entropy_mesh = openmc.RegularMesh() entropy_mesh.lower_left = [-0.39218, -0.39218, -1.e50] entropy_mesh.upper_right = [0.39218, 0.39218, 1.e50] entropy_mesh.dimension = [10, 10, 1] diff --git a/examples/python/pincell_multigroup/build-xml.py b/examples/python/pincell_multigroup/build-xml.py index 995cd87db..bb9fc7860 100644 --- a/examples/python/pincell_multigroup/build-xml.py +++ b/examples/python/pincell_multigroup/build-xml.py @@ -155,8 +155,7 @@ settings_file.export_to_xml() ############################################################################### # Instantiate a tally mesh -mesh = openmc.Mesh(mesh_id=1) -mesh.type = 'regular' +mesh = openmc.RegularMesh(mesh_id=1) mesh.dimension = [100, 100, 1] mesh.lower_left = [-0.63, -0.63, -1.e50] mesh.upper_right = [0.63, 0.63, 1.e50] diff --git a/openmc/capi/filter.py b/openmc/capi/filter.py index 05ec85d01..c0716bcef 100644 --- a/openmc/capi/filter.py +++ b/openmc/capi/filter.py @@ -11,7 +11,7 @@ from . import _dll from .core import _FortranObjectWithID from .error import _error_handler from .material import Material -from .mesh import Mesh +from .mesh import RegularMesh __all__ = ['Filter', 'AzimuthalFilter', 'CellFilter', @@ -255,7 +255,7 @@ class MeshFilter(Filter): def mesh(self): index_mesh = c_int32() _dll.openmc_mesh_filter_get_mesh(self._index, index_mesh) - return Mesh(index=index_mesh.value) + return RegularMesh(index=index_mesh.value) @mesh.setter def mesh(self, mesh): @@ -274,7 +274,7 @@ class MeshSurfaceFilter(Filter): def mesh(self): index_mesh = c_int32() _dll.openmc_meshsurface_filter_get_mesh(self._index, index_mesh) - return Mesh(index=index_mesh.value) + return RegularMesh(index=index_mesh.value) @mesh.setter def mesh(self, mesh): diff --git a/openmc/capi/mesh.py b/openmc/capi/mesh.py index 70a4345b0..a1161f48f 100644 --- a/openmc/capi/mesh.py +++ b/openmc/capi/mesh.py @@ -11,7 +11,7 @@ from .core import _FortranObjectWithID from .error import _error_handler from .material import Material -__all__ = ['Mesh', 'meshes'] +__all__ = ['RegularMesh', 'meshes'] # Mesh functions _dll.openmc_extend_meshes.argtypes = [c_int32, POINTER(c_int32), POINTER(c_int32)] @@ -45,8 +45,8 @@ _dll.n_meshes.argtypes = [] _dll.n_meshes.restype = c_int -class Mesh(_FortranObjectWithID): - """Mesh stored internally. +class RegularMesh(_FortranObjectWithID): + """RegularMesh stored internally. This class exposes a mesh that is stored internally in the OpenMC library. To obtain a view of a mesh with a given ID, use the @@ -170,11 +170,11 @@ class _MeshMapping(Mapping): except (AllocationError, InvalidIDError) as e: # __contains__ expects a KeyError to work correctly raise KeyError(str(e)) - return Mesh(index=index.value) + return RegularMesh(index=index.value) def __iter__(self): for i in range(len(self)): - yield Mesh(index=i).id + yield RegularMesh(index=i).id def __len__(self): return _dll.n_meshes() diff --git a/openmc/cmfd.py b/openmc/cmfd.py index d1ea77fa0..244ceadcf 100644 --- a/openmc/cmfd.py +++ b/openmc/cmfd.py @@ -2605,16 +2605,16 @@ class CMFDRun(object): def _create_cmfd_tally(self): """Creates all tallies in-memory that are used to solve CMFD problem""" # Create Mesh object based on CMFDMesh, stored internally - cmfd_mesh = openmc.capi.Mesh() - # Store id of Mesh object + cmfd_mesh = openmc.capi.RegularMesh() + # Store id of mesh object self._mesh_id = cmfd_mesh.id - # Set dimension and parameters of Mesh object + # Set dimension and parameters of mesh object cmfd_mesh.dimension = self._mesh.dimension cmfd_mesh.set_parameters(lower_left=self._mesh.lower_left, upper_right=self._mesh.upper_right, width=self._mesh.width) - # Create Mesh Filter object, stored internally + # Create mesh Filter object, stored internally mesh_filter = openmc.capi.MeshFilter() # Set mesh for Mesh Filter mesh_filter.mesh = cmfd_mesh diff --git a/openmc/filter.py b/openmc/filter.py index fa1085b97..dbdaf2e19 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -161,8 +161,8 @@ class Filter(IDManagerMixin, metaclass=FilterMeta): Keyword arguments ----------------- meshes : dict - Dictionary mapping integer IDs to openmc.Mesh objects. Only used - for openmc.MeshFilter objects. + Dictionary mapping integer IDs to openmc.MeshBase objects. Only + used for openmc.MeshFilter objects. """ @@ -587,15 +587,15 @@ class MeshFilter(Filter): Parameters ---------- - mesh : openmc.Mesh - The Mesh object that events will be tallied onto + mesh : openmc.MeshBase + The mesh object that events will be tallied onto filter_id : int Unique identifier for the filter Attributes ---------- - mesh : openmc.Mesh - The Mesh object that events will be tallied onto + mesh : openmc.MeshBase + The mesh object that events will be tallied onto id : int Unique identifier for the filter bins : list of tuple @@ -688,7 +688,7 @@ class MeshFilter(Filter): # Initialize dictionary to build Pandas Multi-index column filter_dict = {} - # Append Mesh ID as outermost index of multi-index + # Append mesh ID as outermost index of multi-index mesh_key = 'mesh {}'.format(self.mesh.id) # Find mesh dimensions - use 3D indices for simplicity @@ -750,17 +750,17 @@ class MeshSurfaceFilter(MeshFilter): Parameters ---------- - mesh : openmc.Mesh - The Mesh object that events will be tallied onto + mesh : openmc.MeshBase + The mesh object that events will be tallied onto filter_id : int Unique identifier for the filter Attributes ---------- bins : Integral - The Mesh ID - mesh : openmc.Mesh - The Mesh object that events will be tallied onto + The mesh ID + mesh : openmc.MeshBase + The mesh object that events will be tallied onto id : int Unique identifier for the filter bins : list of tuple @@ -817,7 +817,7 @@ class MeshSurfaceFilter(MeshFilter): # Initialize dictionary to build Pandas Multi-index column filter_dict = {} - # Append Mesh ID as outermost index of multi-index + # Append mesh ID as outermost index of multi-index mesh_key = 'mesh {}'.format(self.mesh.id) # Find mesh dimensions - use 3D indices for simplicity diff --git a/openmc/mesh.py b/openmc/mesh.py index 5b6b8ad3e..861afbd02 100644 --- a/openmc/mesh.py +++ b/openmc/mesh.py @@ -3,6 +3,7 @@ from collections.abc import Iterable from numbers import Real, Integral from xml.etree import ElementTree as ET import sys +import warnings import numpy as np @@ -69,14 +70,14 @@ class MeshBase(IDManagerMixin, metaclass=ABCMeta): mesh_type = group['type'][()].decode() if mesh_type == 'regular': - return Mesh.from_hdf5(group) + return RegularMesh.from_hdf5(group) elif mesh_type == 'rectilinear': return RectilinearMesh.from_hdf5(group) else: raise ValueError('Unrecognized mesh type: "' + mesh_type + '"') -class Mesh(MeshBase): +class RegularMesh(MeshBase): """A regular Cartesian mesh in one, two, or three dimensions Parameters @@ -113,7 +114,6 @@ class Mesh(MeshBase): def __init__(self, mesh_id=None, name=''): super().__init__(mesh_id, name) - # Initialize Mesh class attributes self._dimension = None self._lower_left = None self._upper_right = None @@ -186,7 +186,7 @@ class Mesh(MeshBase): self._width = width def __repr__(self): - string = 'Mesh\n' + string = 'RegularMesh\n' string += '{0: <16}{1}{2}\n'.format('\tID', '=\t', self._id) string += '{0: <16}{1}{2}\n'.format('\tName', '=\t', self._name) string += '{0: <16}{1}{2}\n'.format('\tType', '=\t', self._type) @@ -227,8 +227,8 @@ class Mesh(MeshBase): Returns ------- - openmc.Mesh - Mesh instance + openmc.RegularMesh + RegularMesh instance """ cv.check_type('rectangular lattice', lattice, openmc.RectLattice) @@ -255,7 +255,6 @@ class Mesh(MeshBase): element = ET.Element("mesh") element.set("id", str(self._id)) - element.set("type", "regular") subelement = ET.SubElement(element, "dimension") subelement.text = ' '.join(map(str, self._dimension)) @@ -403,6 +402,12 @@ class Mesh(MeshBase): return root_cell, cells +def Mesh(*args, **kwargs): + warnings.warn("Mesh has been renamed RegularMesh. Future versions of " + "OpenMC will not accept the name Mesh.") + return RegularMesh(*args, **kwargs) + + class RectilinearMesh(MeshBase): """A 3D rectilinear Cartesian mesh diff --git a/openmc/mgxs/library.py b/openmc/mgxs/library.py index 7b75d90ff..fbf08f85f 100644 --- a/openmc/mgxs/library.py +++ b/openmc/mgxs/library.py @@ -51,7 +51,7 @@ class Library(object): The types of cross sections in the library (e.g., ['total', 'scatter']) domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization - domains : Iterable of openmc.Material, openmc.Cell, openmc.Universe or openmc.Mesh + domains : Iterable of openmc.Material, openmc.Cell, openmc.Universe or openmc.RegularMesh The spatial domain(s) for which MGXS in the Library are computed correction : {'P0', None} Apply the P0 correction to scattering matrices if set to 'P0' @@ -324,7 +324,7 @@ class Library(object): cv.check_type('domain', domains, Iterable, openmc.Universe) all_domains = self.geometry.get_all_universes().values() elif self.domain_type == 'mesh': - cv.check_type('domain', domains, Iterable, openmc.Mesh) + cv.check_type('domain', domains, Iterable, openmc.RegularMesh) # The mesh and geometry are independent, so set all_domains # to the input domains @@ -606,7 +606,7 @@ class Library(object): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh or Integral + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh or Integral The material, cell, or universe object of interest (or its ID) mgxs_type : {'total', 'transport', 'nu-transport', 'absorption', 'capture', 'fission', 'nu-fission', 'kappa-fission', 'scatter', 'nu-scatter', 'scatter matrix', 'nu-scatter matrix', 'multiplicity matrix', 'nu-fission matrix', chi', 'chi-prompt', 'inverse-velocity', 'prompt-nu-fission', 'prompt-nu-fission matrix', 'delayed-nu-fission', 'delayed-nu-fission matrix', 'chi-delayed', 'beta'} The type of multi-group cross section object to return @@ -631,7 +631,7 @@ class Library(object): elif self.domain_type == 'universe': cv.check_type('domain', domain, (openmc.Universe, Integral)) elif self.domain_type == 'mesh': - cv.check_type('domain', domain, (openmc.Mesh, Integral)) + cv.check_type('domain', domain, (openmc.RegularMesh, Integral)) # Check that requested domain is included in library if isinstance(domain, Integral): @@ -916,7 +916,7 @@ class Library(object): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization xsdata_name : str Name to apply to the "xsdata" entry produced by this method @@ -930,7 +930,7 @@ class Library(object): subdomain : iterable of int This parameter is not used unless using a mesh domain. In that case, the subdomain is an [i,j,k] index (1-based indexing) of the - mesh cell of interest in the openmc.Mesh object. Note: + mesh cell of interest in the openmc.RegularMesh object. Note: this parameter currently only supports subdomains within a mesh, and not the subdomains of a distribcell. @@ -952,7 +952,7 @@ class Library(object): """ cv.check_type('domain', domain, (openmc.Material, openmc.Cell, - openmc.Universe, openmc.Mesh)) + openmc.Universe, openmc.RegularMesh)) cv.check_type('xsdata_name', xsdata_name, str) cv.check_type('nuclide', nuclide, str) cv.check_value('xs_type', xs_type, ['macro', 'micro']) diff --git a/openmc/mgxs/mdgxs.py b/openmc/mgxs/mdgxs.py index 2d278d62d..14bc524ee 100644 --- a/openmc/mgxs/mdgxs.py +++ b/openmc/mgxs/mdgxs.py @@ -40,7 +40,7 @@ class MDGXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -68,7 +68,7 @@ class MDGXS(MGXS): Reaction type (e.g., 'chi-delayed', 'beta', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -238,7 +238,7 @@ class MDGXS(MGXS): mdgxs_type : {'delayed-nu-fission', 'chi-delayed', 'beta', 'decay-rate', 'delayed-nu-fission matrix'} The type of multi-delayed-group cross section object to return domain : openmc.Material or openmc.Cell or openmc.Universe or - openmc.Mesh + openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -917,7 +917,7 @@ class ChiDelayed(MDGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -945,7 +945,7 @@ class ChiDelayed(MDGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -1429,7 +1429,7 @@ class DelayedNuFissionXS(MDGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -1457,7 +1457,7 @@ class DelayedNuFissionXS(MDGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -1563,7 +1563,7 @@ class Beta(MDGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -1591,7 +1591,7 @@ class Beta(MDGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -1746,7 +1746,7 @@ class DecayRate(MDGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -1774,7 +1774,7 @@ class DecayRate(MDGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -1921,7 +1921,7 @@ class MatrixMDGXS(MDGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -1949,7 +1949,7 @@ class MatrixMDGXS(MDGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -2512,7 +2512,7 @@ class DelayedNuFissionMatrixXS(MatrixMDGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -2540,7 +2540,7 @@ class DelayedNuFissionMatrixXS(MatrixMDGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 01a03f650..d3d39e0f6 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -56,7 +56,7 @@ _DOMAIN_TO_FILTER = {'cell': openmc.CellFilter, _DOMAINS = (openmc.Cell, openmc.Universe, openmc.Material, - openmc.Mesh) + openmc.RegularMesh) # Supported ScatterMatrixXS angular distribution types MU_TREATMENTS = ('legendre', 'histogram') @@ -124,7 +124,7 @@ class MGXS(metaclass=ABCMeta): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -150,7 +150,7 @@ class MGXS(metaclass=ABCMeta): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -606,7 +606,7 @@ class MGXS(metaclass=ABCMeta): self._domain_type = 'cell' elif isinstance(domain, openmc.Universe): self._domain_type = 'universe' - elif isinstance(domain, openmc.Mesh): + elif isinstance(domain, openmc.RegularMesh): self._domain_type = 'mesh' @domain_type.setter @@ -675,7 +675,7 @@ class MGXS(metaclass=ABCMeta): ---------- mgxs_type : {'total', 'transport', 'nu-transport', 'absorption', 'capture', 'fission', 'nu-fission', 'kappa-fission', 'scatter', 'nu-scatter', 'scatter matrix', 'nu-scatter matrix', 'multiplicity matrix', 'nu-fission matrix', 'chi', 'chi-prompt', 'inverse-velocity', 'prompt-nu-fission', 'prompt-nu-fission matrix'} The type of multi-group cross section object to return - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -1985,7 +1985,7 @@ class MatrixMGXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -2011,7 +2011,7 @@ class MatrixMGXS(MGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -2478,7 +2478,7 @@ class TotalXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -2504,7 +2504,7 @@ class TotalXS(MGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -2609,7 +2609,7 @@ class TransportXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -2640,7 +2640,7 @@ class TransportXS(MGXS): If True, the cross section data will include neutron multiplication by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -2834,7 +2834,7 @@ class AbsorptionXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -2860,7 +2860,7 @@ class AbsorptionXS(MGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -2961,7 +2961,7 @@ class CaptureXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -2987,7 +2987,7 @@ class CaptureXS(MGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -3103,7 +3103,7 @@ class FissionXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -3140,7 +3140,7 @@ class FissionXS(MGXS): If true, computes cross sections which only includes prompt neutrons by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -3282,7 +3282,7 @@ class KappaFissionXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -3308,7 +3308,7 @@ class KappaFissionXS(MGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -3408,7 +3408,7 @@ class ScatterXS(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -3439,7 +3439,7 @@ class ScatterXS(MGXS): If True, the cross section data will include neutron multiplication by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -3602,7 +3602,7 @@ class ScatterMatrixXS(MatrixMGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -3656,7 +3656,7 @@ class ScatterMatrixXS(MatrixMGXS): If True, the cross section data will include neutron multiplication by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -4715,7 +4715,7 @@ class MultiplicityMatrixXS(MatrixMGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -4741,7 +4741,7 @@ class MultiplicityMatrixXS(MatrixMGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -4880,7 +4880,7 @@ class ScatterProbabilityMatrix(MatrixMGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -4906,7 +4906,7 @@ class ScatterProbabilityMatrix(MatrixMGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -5042,7 +5042,7 @@ class NuFissionMatrixXS(MatrixMGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -5073,7 +5073,7 @@ class NuFissionMatrixXS(MatrixMGXS): If true, computes cross sections which only includes prompt neutrons by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -5198,7 +5198,7 @@ class Chi(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -5229,7 +5229,7 @@ class Chi(MGXS): If true, computes cross sections which only includes prompt neutrons by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization @@ -5780,7 +5780,7 @@ class InverseVelocity(MGXS): Parameters ---------- - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh The domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} The domain type for spatial homogenization @@ -5806,7 +5806,7 @@ class InverseVelocity(MGXS): Reaction type (e.g., 'total', 'nu-fission', etc.) by_nuclide : bool If true, computes cross sections for each nuclide in domain - domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.Mesh + domain : openmc.Material or openmc.Cell or openmc.Universe or openmc.RegularMesh Domain for spatial homogenization domain_type : {'material', 'cell', 'distribcell', 'universe', 'mesh'} Domain type for spatial homogenization diff --git a/openmc/plots.py b/openmc/plots.py index eb582502e..d3359f5ac 100644 --- a/openmc/plots.py +++ b/openmc/plots.py @@ -214,8 +214,8 @@ class Plot(IDManagerMixin): level : int Universe depth to plot at meshlines : dict - Dictionary defining type, id, linewidth and color of a regular mesh - to be plotted on top of a plot + Dictionary defining type, id, linewidth and color of a mesh to be + plotted on top of a plot """ diff --git a/openmc/settings.py b/openmc/settings.py index f348bc6cb..a93dd345d 100644 --- a/openmc/settings.py +++ b/openmc/settings.py @@ -9,7 +9,7 @@ import numpy as np from openmc._xml import clean_indentation import openmc.checkvalue as cv -from openmc import VolumeCalculation, Source, Mesh +from openmc import VolumeCalculation, Source, RegularMesh _RUN_MODES = ['eigenvalue', 'fixed source', 'plot', 'volume', 'particle restart'] _RES_SCAT_METHODS = ['dbrc', 'rvs'] @@ -45,7 +45,7 @@ class Settings(object): secondary bremsstrahlung photons ('ttb'). energy_mode : {'continuous-energy', 'multi-group'} Set whether the calculation should be continuous-energy or multi-group. - entropy_mesh : openmc.Mesh + entropy_mesh : openmc.RegularMesh Mesh to be used to calculate Shannon entropy. If the mesh dimensions are not specified. OpenMC assigns a mesh such that 20 source sites per mesh cell are to be expected on average. @@ -145,7 +145,7 @@ class Settings(object): Maximum number of batches simulated. If this is set, the number of batches specified via ``batches`` is interpreted as the minimum number of batches - ufs_mesh : openmc.Mesh + ufs_mesh : openmc.RegularMesh Mesh to be used for redistributing source sites via the uniform fision site (UFS) method. verbosity : int @@ -551,7 +551,7 @@ class Settings(object): @entropy_mesh.setter def entropy_mesh(self, entropy): - cv.check_type('entropy mesh', entropy, Mesh) + cv.check_type('entropy mesh', entropy, RegularMesh) cv.check_length('entropy mesh dimension', entropy.dimension, 3) cv.check_length('entropy mesh lower-left corner', entropy.lower_left, 3) cv.check_length('entropy mesh upper-right corner', entropy.upper_right, 3) @@ -640,7 +640,7 @@ class Settings(object): @ufs_mesh.setter def ufs_mesh(self, ufs_mesh): - cv.check_type('UFS mesh', ufs_mesh, Mesh) + cv.check_type('UFS mesh', ufs_mesh, RegularMesh) cv.check_length('UFS mesh dimension', ufs_mesh.dimension, 3) cv.check_length('UFS mesh lower-left corner', ufs_mesh.lower_left, 3) cv.check_length('UFS mesh upper-right corner', ufs_mesh.upper_right, 3) diff --git a/openmc/statepoint.py b/openmc/statepoint.py index 1991c5be6..c9a8f9f9a 100644 --- a/openmc/statepoint.py +++ b/openmc/statepoint.py @@ -72,7 +72,7 @@ class StatePoint(object): k_generation : numpy.ndarray Estimate of k-effective for each batch/generation meshes : dict - Dictionary whose keys are mesh IDs and whose values are Mesh objects + Dictionary whose keys are mesh IDs and whose values are MeshBase objects n_batches : int Number of batches n_inactive : int @@ -292,7 +292,7 @@ class StatePoint(object): if not self._meshes_read: mesh_group = self._f['tallies/meshes'] - # Iterate over all Meshes + # Iterate over all meshes for group in mesh_group.values(): mesh = openmc.MeshBase.from_hdf5(group) self._meshes[mesh.id] = mesh diff --git a/openmc/trigger.py b/openmc/trigger.py index 71f9c0b92..98557aab5 100644 --- a/openmc/trigger.py +++ b/openmc/trigger.py @@ -31,7 +31,6 @@ class Trigger(object): """ def __init__(self, trigger_type, threshold): - # Initialize Mesh class attributes self.trigger_type = trigger_type self.threshold = threshold self._scores = [] diff --git a/tests/regression_tests/filter_mesh/inputs_true.dat b/tests/regression_tests/filter_mesh/inputs_true.dat index 7afd834cd..6755a64c8 100644 --- a/tests/regression_tests/filter_mesh/inputs_true.dat +++ b/tests/regression_tests/filter_mesh/inputs_true.dat @@ -309,17 +309,17 @@ - + 17 -182.07 182.07 - + 17 17 -182.07 -182.07 182.07 182.07 - + 17 17 17 -182.07 -182.07 -183.0 182.07 182.07 183.0 diff --git a/tests/regression_tests/filter_mesh/test.py b/tests/regression_tests/filter_mesh/test.py index 79e2082da..ed2e9b35b 100644 --- a/tests/regression_tests/filter_mesh/test.py +++ b/tests/regression_tests/filter_mesh/test.py @@ -10,20 +10,17 @@ class FilterMeshTestHarness(HashedPyAPITestHarness): super().__init__(*args, **kwargs) # Initialize Meshes - mesh_1d = openmc.Mesh(mesh_id=1) - mesh_1d.type = 'regular' + mesh_1d = openmc.RegularMesh(mesh_id=1) mesh_1d.dimension = [17] mesh_1d.lower_left = [-182.07] mesh_1d.upper_right = [182.07] - mesh_2d = openmc.Mesh(mesh_id=2) - mesh_2d.type = 'regular' + mesh_2d = openmc.RegularMesh(mesh_id=2) mesh_2d.dimension = [17, 17] mesh_2d.lower_left = [-182.07, -182.07] mesh_2d.upper_right = [182.07, 182.07] - mesh_3d = openmc.Mesh(mesh_id=3) - mesh_3d.type = 'regular' + mesh_3d = openmc.RegularMesh(mesh_id=3) mesh_3d.dimension = [17, 17, 17] mesh_3d.lower_left = [-182.07, -182.07, -183.00] mesh_3d.upper_right = [182.07, 182.07, 183.00] diff --git a/tests/regression_tests/mg_tallies/inputs_true.dat b/tests/regression_tests/mg_tallies/inputs_true.dat index b75573b0a..562958722 100644 --- a/tests/regression_tests/mg_tallies/inputs_true.dat +++ b/tests/regression_tests/mg_tallies/inputs_true.dat @@ -33,7 +33,7 @@ - + 10 1 1 0.0 0.0 0.0 929.45 1000 1000 diff --git a/tests/regression_tests/mg_tallies/test.py b/tests/regression_tests/mg_tallies/test.py index b0a898710..e1c19e6b7 100644 --- a/tests/regression_tests/mg_tallies/test.py +++ b/tests/regression_tests/mg_tallies/test.py @@ -62,8 +62,7 @@ def test_mg_tallies(): model = slab_mg() # Instantiate a tally mesh - mesh = openmc.Mesh(mesh_id=1) - mesh.type = 'regular' + mesh = openmc.RegularMesh(mesh_id=1) mesh.dimension = [10, 1, 1] mesh.lower_left = [0.0, 0.0, 0.0] mesh.upper_right = [929.45, 1000, 1000] diff --git a/tests/regression_tests/mgxs_library_mesh/inputs_true.dat b/tests/regression_tests/mgxs_library_mesh/inputs_true.dat index 299da0713..4f138b24f 100644 --- a/tests/regression_tests/mgxs_library_mesh/inputs_true.dat +++ b/tests/regression_tests/mgxs_library_mesh/inputs_true.dat @@ -309,7 +309,7 @@ - + 2 2 -100.0 -100.0 100.0 100.0 diff --git a/tests/regression_tests/mgxs_library_mesh/test.py b/tests/regression_tests/mgxs_library_mesh/test.py index a9d24da93..b72fdf2f1 100644 --- a/tests/regression_tests/mgxs_library_mesh/test.py +++ b/tests/regression_tests/mgxs_library_mesh/test.py @@ -27,8 +27,7 @@ class MGXSTestHarness(PyAPITestHarness): self.mgxs_lib.domain_type = 'mesh' # Instantiate a tally mesh - mesh = openmc.Mesh(mesh_id=1) - mesh.type = 'regular' + mesh = openmc.RegularMesh(mesh_id=1) mesh.dimension = [2, 2] mesh.lower_left = [-100., -100.] mesh.width = [100., 100.] diff --git a/tests/regression_tests/tallies/inputs_true.dat b/tests/regression_tests/tallies/inputs_true.dat index 3ec8d8d4c..9409ca4a7 100644 --- a/tests/regression_tests/tallies/inputs_true.dat +++ b/tests/regression_tests/tallies/inputs_true.dat @@ -309,7 +309,7 @@ - + 2 2 -182.07 -182.07 182.07 182.07 diff --git a/tests/regression_tests/tallies/test.py b/tests/regression_tests/tallies/test.py index 543d0acd2..d4857b3ec 100644 --- a/tests/regression_tests/tallies/test.py +++ b/tests/regression_tests/tallies/test.py @@ -1,6 +1,6 @@ from openmc.filter import * from openmc.filter_expansion import * -from openmc import Mesh, Tally +from openmc import RegularMesh, Tally from tests.testing_harness import HashedPyAPITestHarness @@ -28,7 +28,7 @@ def test_tallies(): azimuthal_tally2.scores = ['flux'] azimuthal_tally2.estimator = 'analog' - mesh_2x2 = Mesh(mesh_id=1) + mesh_2x2 = RegularMesh(mesh_id=1) mesh_2x2.lower_left = [-182.07, -182.07] mesh_2x2.upper_right = [182.07, 182.07] mesh_2x2.dimension = [2, 2] diff --git a/tests/regression_tests/tally_arithmetic/inputs_true.dat b/tests/regression_tests/tally_arithmetic/inputs_true.dat index 3605005ad..842b0df62 100644 --- a/tests/regression_tests/tally_arithmetic/inputs_true.dat +++ b/tests/regression_tests/tally_arithmetic/inputs_true.dat @@ -309,7 +309,7 @@ - + 2 2 2 -160.0 -160.0 -183.0 160.0 160.0 183.0 diff --git a/tests/regression_tests/tally_arithmetic/test.py b/tests/regression_tests/tally_arithmetic/test.py index 3adf0c5be..236f5cc38 100644 --- a/tests/regression_tests/tally_arithmetic/test.py +++ b/tests/regression_tests/tally_arithmetic/test.py @@ -10,8 +10,7 @@ class TallyArithmeticTestHarness(PyAPITestHarness): super().__init__(*args, **kwargs) # Initialize Mesh - mesh = openmc.Mesh(mesh_id=1) - mesh.type = 'regular' + mesh = openmc.RegularMesh(mesh_id=1) mesh.dimension = [2, 2, 2] mesh.lower_left = [-160.0, -160.0, -183.0] mesh.upper_right = [160.0, 160.0, 183.0] diff --git a/tests/regression_tests/tally_slice_merge/inputs_true.dat b/tests/regression_tests/tally_slice_merge/inputs_true.dat index ccd3655f9..6f421b1d9 100644 --- a/tests/regression_tests/tally_slice_merge/inputs_true.dat +++ b/tests/regression_tests/tally_slice_merge/inputs_true.dat @@ -310,7 +310,7 @@ - + 2 2 -50.0 -50.0 50.0 50.0 diff --git a/tests/regression_tests/tally_slice_merge/test.py b/tests/regression_tests/tally_slice_merge/test.py index 20ab57a07..090e31448 100644 --- a/tests/regression_tests/tally_slice_merge/test.py +++ b/tests/regression_tests/tally_slice_merge/test.py @@ -24,8 +24,7 @@ class TallySliceMergeTestHarness(PyAPITestHarness): cell_27 = openmc.CellFilter(27) distribcell_filter = openmc.DistribcellFilter(21) - mesh = openmc.Mesh(name='mesh') - mesh.type = 'regular' + mesh = openmc.RegularMesh(name='mesh') mesh.dimension = [2, 2] mesh.lower_left = [-50., -50.] mesh.upper_right = [+50., +50.] diff --git a/tests/unit_tests/test_capi.py b/tests/unit_tests/test_capi.py index be88072d9..742563d51 100644 --- a/tests/unit_tests/test_capi.py +++ b/tests/unit_tests/test_capi.py @@ -325,11 +325,11 @@ def test_find_material(capi_init): def test_mesh(capi_init): - mesh = openmc.capi.Mesh() + mesh = openmc.capi.RegularMesh() mesh.dimension = (2, 3, 4) assert mesh.dimension == (2, 3, 4) with pytest.raises(exc.AllocationError): - mesh2 = openmc.capi.Mesh(mesh.id) + mesh2 = openmc.capi.RegularMesh(mesh.id) # Make sure each combination of parameters works ll = (0., 0., 0.) @@ -349,7 +349,7 @@ def test_mesh(capi_init): assert isinstance(meshes, Mapping) assert len(meshes) == 1 for mesh_id, mesh in meshes.items(): - assert isinstance(mesh, openmc.capi.Mesh) + assert isinstance(mesh, openmc.capi.RegularMesh) assert mesh_id == mesh.id mf = openmc.capi.MeshFilter(mesh) diff --git a/tests/unit_tests/test_mesh_from_lattice.py b/tests/unit_tests/test_mesh_from_lattice.py index feac87326..0a01387cd 100644 --- a/tests/unit_tests/test_mesh_from_lattice.py +++ b/tests/unit_tests/test_mesh_from_lattice.py @@ -90,12 +90,12 @@ def test_mesh2d(rlat2): shape = np.array(rlat2.shape) width = shape*rlat2.pitch - mesh1 = openmc.Mesh.from_rect_lattice(rlat2) + mesh1 = openmc.RegularMesh.from_rect_lattice(rlat2) assert np.array_equal(mesh1.dimension, (3, 3)) assert np.array_equal(mesh1.lower_left, rlat2.lower_left) assert np.array_equal(mesh1.upper_right, rlat2.lower_left + width) - mesh2 = openmc.Mesh.from_rect_lattice(rlat2, division=3) + mesh2 = openmc.RegularMesh.from_rect_lattice(rlat2, division=3) assert np.array_equal(mesh2.dimension, (9, 9)) assert np.array_equal(mesh2.lower_left, rlat2.lower_left) assert np.array_equal(mesh2.upper_right, rlat2.lower_left + width) @@ -105,12 +105,12 @@ def test_mesh3d(rlat3): shape = np.array(rlat3.shape) width = shape*rlat3.pitch - mesh1 = openmc.Mesh.from_rect_lattice(rlat3) + mesh1 = openmc.RegularMesh.from_rect_lattice(rlat3) assert np.array_equal(mesh1.dimension, (3, 3, 2)) assert np.array_equal(mesh1.lower_left, rlat3.lower_left) assert np.array_equal(mesh1.upper_right, rlat3.lower_left + width) - mesh2 = openmc.Mesh.from_rect_lattice(rlat3, division=3) + mesh2 = openmc.RegularMesh.from_rect_lattice(rlat3, division=3) assert np.array_equal(mesh2.dimension, (9, 9, 6)) assert np.array_equal(mesh2.lower_left, rlat3.lower_left) assert np.array_equal(mesh2.upper_right, rlat3.lower_left + width) diff --git a/tests/unit_tests/test_settings.py b/tests/unit_tests/test_settings.py index e42f6240f..5c5452d63 100644 --- a/tests/unit_tests/test_settings.py +++ b/tests/unit_tests/test_settings.py @@ -24,7 +24,7 @@ def test_export_to_xml(run_in_tmpdir): s.seed = 17 s.survival_biasing = True s.cutoff = {'weight': 0.25, 'weight_avg': 0.5, 'energy': 1.0e-5} - mesh = openmc.Mesh() + mesh = openmc.RegularMesh() mesh.lower_left = (-10., -10., -10.) mesh.upper_right = (10., 10., 10.) mesh.dimension = (5, 5, 5)