mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Merge pull request #1330 from paulromano/surface-coeffs-first
Change order of arguments for surface classes
This commit is contained in:
commit
3df4f94fbf
27 changed files with 283 additions and 238 deletions
|
|
@ -1,3 +1,4 @@
|
|||
sphinx-numfig
|
||||
jupyter
|
||||
sphinxcontrib-katex
|
||||
sphinxcontrib-svg2pdfconverter
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ extensions = ['sphinx.ext.autodoc',
|
|||
'sphinx_numfig',
|
||||
'notebook_sphinxext']
|
||||
if not on_rtd:
|
||||
extensions.append('sphinx.ext.imgconverter')
|
||||
extensions.append('sphinxcontrib.rsvgconverter')
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ sampled using the leading order term of the Sauter–Gluckstern–Hull
|
|||
distribution,
|
||||
|
||||
.. math::
|
||||
:label: sauter–gluckstern–hull
|
||||
:label: sauter-gluckstern-hull
|
||||
|
||||
p(\mu_{\pm}) = C(1 - \beta_{\pm}\mu_{\pm})^{-2},
|
||||
|
||||
|
|
@ -588,7 +588,7 @@ ratio of the velocity of the charged particle to the speed of light given in
|
|||
:eq:`beta-2`.
|
||||
|
||||
The inverse transform method is used to sample :math:`\mu_{-}` and
|
||||
:math:`\mu_{+}` from :eq:`sauter–gluckstern–hull`, using the sampling formula
|
||||
:math:`\mu_{+}` from :eq:`sauter-gluckstern-hull`, using the sampling formula
|
||||
|
||||
.. math::
|
||||
:label: sample-mu
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ Coupling and Multi-physics
|
|||
--------------------------
|
||||
|
||||
- Miriam A. Kreher, Benoit Forget, and Kord Smith, "Single-Batch Monte Carlo
|
||||
Multiphysics Coupling," *Proc. M&C*, Portland, Oregon, Aug. 25-29 (2019).
|
||||
Multiphysics Coupling," *Proc. M&C*, 1789-1797, Portland, Oregon, Aug. 25-29
|
||||
(2019).
|
||||
|
||||
- Ze-Long Zhao, Yongwei Yang, and Shuang Hong, "`Application of FLUKA and OpenMC
|
||||
in coupled physics calculation of target and subcritical reactor for ADS
|
||||
|
|
@ -118,7 +119,7 @@ Geometry and Visualization
|
|||
|
||||
- Sterling Harper, Paul Romano, Benoit Forget, and Kord Smith, "Efficient
|
||||
dynamic threadsafe neighbor lists for Monte Carlo ray tracing," *Proc. M&C*,
|
||||
Portland, Oregon, Aug. 25-29 (2019).
|
||||
918-926, Portland, Oregon, Aug. 25-29 (2019).
|
||||
|
||||
- Jin-Yang Li, Long Gu, Hu-Shan Xu, Nadezha Korepanova, Rui Yu, Yan-Lei Zhu, and
|
||||
Chang-Ping Qin, "`CAD modeling study on FLUKA and OpenMC for accelerator
|
||||
|
|
@ -141,6 +142,10 @@ Geometry and Visualization
|
|||
Miscellaneous
|
||||
-------------
|
||||
|
||||
- Shikhar Kumar, Benoit Forget, and Kord Smith, "Analysis of fission source
|
||||
convergence for a 3-D SMR core using functional expansion tallies," *Proc.
|
||||
M&C*, 937-947, Portland, Oregon, Aug. 25-29 (2019).
|
||||
|
||||
- Faisal Qayyum, Muhammad R. Ali, Awais Zahur, and R. Khan, "`Improvements in
|
||||
methodology to determine feedback reactivity coefficients
|
||||
<https://doi.org/10.1007/s41365-019-0588-0>`_," *Nucl. Sci. Tech.*, **30**: 63
|
||||
|
|
@ -496,7 +501,7 @@ Depletion
|
|||
|
||||
- Jose L. Salcedo-Perez, Benoit Forget, Kord Smith, and Paul Romano, "Hybrid
|
||||
tallies to improve performance in depletion Monte Carlo simulations," *Proc.
|
||||
M&C*, Aug. 25-29 (2019).
|
||||
M&C*, 927-936, Portland, Oregon, Aug. 25-29 (2019).
|
||||
|
||||
- Zhao-Qing Liu, Ze-Long Zhao, Yong-Wei Yang, Yu-Cui Gao, Hai-Yan Meng, and
|
||||
Qing-Yu Gao, "`Development and validation of depletion code system IMPC-Burnup
|
||||
|
|
@ -526,6 +531,10 @@ Depletion
|
|||
Sensitivity Analysis
|
||||
--------------------
|
||||
|
||||
- Abdulla Alhajri and Benoit Forget, "Eigenvalue Sensitivity in Monte Carlo
|
||||
Simulations to Nuclear Data Parameters using the Multipole Formalism," *Proc.
|
||||
M&C*, 1895-1906, Portland, Oregon, Aug. 25-29 (2019).
|
||||
|
||||
- Xingjie Peng, Jingang Liang, Benoit Forget, and Kord Smith, "`Calculation of
|
||||
adjoint-weighted reactor kinetics parameters in OpenMC
|
||||
<https://doi.org/10.1016/j.anucene.2019.01.007>`_", *Ann. Nucl. Energy*,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ This release of OpenMC adds several major new features: :ref:`depletion
|
|||
<usersguide_depletion>`, photon transport, and support for CAD geometries
|
||||
through DAGMC. In addition, the core codebase has been rewritten in C++14 (it
|
||||
was previously written in Fortran 2008). This makes compiling the code
|
||||
cosiderably simpler as no Fortran compiler is needed.
|
||||
considerably simpler as no Fortran compiler is needed.
|
||||
|
||||
Functional expansion tallies are now supported through several new tally filters
|
||||
that can be arbitrarily combined:
|
||||
|
|
@ -40,6 +40,7 @@ random, non-overlapping configuration of spheres within the region.
|
|||
New Features
|
||||
------------
|
||||
|
||||
- Support for rectilinear meshes through :class:`openmc.RectilinearMesh`.
|
||||
- The :class:`Geometry`, :class:`Materials`, and :class:`Settings` classes now
|
||||
have a ``from_xml`` method that will build an instance from an existing XML
|
||||
file.
|
||||
|
|
@ -54,6 +55,32 @@ New Features
|
|||
- The :mod:`openmc.data` module now supports reading and sampling from ENDF File
|
||||
32 resonance covariance data (`PR 1024
|
||||
<https://github.com/openmc-dev/openmc/pull/1024>`_).
|
||||
- Several new convenience functions/methods have been added:
|
||||
|
||||
- The :func:`openmc.model.cylinder_from_points` function creates a cylinder
|
||||
given two points passing through its center and a radius.
|
||||
- The :meth:`openmc.Plane.from_points` function creates a plane given three
|
||||
points that pass through it.
|
||||
- The :func:`openmc.model.pin` function creates a pin cell universe given a
|
||||
sequence of concentric cylinders and materials.
|
||||
|
||||
------------------
|
||||
Python API Changes
|
||||
------------------
|
||||
|
||||
- All surface classes now have coefficient arguments given as lowercase names.
|
||||
- The order of arguments in surface classes has been changed so that
|
||||
coefficients are the first arguments (rather than the optional surface ID).
|
||||
This means you can now write::
|
||||
|
||||
x = openmc.XPlane(5.0, 'reflective')
|
||||
zc = openmc.ZCylinder(0., 0., 10.)
|
||||
|
||||
- The ``Mesh`` class has been renamed :class:`openmc.RegularMesh`.
|
||||
- The ``get_rectangular_prism`` function has been renamed
|
||||
:func:`openmc.model.rectangular_prism`.
|
||||
- The ``get_hexagonal_prism`` function has been renamed
|
||||
:func:`openmc.model.hexagonal_prism`.
|
||||
|
||||
---------
|
||||
Bug Fixes
|
||||
|
|
|
|||
|
|
@ -34,4 +34,4 @@ from . import examples
|
|||
# Import a few convencience functions that used to be here
|
||||
from openmc.model import rectangular_prism, hexagonal_prism
|
||||
|
||||
__version__ = '0.10.0'
|
||||
__version__ = '0.11.0-dev'
|
||||
|
|
|
|||
|
|
@ -350,18 +350,14 @@ class RegularMesh(MeshBase):
|
|||
n_dim = len(self.dimension)
|
||||
|
||||
# Build the cell which will contain the lattice
|
||||
xplanes = [openmc.XPlane(x0=self.lower_left[0],
|
||||
boundary_type=bc[0]),
|
||||
openmc.XPlane(x0=self.upper_right[0],
|
||||
boundary_type=bc[1])]
|
||||
xplanes = [openmc.XPlane(self.lower_left[0], bc[0]),
|
||||
openmc.XPlane(self.upper_right[0], bc[1])]
|
||||
if n_dim == 1:
|
||||
yplanes = [openmc.YPlane(y0=-1e10, boundary_type='reflective'),
|
||||
openmc.YPlane(y0=1e10, boundary_type='reflective')]
|
||||
yplanes = [openmc.YPlane(-1e10, 'reflective'),
|
||||
openmc.YPlane(1e10, 'reflective')]
|
||||
else:
|
||||
yplanes = [openmc.YPlane(y0=self.lower_left[1],
|
||||
boundary_type=bc[2]),
|
||||
openmc.YPlane(y0=self.upper_right[1],
|
||||
boundary_type=bc[3])]
|
||||
yplanes = [openmc.YPlane(self.lower_left[1], bc[2]),
|
||||
openmc.YPlane(self.upper_right[1], bc[3])]
|
||||
|
||||
if n_dim <= 2:
|
||||
# Would prefer to have the z ranges be the max supported float, but
|
||||
|
|
@ -371,13 +367,11 @@ class RegularMesh(MeshBase):
|
|||
# inconsistency between what numpy uses as the max float and what
|
||||
# Fortran expects for a real(8), so this avoids code complication
|
||||
# and achieves the same goal.
|
||||
zplanes = [openmc.ZPlane(z0=-1e10, boundary_type='reflective'),
|
||||
openmc.ZPlane(z0=1e10, boundary_type='reflective')]
|
||||
zplanes = [openmc.ZPlane(-1e10, 'reflective'),
|
||||
openmc.ZPlane(1e10, 'reflective')]
|
||||
else:
|
||||
zplanes = [openmc.ZPlane(z0=self.lower_left[2],
|
||||
boundary_type=bc[4]),
|
||||
openmc.ZPlane(z0=self.upper_right[2],
|
||||
boundary_type=bc[5])]
|
||||
zplanes = [openmc.ZPlane(self.lower_left[2], bc[4]),
|
||||
openmc.ZPlane(self.upper_right[2], bc[5])]
|
||||
root_cell = openmc.Cell()
|
||||
root_cell.region = ((+xplanes[0] & -xplanes[1]) &
|
||||
(+yplanes[0] & -yplanes[1]) &
|
||||
|
|
|
|||
|
|
@ -3552,7 +3552,7 @@ class ScatterMatrixXS(MatrixMGXS):
|
|||
.. math::
|
||||
|
||||
\begin{aligned}
|
||||
\langle \sigma}_{s,\ell,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr
|
||||
\langle \sigma_{s,\ell,g'\rightarrow g} \phi \rangle &= \int_{r \in V} dr
|
||||
\int_{4\pi} d\Omega' \int_{E_{g'}}^{E_{g'-1}} dE' \int_{4\pi} d\Omega
|
||||
\int_{E_g}^{E_{g-1}} dE \; P_\ell (\Omega \cdot \Omega') \sigma_s (r, E'
|
||||
\rightarrow E, \Omega' \cdot \Omega) \psi(r, E', \Omega')\\
|
||||
|
|
|
|||
|
|
@ -253,8 +253,8 @@ def hexagonal_prism(edge_length=1., orientation='y', origin=(0., 0.),
|
|||
x, y = origin
|
||||
|
||||
if orientation == 'y':
|
||||
right = XPlane(x0=x + sqrt(3.)/2*l, boundary_type=boundary_type)
|
||||
left = XPlane(x0=x - sqrt(3.)/2*l, boundary_type=boundary_type)
|
||||
right = XPlane(x + sqrt(3.)/2*l, boundary_type)
|
||||
left = XPlane(x - sqrt(3.)/2*l, boundary_type)
|
||||
c = sqrt(3.)/3.
|
||||
|
||||
# y = -x/sqrt(3) + a
|
||||
|
|
|
|||
|
|
@ -527,10 +527,10 @@ class Complement(Region):
|
|||
The Complement of an existing :class:`openmc.Region` can be created by using
|
||||
the ~ operator as the following example demonstrates:
|
||||
|
||||
>>> xl = openmc.XPlane(x0=-10.0)
|
||||
>>> xr = openmc.XPlane(x0=10.0)
|
||||
>>> yl = openmc.YPlane(y0=-10.0)
|
||||
>>> yr = openmc.YPlane(y0=10.0)
|
||||
>>> xl = openmc.XPlane(-10.0)
|
||||
>>> xr = openmc.XPlane(10.0)
|
||||
>>> yl = openmc.YPlane(-10.0)
|
||||
>>> yr = openmc.YPlane(10.0)
|
||||
>>> inside_box = +xl & -xr & +yl & -yr
|
||||
>>> outside_box = ~inside_box
|
||||
>>> type(outside_box)
|
||||
|
|
|
|||
|
|
@ -277,49 +277,48 @@ class Surface(IDManagerMixin, metaclass=ABCMeta):
|
|||
# Create the Surface based on its type
|
||||
if surf_type == 'x-plane':
|
||||
x0 = coeffs[0]
|
||||
surface = XPlane(surface_id, bc, x0, name)
|
||||
surface = XPlane(x0, bc, name, surface_id)
|
||||
|
||||
elif surf_type == 'y-plane':
|
||||
y0 = coeffs[0]
|
||||
surface = YPlane(surface_id, bc, y0, name)
|
||||
surface = YPlane(y0, bc, name, surface_id)
|
||||
|
||||
elif surf_type == 'z-plane':
|
||||
z0 = coeffs[0]
|
||||
surface = ZPlane(surface_id, bc, z0, name)
|
||||
surface = ZPlane(z0, bc, name, surface_id)
|
||||
|
||||
elif surf_type == 'plane':
|
||||
A, B, C, D = coeffs
|
||||
surface = Plane(surface_id, bc, A, B, C, D, name)
|
||||
surface = Plane(A, B, C, D, bc, name, surface_id)
|
||||
|
||||
elif surf_type == 'x-cylinder':
|
||||
y0, z0, r = coeffs
|
||||
surface = XCylinder(surface_id, bc, y0, z0, r, name)
|
||||
surface = XCylinder(y0, z0, r, bc, name, surface_id)
|
||||
|
||||
elif surf_type == 'y-cylinder':
|
||||
x0, z0, r = coeffs
|
||||
surface = YCylinder(surface_id, bc, x0, z0, r, name)
|
||||
surface = YCylinder(x0, z0, r, bc, name, surface_id)
|
||||
|
||||
elif surf_type == 'z-cylinder':
|
||||
x0, y0, r = coeffs
|
||||
surface = ZCylinder(surface_id, bc, x0, y0, r, name)
|
||||
surface = ZCylinder(x0, y0, r, bc, name, surface_id)
|
||||
|
||||
elif surf_type == 'sphere':
|
||||
x0, y0, z0, r = coeffs
|
||||
surface = Sphere(surface_id, bc, x0, y0, z0, r, name)
|
||||
surface = Sphere(x0, y0, z0, r, bc, name, surface_id)
|
||||
|
||||
elif surf_type in ['x-cone', 'y-cone', 'z-cone']:
|
||||
x0, y0, z0, r2 = coeffs
|
||||
if surf_type == 'x-cone':
|
||||
surface = XCone(surface_id, bc, x0, y0, z0, r2, name)
|
||||
surface = XCone(x0, y0, z0, r2, bc, name, surface_id)
|
||||
elif surf_type == 'y-cone':
|
||||
surface = YCone(surface_id, bc, x0, y0, z0, r2, name)
|
||||
surface = YCone(x0, y0, z0, r2, bc, name, surface_id)
|
||||
elif surf_type == 'z-cone':
|
||||
surface = ZCone(surface_id, bc, x0, y0, z0, r2, name)
|
||||
surface = ZCone(x0, y0, z0, r2, bc, name, surface_id)
|
||||
|
||||
elif surf_type == 'quadric':
|
||||
a, b, c, d, e, f, g, h, j, k = coeffs
|
||||
surface = Quadric(surface_id, bc, a, b, c, d, e, f, g,
|
||||
h, j, k, name)
|
||||
surface = Quadric(a, b, c, d, e, f, g, h, j, k, bc, name, surface_id)
|
||||
|
||||
return surface
|
||||
|
||||
|
|
@ -329,13 +328,6 @@ class Plane(Surface):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
a : float, optional
|
||||
The 'A' parameter for the plane. Defaults to 1.
|
||||
b : float, optional
|
||||
|
|
@ -344,8 +336,15 @@ class Plane(Surface):
|
|||
The 'C' parameter for the plane. Defaults to 0.
|
||||
d : float, optional
|
||||
The 'D' parameter for the plane. Defaults to 0.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
name : str, optional
|
||||
Name of the plane. If not specified, the name will be the empty string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -377,8 +376,8 @@ class Plane(Surface):
|
|||
_type = 'plane'
|
||||
_coeff_keys = ('a', 'b', 'c', 'd')
|
||||
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
a=1., b=0., c=0., d=0., name='', **kwargs):
|
||||
def __init__(self, a=1., b=0., c=0., d=0., boundary_type='transmission',
|
||||
name='', surface_id=None, **kwargs):
|
||||
super().__init__(surface_id, boundary_type, name=name)
|
||||
self._periodic_surface = None
|
||||
self.a = a
|
||||
|
|
@ -532,18 +531,18 @@ class XPlane(Plane):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
x0 : float, optional
|
||||
Location of the plane. Defaults to 0.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective', 'periodic'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface. Only axis-aligned periodicity is
|
||||
supported, i.e., x-planes can only be paired with x-planes.
|
||||
x0 : float, optional
|
||||
Location of the plane. Defaults to 0.
|
||||
name : str, optional
|
||||
Name of the plane. If not specified, the name will be the empty string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -569,9 +568,9 @@ class XPlane(Plane):
|
|||
_type = 'x-plane'
|
||||
_coeff_keys = ('x0',)
|
||||
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
x0=0., name=''):
|
||||
super().__init__(surface_id, boundary_type, name=name)
|
||||
def __init__(self, x0=0., boundary_type='transmission',
|
||||
name='', surface_id=None):
|
||||
super().__init__(surface_id=surface_id, boundary_type=boundary_type, name=name)
|
||||
self.x0 = x0
|
||||
|
||||
@property
|
||||
|
|
@ -657,18 +656,18 @@ class YPlane(Plane):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
y0 : float, optional
|
||||
Location of the plane
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective', 'periodic'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface. Only axis-aligned periodicity is
|
||||
supported, i.e., x-planes can only be paired with x-planes.
|
||||
y0 : float, optional
|
||||
Location of the plane
|
||||
name : str, optional
|
||||
Name of the plane. If not specified, the name will be the empty string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -694,10 +693,9 @@ class YPlane(Plane):
|
|||
_type = 'y-plane'
|
||||
_coeff_keys = ('y0',)
|
||||
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
y0=0., name=''):
|
||||
# Initialize YPlane class attributes
|
||||
super().__init__(surface_id, boundary_type, name=name)
|
||||
def __init__(self, y0=0., boundary_type='transmission',
|
||||
name='', surface_id=None):
|
||||
super().__init__(surface_id=surface_id, boundary_type=boundary_type, name=name)
|
||||
self.y0 = y0
|
||||
|
||||
@property
|
||||
|
|
@ -820,10 +818,9 @@ class ZPlane(Plane):
|
|||
_type = 'z-plane'
|
||||
_coeff_keys = ('z0',)
|
||||
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
z0=0., name=''):
|
||||
# Initialize ZPlane class attributes
|
||||
super().__init__(surface_id, boundary_type, name=name)
|
||||
def __init__(self, z0=0., boundary_type='transmission',
|
||||
name='', surface_id=None):
|
||||
super().__init__(surface_id=surface_id, boundary_type=boundary_type, name=name)
|
||||
self.z0 = z0
|
||||
|
||||
@property
|
||||
|
|
@ -909,18 +906,18 @@ class Cylinder(Surface):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
r : float, optional
|
||||
Radius of the cylinder. Defaults to 1.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
r : float, optional
|
||||
Radius of the cylinder. Defaults to 1.
|
||||
name : str, optional
|
||||
Name of the cylinder. If not specified, the name will be the empty
|
||||
string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -939,8 +936,8 @@ class Cylinder(Surface):
|
|||
Type of the surface
|
||||
|
||||
"""
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
r=1., name=''):
|
||||
def __init__(self, r=1., boundary_type='transmission',
|
||||
name='', surface_id=None):
|
||||
super().__init__(surface_id, boundary_type, name=name)
|
||||
self.r = r
|
||||
|
||||
|
|
@ -960,22 +957,22 @@ class XCylinder(Cylinder):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
y0 : float, optional
|
||||
y-coordinate of the center of the cylinder. Defaults to 0.
|
||||
z0 : float, optional
|
||||
z-coordinate of the center of the cylinder. Defaults to 0.
|
||||
r : float, optional
|
||||
Radius of the cylinder. Defaults to 0.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
name : str, optional
|
||||
Name of the cylinder. If not specified, the name will be the empty
|
||||
string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -1000,12 +997,12 @@ class XCylinder(Cylinder):
|
|||
_type = 'x-cylinder'
|
||||
_coeff_keys = ('y0', 'z0', 'r')
|
||||
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
y0=0., z0=0., r=1., name='', *, R=None):
|
||||
def __init__(self, y0=0., z0=0., r=1., boundary_type='transmission',
|
||||
name='', surface_id=None, *, R=None):
|
||||
if R is not None:
|
||||
warn(_WARNING_UPPER.format(type(self).__name__, 'r', 'R'), FutureWarning)
|
||||
r = R
|
||||
super().__init__(surface_id, boundary_type, r, name=name)
|
||||
super().__init__(r, boundary_type, name, surface_id)
|
||||
self.y0 = y0
|
||||
self.z0 = z0
|
||||
|
||||
|
|
@ -1107,22 +1104,22 @@ class YCylinder(Cylinder):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
x0 : float, optional
|
||||
x-coordinate of the center of the cylinder. Defaults to 0.
|
||||
z0 : float, optional
|
||||
z-coordinate of the center of the cylinder. Defaults to 0.
|
||||
r : float, optional
|
||||
Radius of the cylinder. Defaults to 1.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
name : str, optional
|
||||
Name of the cylinder. If not specified, the name will be the empty
|
||||
string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -1147,12 +1144,12 @@ class YCylinder(Cylinder):
|
|||
_type = 'y-cylinder'
|
||||
_coeff_keys = ('x0', 'z0', 'r')
|
||||
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
x0=0., z0=0., r=1., name='', *, R=None):
|
||||
def __init__(self, x0=0., z0=0., r=1., boundary_type='transmission',
|
||||
name='', surface_id=None, *, R=None):
|
||||
if R is not None:
|
||||
warn(_WARNING_UPPER.format(type(self).__name__, 'r', 'R'), FutureWarning)
|
||||
r = R
|
||||
super().__init__(surface_id, boundary_type, r, name=name)
|
||||
super().__init__(r, boundary_type, name, surface_id)
|
||||
self.x0 = x0
|
||||
self.z0 = z0
|
||||
|
||||
|
|
@ -1294,12 +1291,12 @@ class ZCylinder(Cylinder):
|
|||
_type = 'z-cylinder'
|
||||
_coeff_keys = ('x0', 'y0', 'r')
|
||||
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
x0=0., y0=0., r=1., name='', *, R=None):
|
||||
def __init__(self, x0=0., y0=0., r=1., boundary_type='transmission',
|
||||
name='', surface_id=None, *, R=None):
|
||||
if R is not None:
|
||||
warn(_WARNING_UPPER.format(type(self).__name__, 'r', 'R'), FutureWarning)
|
||||
r = R
|
||||
super().__init__(surface_id, boundary_type, r, name=name)
|
||||
super().__init__(r, boundary_type, name, surface_id)
|
||||
self.x0 = x0
|
||||
self.y0 = y0
|
||||
|
||||
|
|
@ -1400,13 +1397,6 @@ class Sphere(Surface):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
x0 : float, optional
|
||||
x-coordinate of the center of the sphere. Defaults to 0.
|
||||
y0 : float, optional
|
||||
|
|
@ -1415,8 +1405,15 @@ class Sphere(Surface):
|
|||
z-coordinate of the center of the sphere. Defaults to 0.
|
||||
r : float, optional
|
||||
Radius of the sphere. Defaults to 1.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
name : str, optional
|
||||
Name of the sphere. If not specified, the name will be the empty string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -1445,8 +1442,8 @@ class Sphere(Surface):
|
|||
_type = 'sphere'
|
||||
_coeff_keys = ('x0', 'y0', 'z0', 'r')
|
||||
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
x0=0., y0=0., z0=0., r=1., name='', *, R=None):
|
||||
def __init__(self, x0=0., y0=0., z0=0., r=1., boundary_type='transmission',
|
||||
name='', surface_id=None, *, R=None):
|
||||
if R is not None:
|
||||
warn(_WARNING_UPPER.format(type(self).__name__, 'r', 'R'), FutureWarning)
|
||||
r = R
|
||||
|
|
@ -1574,6 +1571,14 @@ class Cone(Surface):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
x0 : float, optional
|
||||
x-coordinate of the apex. Defaults to 0.
|
||||
y0 : float, optional
|
||||
y-coordinate of the apex. Defaults to 0.
|
||||
z0 : float, optional
|
||||
z-coordinate of the apex. Defaults to 0.
|
||||
r2 : float, optional
|
||||
Parameter related to the aperature. Defaults to 1.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
|
@ -1581,14 +1586,6 @@ class Cone(Surface):
|
|||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
x0 : float, optional
|
||||
x-coordinate of the apex. Defaults to 0.
|
||||
y0 : float
|
||||
y-coordinate of the apex. Defaults to 0.
|
||||
z0 : float
|
||||
z-coordinate of the apex. Defaults to 0.
|
||||
r2 : float
|
||||
Parameter related to the aperature. Defaults to 1.
|
||||
name : str
|
||||
Name of the cone. If not specified, the name will be the empty string.
|
||||
|
||||
|
|
@ -1618,8 +1615,8 @@ class Cone(Surface):
|
|||
|
||||
_coeff_keys = ('x0', 'y0', 'z0', 'r2')
|
||||
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
x0=0., y0=0., z0=0., r2=1., name='', *, R2=None):
|
||||
def __init__(self, x0=0., y0=0., z0=0., r2=1., boundary_type='transmission',
|
||||
name='', surface_id=None, *, R2=None):
|
||||
if R2 is not None:
|
||||
warn(_WARNING_UPPER.format(type(self).__name__, 'r2', 'R2'), FutureWarning)
|
||||
r2 = R2
|
||||
|
|
@ -1695,13 +1692,6 @@ class XCone(Cone):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
x0 : float, optional
|
||||
x-coordinate of the apex. Defaults to 0.
|
||||
y0 : float, optional
|
||||
|
|
@ -1710,8 +1700,15 @@ class XCone(Cone):
|
|||
z-coordinate of the apex. Defaults to 0.
|
||||
r2 : float, optional
|
||||
Parameter related to the aperature. Defaults to 1.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
name : str, optional
|
||||
Name of the cone. If not specified, the name will be the empty string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -1766,13 +1763,6 @@ class YCone(Cone):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
x0 : float, optional
|
||||
x-coordinate of the apex. Defaults to 0.
|
||||
y0 : float, optional
|
||||
|
|
@ -1781,8 +1771,15 @@ class YCone(Cone):
|
|||
z-coordinate of the apex. Defaults to 0.
|
||||
r2 : float, optional
|
||||
Parameter related to the aperature. Defaults to 1.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
name : str, optional
|
||||
Name of the cone. If not specified, the name will be the empty string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -1837,13 +1834,6 @@ class ZCone(Cone):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
x0 : float, optional
|
||||
x-coordinate of the apex. Defaults to 0.
|
||||
y0 : float, optional
|
||||
|
|
@ -1852,8 +1842,15 @@ class ZCone(Cone):
|
|||
z-coordinate of the apex. Defaults to 0.
|
||||
r2 : float, optional
|
||||
Parameter related to the aperature. Defaults to 1.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
name : str, optional
|
||||
Name of the cone. If not specified, the name will be the empty string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -1908,17 +1905,17 @@ class Quadric(Surface):
|
|||
|
||||
Parameters
|
||||
----------
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
a, b, c, d, e, f, g, h, j, k : float, optional
|
||||
coefficients for the surface. All default to 0.
|
||||
boundary_type : {'transmission, 'vacuum', 'reflective', 'periodic'}, optional
|
||||
Boundary condition that defines the behavior for particles hitting the
|
||||
surface. Defaults to transmissive boundary condition where particles
|
||||
freely pass through the surface.
|
||||
a, b, c, d, e, f, g, h, j, k : float, optional
|
||||
coefficients for the surface. All default to 0.
|
||||
name : str, optional
|
||||
Name of the surface. If not specified, the name will be the empty string.
|
||||
surface_id : int, optional
|
||||
Unique identifier for the surface. If not specified, an identifier will
|
||||
automatically be assigned.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
|
|
@ -1941,9 +1938,8 @@ class Quadric(Surface):
|
|||
_type = 'quadric'
|
||||
_coeff_keys = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k')
|
||||
|
||||
def __init__(self, surface_id=None, boundary_type='transmission',
|
||||
a=0., b=0., c=0., d=0., e=0., f=0., g=0.,
|
||||
h=0., j=0., k=0., name=''):
|
||||
def __init__(self, a=0., b=0., c=0., d=0., e=0., f=0., g=0., h=0., j=0.,
|
||||
k=0., boundary_type='transmission', name='', surface_id=None):
|
||||
super().__init__(surface_id, boundary_type, name=name)
|
||||
self.a = a
|
||||
self.b = b
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ class AsymmetricLatticeTestHarness(PyAPITestHarness):
|
|||
[water, water, water]]
|
||||
|
||||
# Create bounding surfaces
|
||||
min_x = openmc.XPlane(x0=-32.13, boundary_type='reflective')
|
||||
max_x = openmc.XPlane(x0=+32.13, boundary_type='reflective')
|
||||
min_y = openmc.YPlane(y0=-32.13, boundary_type='reflective')
|
||||
max_y = openmc.YPlane(y0=+32.13, boundary_type='reflective')
|
||||
min_z = openmc.ZPlane(z0=0, boundary_type='reflective')
|
||||
max_z = openmc.ZPlane(z0=+32.13, boundary_type='reflective')
|
||||
min_x = openmc.XPlane(-32.13, 'reflective')
|
||||
max_x = openmc.XPlane(+32.13, 'reflective')
|
||||
min_y = openmc.YPlane(-32.13, 'reflective')
|
||||
max_y = openmc.YPlane(+32.13, 'reflective')
|
||||
min_z = openmc.ZPlane(0, 'reflective')
|
||||
max_z = openmc.ZPlane(+32.13, 'reflective')
|
||||
|
||||
# Define root universe
|
||||
root_univ = openmc.Universe(universe_id=0, name='root universe')
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ def generate_initial_number_density():
|
|||
|
||||
return temperature, sab, initial_density, burn
|
||||
|
||||
|
||||
def segment_pin(n_rings, n_wedges, r_fuel, r_gap, r_clad):
|
||||
""" Calculates a segmented pin.
|
||||
|
||||
|
|
@ -248,6 +249,7 @@ def segment_pin(n_rings, n_wedges, r_fuel, r_gap, r_clad):
|
|||
|
||||
return fuel_u, v_segment, v_gap, v_clad
|
||||
|
||||
|
||||
def generate_geometry(n_rings, n_wedges):
|
||||
""" Generates example geometry.
|
||||
|
||||
|
|
@ -296,12 +298,12 @@ def generate_geometry(n_rings, n_wedges):
|
|||
lattice.outer = all_water_u
|
||||
|
||||
# Bound universe
|
||||
x_low = openmc.XPlane(x0=-pitch*n_pin/2, boundary_type='reflective')
|
||||
x_high = openmc.XPlane(x0=pitch*n_pin/2, boundary_type='reflective')
|
||||
y_low = openmc.YPlane(y0=-pitch*n_pin/2, boundary_type='reflective')
|
||||
y_high = openmc.YPlane(y0=pitch*n_pin/2, boundary_type='reflective')
|
||||
z_low = openmc.ZPlane(z0=-10, boundary_type='reflective')
|
||||
z_high = openmc.ZPlane(z0=10, boundary_type='reflective')
|
||||
x_low = openmc.XPlane(-pitch*n_pin/2, 'reflective')
|
||||
x_high = openmc.XPlane(pitch*n_pin/2, 'reflective')
|
||||
y_low = openmc.YPlane(-pitch*n_pin/2, 'reflective')
|
||||
y_high = openmc.YPlane(pitch*n_pin/2, 'reflective')
|
||||
z_low = openmc.ZPlane(-10, 'reflective')
|
||||
z_high = openmc.ZPlane(10, 'reflective')
|
||||
|
||||
# Compute bounding box
|
||||
lower_left = [-pitch*n_pin/2, -pitch*n_pin/2, -10]
|
||||
|
|
@ -317,10 +319,11 @@ def generate_geometry(n_rings, n_wedges):
|
|||
v_cool = pitch**2 - (v_gap + v_clad + n_rings * n_wedges * v_segment)
|
||||
|
||||
# Store volumes for later usage
|
||||
volume = {'fuel': v_segment, 'gap':v_gap, 'clad':v_clad, 'cool':v_cool}
|
||||
volume = {'fuel': v_segment, 'gap': v_gap, 'clad': v_clad, 'cool': v_cool}
|
||||
|
||||
return geometry, volume, mapping, lower_left, upper_right
|
||||
|
||||
|
||||
def generate_problem(n_rings=5, n_wedges=8):
|
||||
""" Merges geometry and materials.
|
||||
|
||||
|
|
|
|||
|
|
@ -21,16 +21,16 @@ class PeriodicTest(PyAPITestHarness):
|
|||
materials.export_to_xml()
|
||||
|
||||
# Define geometry
|
||||
x_min = openmc.XPlane(1, x0=-5., boundary_type='periodic')
|
||||
x_max = openmc.XPlane(2, x0=5., boundary_type='periodic')
|
||||
x_min = openmc.XPlane(surface_id=1, x0=-5., boundary_type='periodic')
|
||||
x_max = openmc.XPlane(surface_id=2, x0=5., boundary_type='periodic')
|
||||
x_max.periodic_surface = x_min
|
||||
|
||||
y_min = openmc.YPlane(3, y0=-5., boundary_type='periodic')
|
||||
y_max = openmc.YPlane(4, y0=5., boundary_type='periodic')
|
||||
y_min = openmc.YPlane(surface_id=3, y0=-5., boundary_type='periodic')
|
||||
y_max = openmc.YPlane(surface_id=4, y0=5., boundary_type='periodic')
|
||||
|
||||
z_min = openmc.ZPlane(5, z0=-5., boundary_type='reflective')
|
||||
z_max = openmc.ZPlane(6, z0=5., boundary_type='reflective')
|
||||
z_cyl = openmc.ZCylinder(7, x0=-2.5, y0=2.5, r=2.0)
|
||||
z_min = openmc.ZPlane(surface_id=5, z0=-5., boundary_type='reflective')
|
||||
z_max = openmc.ZPlane(surface_id=6, z0=5., boundary_type='reflective')
|
||||
z_cyl = openmc.ZCylinder(surface_id=7, x0=-2.5, y0=2.5, r=2.0)
|
||||
|
||||
outside_cyl = openmc.Cell(1, fill=water, region=(
|
||||
+x_min & -x_max & +y_min & -y_max & +z_min & -z_max & +z_cyl))
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ class SourceTestHarness(PyAPITestHarness):
|
|||
materials = openmc.Materials([mat])
|
||||
materials.export_to_xml()
|
||||
|
||||
cyl = openmc.XCylinder(boundary_type='vacuum', r=1.0)
|
||||
x_plane_left = openmc.XPlane(boundary_type='vacuum', x0=-1.0)
|
||||
x_plane_center = openmc.XPlane(boundary_type='transmission', x0=1.0)
|
||||
x_plane_right = openmc.XPlane(boundary_type='vacuum', x0=1.0e9)
|
||||
cyl = openmc.XCylinder(r=1.0, boundary_type='vacuum')
|
||||
x_plane_left = openmc.XPlane(-1.0, 'vacuum')
|
||||
x_plane_center = openmc.XPlane(1.0)
|
||||
x_plane_right = openmc.XPlane(1.0e9, 'vacuum')
|
||||
|
||||
inner_cyl_left = openmc.Cell()
|
||||
inner_cyl_right = openmc.Cell()
|
||||
|
|
@ -31,7 +31,7 @@ class SourceTestHarness(PyAPITestHarness):
|
|||
geometry.export_to_xml()
|
||||
|
||||
source = openmc.Source()
|
||||
source.space = openmc.stats.Point((0,0,0))
|
||||
source.space = openmc.stats.Point((0, 0, 0))
|
||||
source.angle = openmc.stats.Monodirectional()
|
||||
source.energy = openmc.stats.Discrete([14.0e6], [1.0])
|
||||
source.particle = 'neutron'
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class ResonanceScatteringTestHarness(PyAPITestHarness):
|
|||
mats_file.export_to_xml()
|
||||
|
||||
# Geometry
|
||||
dumb_surface = openmc.XPlane(x0=100, boundary_type='reflective')
|
||||
dumb_surface = openmc.XPlane(100, 'reflective')
|
||||
c1 = openmc.Cell(cell_id=1, fill=mat, region=-dumb_surface)
|
||||
root_univ = openmc.Universe(universe_id=0, cells=[c1])
|
||||
geometry = openmc.Geometry(root_univ)
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ def make_model():
|
|||
model.materials += [m1, m2, m3, m4]
|
||||
|
||||
# Geometry
|
||||
x0 = openmc.XPlane(x0=-10, boundary_type='vacuum')
|
||||
x1 = openmc.XPlane(x0=-5)
|
||||
x2 = openmc.XPlane(x0=0)
|
||||
x3 = openmc.XPlane(x0=5)
|
||||
x4 = openmc.XPlane(x0=10, boundary_type='vacuum')
|
||||
x0 = openmc.XPlane(-10, 'vacuum')
|
||||
x1 = openmc.XPlane(-5)
|
||||
x2 = openmc.XPlane(0)
|
||||
x3 = openmc.XPlane(5)
|
||||
x4 = openmc.XPlane(10, 'vacuum')
|
||||
|
||||
root_univ = openmc.Universe()
|
||||
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ class TRISOTestHarness(PyAPITestHarness):
|
|||
inner_univ = openmc.Universe(cells=[c1, c2, c3, c4, c5])
|
||||
|
||||
# Define box to contain lattice and to pack TRISO particles in
|
||||
min_x = openmc.XPlane(x0=-0.5, boundary_type='reflective')
|
||||
max_x = openmc.XPlane(x0=0.5, boundary_type='reflective')
|
||||
min_y = openmc.YPlane(y0=-0.5, boundary_type='reflective')
|
||||
max_y = openmc.YPlane(y0=0.5, boundary_type='reflective')
|
||||
min_z = openmc.ZPlane(z0=-0.5, boundary_type='reflective')
|
||||
max_z = openmc.ZPlane(z0=0.5, boundary_type='reflective')
|
||||
min_x = openmc.XPlane(-0.5, 'reflective')
|
||||
max_x = openmc.XPlane(0.5, 'reflective')
|
||||
min_y = openmc.YPlane(-0.5, 'reflective')
|
||||
max_y = openmc.YPlane(0.5, 'reflective')
|
||||
min_z = openmc.ZPlane(-0.5, 'reflective')
|
||||
max_z = openmc.ZPlane(0.5, 'reflective')
|
||||
box_region = +min_x & -max_x & +min_y & -max_y & +min_z & -max_z
|
||||
box = openmc.Cell(region=box_region)
|
||||
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ class VolumeTest(PyAPITestHarness):
|
|||
materials = openmc.Materials((water, fuel))
|
||||
materials.export_to_xml()
|
||||
|
||||
cyl = openmc.ZCylinder(1, r=1.0, boundary_type='vacuum')
|
||||
top_sphere = openmc.Sphere(2, z0=5., r=1., boundary_type='vacuum')
|
||||
top_plane = openmc.ZPlane(3, z0=5.)
|
||||
bottom_sphere = openmc.Sphere(4, z0=-5., r=1., boundary_type='vacuum')
|
||||
bottom_plane = openmc.ZPlane(5, z0=-5.)
|
||||
cyl = openmc.ZCylinder(surface_id=1, r=1.0, boundary_type='vacuum')
|
||||
top_sphere = openmc.Sphere(surface_id=2, z0=5., r=1., boundary_type='vacuum')
|
||||
top_plane = openmc.ZPlane(surface_id=3, z0=5.)
|
||||
bottom_sphere = openmc.Sphere(surface_id=4, z0=-5., r=1., boundary_type='vacuum')
|
||||
bottom_plane = openmc.ZPlane(surface_id=5, z0=-5.)
|
||||
|
||||
# Define geometry
|
||||
inside_cyl = openmc.Cell(1, fill=fuel, region=-cyl & -top_plane & +bottom_plane)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
import shutil
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
|
||||
# Check if NJOY is available
|
||||
needs_njoy = pytest.mark.skipif(shutil.which('njoy') is None,
|
||||
reason="NJOY not installed")
|
||||
|
||||
|
||||
def assert_unbounded(obj):
|
||||
"""Assert that a region/cell is unbounded."""
|
||||
ll, ur = obj.bounding_box
|
||||
|
|
|
|||
|
|
@ -108,11 +108,11 @@ def mixed_lattice_model(uo2, water):
|
|||
[empty_univ, u]
|
||||
]
|
||||
|
||||
xmin = openmc.XPlane(x0=-d, boundary_type='periodic')
|
||||
xmax = openmc.XPlane(x0=d, boundary_type='periodic')
|
||||
xmin = openmc.XPlane(-d, 'periodic')
|
||||
xmax = openmc.XPlane(d, 'periodic')
|
||||
xmin.periodic_surface = xmax
|
||||
ymin = openmc.YPlane(y0=-d, boundary_type='periodic')
|
||||
ymax = openmc.YPlane(y0=d, boundary_type='periodic')
|
||||
ymin = openmc.YPlane(-d, 'periodic')
|
||||
ymax = openmc.YPlane(d, 'periodic')
|
||||
main_cell = openmc.Cell(fill=rect_lattice,
|
||||
region=+xmin & -xmax & +ymin & -ymax)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,21 +27,21 @@ def complex_cell(run_in_tmpdir, mpi_intracomm):
|
|||
|
||||
model.materials = (u235, u238, zr90, n14)
|
||||
|
||||
s1 = openmc.XPlane(x0=-10.0, boundary_type='vacuum')
|
||||
s2 = openmc.XPlane(x0=-7.0)
|
||||
s3 = openmc.XPlane(x0=-4.0)
|
||||
s4 = openmc.XPlane(x0=4.0)
|
||||
s5 = openmc.XPlane(x0=7.0)
|
||||
s6 = openmc.XPlane(x0=10.0, boundary_type='vacuum')
|
||||
s7 = openmc.XPlane(x0=0.0)
|
||||
s1 = openmc.XPlane(-10.0, 'vacuum')
|
||||
s2 = openmc.XPlane(-7.0)
|
||||
s3 = openmc.XPlane(-4.0)
|
||||
s4 = openmc.XPlane(4.0)
|
||||
s5 = openmc.XPlane(7.0)
|
||||
s6 = openmc.XPlane(10.0, 'vacuum')
|
||||
s7 = openmc.XPlane(0.0)
|
||||
|
||||
s11 = openmc.YPlane(y0=-10.0, boundary_type='vacuum')
|
||||
s12 = openmc.YPlane(y0=-7.0)
|
||||
s13 = openmc.YPlane(y0=-4.0)
|
||||
s14 = openmc.YPlane(y0=4.0)
|
||||
s15 = openmc.YPlane(y0=7.0)
|
||||
s16 = openmc.YPlane(y0=10.0, boundary_type='vacuum')
|
||||
s17 = openmc.YPlane(y0=0.0)
|
||||
s11 = openmc.YPlane(-10.0, 'vacuum')
|
||||
s12 = openmc.YPlane(-7.0)
|
||||
s13 = openmc.YPlane(-4.0)
|
||||
s14 = openmc.YPlane(4.0)
|
||||
s15 = openmc.YPlane(7.0)
|
||||
s16 = openmc.YPlane(10.0, 'vacuum')
|
||||
s17 = openmc.YPlane(0.0)
|
||||
|
||||
c1 = openmc.Cell(fill=u235)
|
||||
c1.region = ~(-s3 | +s4 | ~(+s13 & -s14))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from collections.abc import Mapping, Callable
|
||||
import os
|
||||
|
||||
|
|
@ -8,6 +6,7 @@ import pandas as pd
|
|||
import pytest
|
||||
import openmc.data
|
||||
|
||||
from . import needs_njoy
|
||||
|
||||
_TEMPERATURES = [300., 600., 900.]
|
||||
_ENDF_DATA = os.environ['OPENMC_ENDF_DATA']
|
||||
|
|
@ -198,6 +197,7 @@ def test_fission(pu239):
|
|||
assert photon.particle == 'photon'
|
||||
|
||||
|
||||
@needs_njoy
|
||||
def test_derived_products(am244):
|
||||
fission = am244.reactions[18]
|
||||
total_neutron = fission.derived_products[0]
|
||||
|
|
@ -236,6 +236,7 @@ def test_urr(pu239):
|
|||
assert ptable.table.shape[0] == ptable.energy.size
|
||||
|
||||
|
||||
@needs_njoy
|
||||
def test_get_reaction_components(h2):
|
||||
assert h2.get_reaction_components(1) == [2, 16, 102]
|
||||
assert h2.get_reaction_components(101) == [102]
|
||||
|
|
@ -453,6 +454,7 @@ def test_laboratory(be9):
|
|||
assert np.all((-1. <= mu.x) & (mu.x <= 1.))
|
||||
|
||||
|
||||
@needs_njoy
|
||||
def test_correlated(tmpdir):
|
||||
endf_file = os.path.join(_ENDF_DATA, 'neutrons', 'n-014_Si_030.endf')
|
||||
si30 = openmc.data.IncidentNeutron.from_njoy(endf_file, heatr=False)
|
||||
|
|
@ -463,6 +465,7 @@ def test_correlated(tmpdir):
|
|||
si30_copy = openmc.data.IncidentNeutron.from_hdf5(filename)
|
||||
|
||||
|
||||
@needs_njoy
|
||||
def test_nbody(tmpdir, h2):
|
||||
# Convert to HDF5 and read back
|
||||
filename = str(tmpdir.join('h2.h5'))
|
||||
|
|
@ -477,6 +480,7 @@ def test_nbody(tmpdir, h2):
|
|||
assert nbody1.q_value == nbody2.q_value
|
||||
|
||||
|
||||
@needs_njoy
|
||||
def test_ace_convert(run_in_tmpdir):
|
||||
filename = os.path.join(_ENDF_DATA, 'neutrons', 'n-001_H_001.endf')
|
||||
ace_ascii = 'ace_ascii'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from collections.abc import Callable
|
||||
from math import exp
|
||||
import os
|
||||
|
|
@ -9,6 +7,8 @@ import numpy as np
|
|||
import pytest
|
||||
import openmc.data
|
||||
|
||||
from . import needs_njoy
|
||||
|
||||
|
||||
_ENDF_DATA = os.environ['OPENMC_ENDF_DATA']
|
||||
|
||||
|
|
@ -101,6 +101,7 @@ def test_graphite_xs(graphite):
|
|||
assert elastic([1e-3, 1.0]) == pytest.approx([0.0, 0.62586153])
|
||||
|
||||
|
||||
@needs_njoy
|
||||
def test_graphite_njoy():
|
||||
path_c0 = os.path.join(_ENDF_DATA, 'neutrons', 'n-006_C_000.endf')
|
||||
path_gr = os.path.join(_ENDF_DATA, 'thermal_scatt', 'tsl-graphite.endf')
|
||||
|
|
@ -112,6 +113,7 @@ def test_graphite_njoy():
|
|||
assert graphite.temperatures == ['296K']
|
||||
|
||||
|
||||
@needs_njoy
|
||||
def test_export_to_hdf5(tmpdir, h2o_njoy, hzrh_njoy, graphite):
|
||||
filename = str(tmpdir.join('water.h5'))
|
||||
h2o_njoy.export_to_hdf5(filename)
|
||||
|
|
@ -131,6 +133,7 @@ def test_export_to_hdf5(tmpdir, h2o_njoy, hzrh_njoy, graphite):
|
|||
assert os.path.exists(filename)
|
||||
|
||||
|
||||
@needs_njoy
|
||||
def test_continuous_dist(h2o_njoy):
|
||||
for temperature, dist in h2o_njoy.inelastic.distribution.items():
|
||||
assert temperature.endswith('K')
|
||||
|
|
@ -173,6 +176,7 @@ def test_hzrh_elastic(hzrh):
|
|||
assert dist.debye_waller > 0.0
|
||||
|
||||
|
||||
@needs_njoy
|
||||
def test_hzrh_njoy(hzrh_njoy):
|
||||
endf, ace = hzrh_njoy
|
||||
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@ def centers(request, container):
|
|||
|
||||
@pytest.fixture(scope='module')
|
||||
def centers_rectangular_prism():
|
||||
min_x = openmc.XPlane(x0=0)
|
||||
max_x = openmc.XPlane(x0=1)
|
||||
min_y = openmc.YPlane(y0=0)
|
||||
max_y = openmc.YPlane(y0=1)
|
||||
min_z = openmc.ZPlane(z0=0)
|
||||
max_z = openmc.ZPlane(z0=1)
|
||||
min_x = openmc.XPlane(0)
|
||||
max_x = openmc.XPlane(1)
|
||||
min_y = openmc.YPlane(0)
|
||||
max_y = openmc.YPlane(1)
|
||||
min_z = openmc.ZPlane(0)
|
||||
max_z = openmc.ZPlane(1)
|
||||
region = +min_x & -max_x & +min_y & -max_y & +min_z & -max_z
|
||||
return openmc.model.pack_spheres(radius=_RADIUS, region=region,
|
||||
pf=_PACKING_FRACTION, initial_pf=0.2)
|
||||
|
|
@ -48,8 +48,8 @@ def centers_rectangular_prism():
|
|||
@pytest.fixture(scope='module')
|
||||
def centers_x_cylinder():
|
||||
cylinder = openmc.XCylinder(r=1, y0=1, z0=2)
|
||||
min_x = openmc.XPlane(x0=0)
|
||||
max_x = openmc.XPlane(x0=1)
|
||||
min_x = openmc.XPlane(0)
|
||||
max_x = openmc.XPlane(1)
|
||||
region = +min_x & -max_x & -cylinder
|
||||
return openmc.model.pack_spheres(radius=_RADIUS, region=region,
|
||||
pf=_PACKING_FRACTION, initial_pf=0.2)
|
||||
|
|
@ -58,8 +58,8 @@ def centers_x_cylinder():
|
|||
@pytest.fixture(scope='module')
|
||||
def centers_y_cylinder():
|
||||
cylinder = openmc.YCylinder(r=1, x0=1, z0=2)
|
||||
min_y = openmc.YPlane(y0=0)
|
||||
max_y = openmc.YPlane(y0=1)
|
||||
min_y = openmc.YPlane(0)
|
||||
max_y = openmc.YPlane(1)
|
||||
region = +min_y & -max_y & -cylinder
|
||||
return openmc.model.pack_spheres(radius=_RADIUS, region=region,
|
||||
pf=_PACKING_FRACTION, initial_pf=0.2)
|
||||
|
|
@ -68,8 +68,8 @@ def centers_y_cylinder():
|
|||
@pytest.fixture(scope='module')
|
||||
def centers_z_cylinder():
|
||||
cylinder = openmc.ZCylinder(r=1, x0=1, y0=2)
|
||||
min_z = openmc.ZPlane(z0=0)
|
||||
max_z = openmc.ZPlane(z0=1)
|
||||
min_z = openmc.ZPlane(0)
|
||||
max_z = openmc.ZPlane(1)
|
||||
region = +min_z & -max_z & -cylinder
|
||||
return openmc.model.pack_spheres(radius=_RADIUS, region=region,
|
||||
pf=_PACKING_FRACTION, initial_pf=0.2)
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ def reset():
|
|||
|
||||
|
||||
def test_union(reset):
|
||||
s1 = openmc.XPlane(surface_id=1, x0=5)
|
||||
s2 = openmc.XPlane(surface_id=2, x0=-5)
|
||||
s1 = openmc.XPlane(x0=5, surface_id=1)
|
||||
s2 = openmc.XPlane(x0=-5, surface_id=2)
|
||||
region = +s1 | -s2
|
||||
assert isinstance(region, openmc.Union)
|
||||
|
||||
|
|
@ -42,8 +42,8 @@ def test_union(reset):
|
|||
|
||||
|
||||
def test_intersection(reset):
|
||||
s1 = openmc.XPlane(surface_id=1, x0=5)
|
||||
s2 = openmc.XPlane(surface_id=2, x0=-5)
|
||||
s1 = openmc.XPlane(x0=5, surface_id=1)
|
||||
s2 = openmc.XPlane(x0=-5, surface_id=2)
|
||||
region = -s1 & +s2
|
||||
assert isinstance(region, openmc.Intersection)
|
||||
|
||||
|
|
@ -75,9 +75,9 @@ def test_intersection(reset):
|
|||
|
||||
|
||||
def test_complement(reset):
|
||||
zcyl = openmc.ZCylinder(surface_id=1, r=1.)
|
||||
z0 = openmc.ZPlane(surface_id=2, z0=-5.)
|
||||
z1 = openmc.ZPlane(surface_id=3, z0=5.)
|
||||
zcyl = openmc.ZCylinder(r=1., surface_id=1)
|
||||
z0 = openmc.ZPlane(-5., surface_id=2)
|
||||
z1 = openmc.ZPlane(5., surface_id=3)
|
||||
outside = +zcyl | -z0 | +z1
|
||||
inside = ~outside
|
||||
outside_equiv = ~(-zcyl & +z0 & -z1)
|
||||
|
|
@ -151,8 +151,8 @@ def test_extend_clone():
|
|||
def test_from_expression(reset):
|
||||
# Create surface dictionary
|
||||
s1 = openmc.ZCylinder(surface_id=1)
|
||||
s2 = openmc.ZPlane(surface_id=2, z0=-10.)
|
||||
s3 = openmc.ZPlane(surface_id=3, z0=10.)
|
||||
s2 = openmc.ZPlane(-10., surface_id=2)
|
||||
s3 = openmc.ZPlane(10., surface_id=3)
|
||||
surfs = {1: s1, 2: s2, 3: s3}
|
||||
|
||||
r = openmc.Region.from_expression('-1 2 -3', surfs)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ def test_plane_from_points():
|
|||
|
||||
|
||||
def test_xplane():
|
||||
s = openmc.XPlane(x0=3., boundary_type='reflective')
|
||||
s = openmc.XPlane(3., 'reflective')
|
||||
assert s.x0 == 3.
|
||||
assert s.boundary_type == 'reflective'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue