Change Python Mesh class to RegularMesh

This commit is contained in:
Sterling Harper 2019-06-06 17:04:07 -04:00
parent b804ddc952
commit 9ddd8b3067
42 changed files with 204 additions and 308 deletions

View file

@ -124,7 +124,7 @@ Constructing Tallies
openmc.ZernikeFilter
openmc.ZernikeRadialFilter
openmc.ParticleFilter
openmc.Mesh
openmc.RegularMesh
openmc.RectilinearMesh
openmc.Trigger
openmc.TallyDerivative

View file

@ -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
}

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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",

View file

@ -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,

View file

@ -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()

View file

@ -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]

View file

@ -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]

View file

@ -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]

View file

@ -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]

View file

@ -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]

View file

@ -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):

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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'])

View file

@ -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

View file

@ -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

View file

@ -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
"""

View file

@ -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)

View file

@ -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

View file

@ -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 = []

View file

@ -309,17 +309,17 @@
</settings>
<?xml version='1.0' encoding='utf-8'?>
<tallies>
<mesh id="1" type="regular">
<mesh id="1">
<dimension>17</dimension>
<lower_left>-182.07</lower_left>
<upper_right>182.07</upper_right>
</mesh>
<mesh id="2" type="regular">
<mesh id="2">
<dimension>17 17</dimension>
<lower_left>-182.07 -182.07</lower_left>
<upper_right>182.07 182.07</upper_right>
</mesh>
<mesh id="3" type="regular">
<mesh id="3">
<dimension>17 17 17</dimension>
<lower_left>-182.07 -182.07 -183.0</lower_left>
<upper_right>182.07 182.07 183.0</upper_right>

View file

@ -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]

View file

@ -33,7 +33,7 @@
</settings>
<?xml version='1.0' encoding='utf-8'?>
<tallies>
<mesh id="1" type="regular">
<mesh id="1">
<dimension>10 1 1</dimension>
<lower_left>0.0 0.0 0.0</lower_left>
<upper_right>929.45 1000 1000</upper_right>

View file

@ -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]

View file

@ -309,7 +309,7 @@
</settings>
<?xml version='1.0' encoding='utf-8'?>
<tallies>
<mesh id="1" type="regular">
<mesh id="1">
<dimension>2 2</dimension>
<lower_left>-100.0 -100.0</lower_left>
<width>100.0 100.0</width>

View file

@ -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.]

View file

@ -309,7 +309,7 @@
</settings>
<?xml version='1.0' encoding='utf-8'?>
<tallies>
<mesh id="1" type="regular">
<mesh id="1">
<dimension>2 2</dimension>
<lower_left>-182.07 -182.07</lower_left>
<upper_right>182.07 182.07</upper_right>

View file

@ -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]

View file

@ -309,7 +309,7 @@
</settings>
<?xml version='1.0' encoding='utf-8'?>
<tallies>
<mesh id="1" type="regular">
<mesh id="1">
<dimension>2 2 2</dimension>
<lower_left>-160.0 -160.0 -183.0</lower_left>
<upper_right>160.0 160.0 183.0</upper_right>

View file

@ -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]

View file

@ -310,7 +310,7 @@
<?xml version='1.0' encoding='utf-8'?>
<tallies>
<!--mesh-->
<mesh id="1" type="regular">
<mesh id="1">
<dimension>2 2</dimension>
<lower_left>-50.0 -50.0</lower_left>
<upper_right>50.0 50.0</upper_right>

View file

@ -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.]

View file

@ -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)

View file

@ -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)

View file

@ -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)