Skip to content

Commit

Permalink
Release of version 0.14.0 (#2754)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulromano authored Nov 6, 2023
1 parent 847e9b5 commit fa23301
Show file tree
Hide file tree
Showing 11 changed files with 357 additions and 59 deletions.
1 change: 1 addition & 0 deletions docs/source/pythonapi/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ Geometry Plotting
:template: myclass.rst

openmc.Plot
openmc.ProjectionPlot
openmc.Plots

Running OpenMC
Expand Down
284 changes: 284 additions & 0 deletions docs/source/releasenotes/0.14.0.rst

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/source/releasenotes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Release Notes
.. toctree::
:maxdepth: 1

0.14.0
0.13.3
0.13.2
0.13.1
Expand Down
112 changes: 56 additions & 56 deletions docs/source/usersguide/plots.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,27 +126,29 @@ will depend on the 3D viewer, but should be straightforward.
Projection Plots
----------------

.. image:: ../_images/hexlat_anim.gif
:width: 200px

The :class:`openmc.ProjectionPlot` class presents an alternative method
of producing 3D visualizations of OpenMC geometries. It was developed to
overcome the primary shortcoming of voxel plots, that an enormous number
of voxels must be employed to capture detailed geometric features.
Projection plots perform volume rendering on material or
cell volumes, with colors specified in the same manner as slice plots.
This is done using the native ray tracing capabilities within OpenMC,
so any geometry in which particles successfully run without overlaps
or leaks will work with projection plots.

One drawback of projection plots is that particle tracks cannot be overlaid
on them at present. Moreover, checking for overlap regions is not currently possible with projection plots. The image heading this section can
be created by adding the following code to the hexagonal lattice example packaged
with OpenMC, before exporting to plots.xml.
.. only:: html

.. image:: ../_images/hexlat_anim.gif
:width: 200px

The :class:`openmc.ProjectionPlot` class presents an alternative method of
producing 3D visualizations of OpenMC geometries. It was developed to overcome
the primary shortcoming of voxel plots, that an enormous number of voxels must
be employed to capture detailed geometric features. Projection plots perform
volume rendering on material or cell volumes, with colors specified in the same
manner as slice plots. This is done using the native ray tracing capabilities
within OpenMC, so any geometry in which particles successfully run without
overlaps or leaks will work with projection plots.

One drawback of projection plots is that particle tracks cannot be overlaid on
them at present. Moreover, checking for overlap regions is not currently
possible with projection plots. The image heading this section can be created by
adding the following code to the hexagonal lattice example packaged with OpenMC,
before exporting to plots.xml.

::

r = 5
r = 5
import numpy as np
for i in range(100):
phi = 2 * np.pi * i/100
Expand All @@ -162,48 +164,46 @@ with OpenMC, before exporting to plots.xml.
thisp.xs[iron] = 1.0
thisp.wireframe_domains = [fuel]
thisp.wireframe_thickness = 2

plot_file.append(thisp)

This generates a sequence of png files which can be joined to form a gif.
Each image specifies a different camera position using some simple periodic
functions to create a perfectly looped gif. :attr:`ProjectionPlot.look_at`
defines where the camera's centerline should point at.
:attr:`ProjectionPlot.camera_position` similarly defines where the camera
is situated in the universe level we seek to plot. The other settings
resemble those employed by :class:`openmc.Plot`, with the exception of
the :class:`ProjectionPlot.set_transparent` method and :attr:`ProjectionPlot.xs`
dictionary. These are used to control volume rendering of material
volumes. "xs" here stands for cross section, and it defines material
opacities in units of inverse centimeters. Setting this value to a
large number would make a material or cell opaque, and setting it to
zero makes a material transparent. Thus, the :class:`ProjectionPlot.set_transparent`
can be used to make all materials in the geometry transparent. From there,
individual material or cell opacities can be tuned to produce the
desired result.

Two camera projections are available when using these plots, perspective
and orthographic. The default, perspective projection,
is a cone of rays passing through each pixel which radiate from the camera
position and span the field of view in the x and y positions. The horizontal
field of view can be set with the :attr: `ProjectionPlot.horizontal_field_of_view` attribute,
which is to be specified in units of degrees. The field of view only influences
behavior in perspective projection mode.
This generates a sequence of png files which can be joined to form a gif. Each
image specifies a different camera position using some simple periodic functions
to create a perfectly looped gif. :attr:`ProjectionPlot.look_at` defines where
the camera's centerline should point at. :attr:`ProjectionPlot.camera_position`
similarly defines where the camera is situated in the universe level we seek to
plot. The other settings resemble those employed by :class:`openmc.Plot`, with
the exception of the :class:`ProjectionPlot.set_transparent` method and
:attr:`ProjectionPlot.xs` dictionary. These are used to control volume rendering
of material volumes. "xs" here stands for cross section, and it defines material
opacities in units of inverse centimeters. Setting this value to a large number
would make a material or cell opaque, and setting it to zero makes a material
transparent. Thus, the :class:`ProjectionPlot.set_transparent` can be used to
make all materials in the geometry transparent. From there, individual material
or cell opacities can be tuned to produce the desired result.

Two camera projections are available when using these plots, perspective and
orthographic. The default, perspective projection, is a cone of rays passing
through each pixel which radiate from the camera position and span the field of
view in the x and y positions. The horizontal field of view can be set with the
:attr: `ProjectionPlot.horizontal_field_of_view` attribute, which is to be
specified in units of degrees. The field of view only influences behavior in
perspective projection mode.

In the orthographic projection, rays follow the same angle but originate from
different points. The horizontal width of this plane of ray starting points
may be set with the :attr: `ProjectionPlot.orthographic_width` element. If this element
is nonzero, the orthographic projection is employed. Left to its default value
of zero, the perspective projection is employed.

Lastly, projection plots come packaged with wireframe generation that
can target either all surface/cell/material boundaries in the geometry,
or only wireframing around specific regions. In the above example, we
have set only the fuel region from the hexagonal lattice example to have
a wireframe drawn around it. This is accomplished by setting the
:attr: `ProjectionPlot.wireframe_domains`, which may be set to either material
IDs or cell IDs. The :attr:`ProjectionPlot.wireframe_thickness`
attribute sets the wireframe thickness in units of pixels.
different points. The horizontal width of this plane of ray starting points may
be set with the :attr: `ProjectionPlot.orthographic_width` element. If this
element is nonzero, the orthographic projection is employed. Left to its default
value of zero, the perspective projection is employed.

Lastly, projection plots come packaged with wireframe generation that can target
either all surface/cell/material boundaries in the geometry, or only wireframing
around specific regions. In the above example, we have set only the fuel region
from the hexagonal lattice example to have a wireframe drawn around it. This is
accomplished by setting the :attr: `ProjectionPlot.wireframe_domains`, which may
be set to either material IDs or cell IDs. The
:attr:`ProjectionPlot.wireframe_thickness` attribute sets the wireframe
thickness in units of pixels.

.. note:: When setting specific material or cell regions to have wireframes
drawn around them, the plot must be colored by materials if wireframing
Expand Down
2 changes: 2 additions & 0 deletions include/openmc/boundary_condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Surface;

class BoundaryCondition {
public:
virtual ~BoundaryCondition() = default;

//! Perform tracking operations for a particle that strikes the boundary.
//! \param p The particle that struck the boundary. This class is not meant
//! to directly modify anything about the particle, but it will do so
Expand Down
2 changes: 1 addition & 1 deletion include/openmc/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace openmc {
constexpr int VERSION_MAJOR {@OPENMC_VERSION_MAJOR@};
constexpr int VERSION_MINOR {@OPENMC_VERSION_MINOR@};
constexpr int VERSION_RELEASE {@OPENMC_VERSION_RELEASE@};
constexpr bool VERSION_DEV {true};
constexpr bool VERSION_DEV {false};
constexpr std::array<int, 3> VERSION {VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE};
// clang-format on

Expand Down
2 changes: 1 addition & 1 deletion openmc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
from openmc.model import Model


__version__ = '0.14.0-dev'
__version__ = '0.14.0'
4 changes: 4 additions & 0 deletions openmc/deplete/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def get_activity(
) -> Tuple[np.ndarray, typing.Union[np.ndarray, List[dict]]]:
"""Get activity of material over time.
.. versionadded:: 0.14.0
Parameters
----------
mat : openmc.Material, str
Expand Down Expand Up @@ -220,6 +222,8 @@ def get_decay_heat(
) -> Tuple[np.ndarray, typing.Union[np.ndarray, List[dict]]]:
"""Get decay heat of material over time.
.. versionadded:: 0.14.0
Parameters
----------
mat : openmc.Material, str
Expand Down
4 changes: 3 additions & 1 deletion openmc/model/surface_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ def _plane(axis, name, value, boundary_type='transmission', albedo=1.0):
class RectangularPrism(CompositeSurface):
"""Infinite rectangular prism bounded by four planar surfaces.
.. versionadded:: 0.13.4
.. versionadded:: 0.14.0
Parameters
----------
Expand Down Expand Up @@ -1445,6 +1445,8 @@ def __neg__(self):
class HexagonalPrism(CompositeSurface):
"""Hexagonal prism comoposed of six planar surfaces
.. versionadded:: 0.14.0
Parameters
----------
edge_length : float
Expand Down
2 changes: 2 additions & 0 deletions openmc/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,8 @@ class ProjectionPlot(PlotBase):
projections are more similar to a pinhole camera, and orthographic projections
preserve parallel lines and distances.
.. versionadded:: 0.14.0
Parameters
----------
plot_id : int
Expand Down
2 changes: 2 additions & 0 deletions openmc/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def from_xml_element(cls, elem: ET.Element, meshes=None) -> openmc.SourceBase:
class IndependentSource(SourceBase):
"""Distribution of phase space coordinates for source sites.
.. versionadded:: 0.14.0
Parameters
----------
space : openmc.stats.Spatial
Expand Down

0 comments on commit fa23301

Please sign in to comment.