4. Constructive Solid Geometry

OpenMOC uses constructive solid geometry (CSG) to represent complex reactor models in software. The constructive solid geometry formulation is the method of choice for many advanced modeling software packages, including some Computer-aided Design (CAD) implementations. CSG allows complex spatial models to be built using boolean operations - such as intersections and unions - of simple surfaces and building blocks termed primitives, as illustrated in Figure 1 [Wikipedia]. The constructive solid geometry approach is well suited for reactor models which typically are highly structured and contain repeating patterns. This is the case for commercial PWRs and BWRs whose cores are built out of a rectangular lattice of fuel assemblies, each of which is a rectangular lattice of fuel pins.

../_images/csg-tree.png

Figure 1: A binary tree of CSG primitives.

There are a number of benefits to using the CSG formulation. First, CSG enables simulation codes to significantly reduce the memory footprint required to model the geometry. For example, rather than representing each fuel pin explicitly in memory, a fuel pin primitive is represented by a single data structure. A second major benefit to the CSG formulation is that it is a general and extensible approach which allows for ray tracing routines to be written in an abstract fashion that is independent of the primitives themselves.

Section 3.2

OpenMOC’s implementation of the routines and data structures for CSG are in large part inspired by those used in the OpenMC code. The following sections describe the primitives and algorithms used for CSG modeling in OpenMOC.

4.1. CSG Formulation

The constructive solid geometry formulation in OpenMOC is predicated upon the use of several key objects which allow one to construct a spatial model from simple primitives in a hierarchical fashion. The following sections describe each of these fundamental objects in order of increasing complexity. The reader should note that the CSG formulation in OpenMOC is capable of describing the full 3D space, but defining a 2D geometry for a 2D case is fairly straightforward.

Section 4.1.1 develops the formulation for surfaces which are used to divide space into separate unique halfspaces. Section 4.1.2 describes universes which represent the entirety of 2D (or 3D) space and provide a “clean pallet” upon which one can build a simple structure of cells. Section 4.1.3 describes cells, of which the region attribute contains one or more surfaces that bound a subset of space filled by either a material or a universe. Section 4.1.4 describes lattices which are used to create a bounded union of universes through a series of coordinate transformations. A typical hierarchy for the way in which surfaces, universes, cells and lattices are constructed to represent a reactor model in OpenMOC is illustrated in Figure 2.

../_images/csg-primitives-hierarchy.png

Figure 2: A hierarchy of OpenMOC primitives (omitting region between cell and surface).

4.1.1. Surfaces and Halfspaces

The fundamental primitive in OpenMOC is a surface. A 3D surface in the xy-plane is defined as the set of points that satisfy f(x,y,z) = 0 for some function f that will henceforth be termed the potential function of the surface. The potential divides the xy-plane into two halfspaces. The set of coordinates for which f(x,y,z) < 0 is called the positive halfspace while those coordinates for which f(x,y,z) > 0 collectively form the negative halfspace. Figure 3 illustrates the concepts of halfspaces for an arbitrary elliptical surface.

../_images/csg-halfspace.png

Figure 3: An elliptical surface primitive and its halfspaces.

For a surface primitive to be incorporated into the OpenMOC CSG framework, the ray tracing routines require the primitive to include a method to find the intersection point(s) on the surface along some unit trajectory vector \hat{n} = [u \; v]^T originating from any point (x,y). A depiction of this is given in Figure 4 for the parametrized distance d between (x,y) and the surface.

../_images/csg-halfspace-intersection.png

Figure 4: A trajectory’s intersection point with a surface.

Presently, OpenMOC includes surface primitive types that are most useful for constructing LWR models. These surfaces are from a subset of potential functions called quadratic surfaces as discussed in the following section.

4.1.1.1. Quadratic Surfaces

A generalized quadratic surface in 3D is a second order surface with following form:

(1)f(x,y) = Ax^2 + By^2 + Cz^2+ Fxy + Gxz + Hyz + Px + Qy + Rz + D = 0

Quadratic surfaces include planes, cylinders and ellipsoids. The quadratic surface primitives available in OpenMOC at the date of this writing are displayed in Table 1.

Surface Class Potential Equation Parameters
Arbitrary plane Plane Px + Qy +Rz + D = D

System Message: WARNING/2 ({P\;Q\;R\D})

latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2016/02/01> Babel <3.9q> and hyphenation patterns for 81 language(s) loaded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def)) (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) No file math.aux. (/usr/share/texlive/texmf-dist/tex/latex/ucs/ucsencs.def) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Undefined control sequence. l.12 ${P\;Q\;R\D }$ [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 216 bytes). Transcript written on math.log.
Plane perpendicular to x-axis XPlane x - x_0 = 0 {x_0}
Plane perpendicular to y-axis YPlane y - y_0 = 0 {y_0}
Plane perpendicular to z-axis ZPlane z - z_0 = 0 {z_0}
Circle in the xy-plane ZCylinder (x-x_0)^2 + (y-y_0)^2 - R^2 = 0 {x_0, y_0, R}

Table 1: Quadratic surface primitives in OpenMOC.

The following sections develop the methodology used in OpenMOC to compute the distance from any point (x,y) in the xy-plane to each of the surfaces in Table 1.

4.1.1.2. Arbitrary Plane

An arbitrary plane is described by the following potential equation:

(2)f(x,y,z) = Px + Qy + Rz + D = 0

To find the intersection point along some trajectory with a Plane, substitute the intersection point on the surface (x+du, y+dv, z+dw) into the potential equation and rearrange to find the following parametrized distance d:

(3)f(x+du, y+dv, z+dw) = P(x+du) + Q(y+dv) R(z+dw) + D = 0 \;\;\; \Rightarrow \;\;\; d = \frac{D - Px - Qy - Rz}{Pu + Qv + Rw}

4.1.1.3. XPlane

A plane perpendicular to the x-axis is described by the following potential equation:

(4)f(x,y,z) = Px + D = 0 \;\;\; \Rightarrow \;\;\; x - x_0 = 0

To find the intersection point along some trajectory with a XPlane, substitute the intersection point on the surface (x+du, y+dv, z+dw) into the potential equation and rearrange to find the following parametrized distance d:

(5)f(x+du, y+dv, z+dw) = (x + du) - x_0 = 0 \;\;\; \Rightarrow \;\;\; d = \frac{x-x_0}{u}

4.1.1.4. YPlane

Similar to the XPlane, a plane perpendicular to the y-axis is described by the following potential equation:

(6)f(x,y, z) = Qy + D = 0 \;\;\; \Rightarrow \;\;\; y - y_0 = 0

To find the intersection point along some trajectory with a YPlane, substitute the intersection point on the surface (x+du, y+dv, z+dw) into the potential equation and rearrange to find the following parametrized distance d:

(7)f(x+du, y+dv, z+dw) = (y + dv) - y_0 = 0 \;\;\; \Rightarrow \;\;\; d = \frac{y-y_0}{v}

4.1.1.5. ZPlane

Similar to the ZPlane, a plane perpendicular to the z-axis is described by the following potential equation:

(8)f(x,y,z) = Qz + D = 0 \;\;\; \Rightarrow \;\;\; z - z_0 = 0

To find the intersection point along some trajectory with a ZPlane, substitute the intersection point on the surface (x+du, y+dv, z+dw) into the potential equation and rearrange to find the following parametrized distance d:

(9)f(x+du, y+dv, z+dw) = (z + dw) - z_0 = 0 \;\;\; \Rightarrow \;\;\; d = \frac{z-z_0}{w}

4.1.1.6. ZCylinder

A circle in the xy-plane centered at (x_0, y_0) with radius R is described by the following potential equation:

(10)f(x,y) = (x-x_0)^2 + (y-y_0)^2 - R^2 = 0

To find the intersection point along some trajectory with a ZCylinder, substitute the intersection point on the surface (x+du, y+dv) into the potential equation, define \Delta_{x} = x - x_0 and \Delta_{y} = y - y_0, and rearrange to find the following parametrized distance d:

(11)f(x+du, y+dv) = (\Delta_{x} + du)^2 + (\Delta_{y} + dv)^2 - R^2 = 0

(12)d = \frac{-\Delta_{x}y - \Delta_{y}v \pm \sqrt{[-\Delta_{x}u - \Delta_{y}v]^2 - (u^2+v^2)[\Delta_{x}^2 + \Delta_{y}^2 - R^2]}}{(u^2 + v^2)}

The parametrized distance is in the form of the quadratic formula, and there may be one or two real solutions, or two complex solutions. In the case of one solution, it indicates that the trajectory vector \hat{n} merely glances the surface of the ZCylinder. The two solution case represents a trajectory vector that intersects the ZCylinder surface and passes through on the opposite side. Complex solutions are unphysical and represent the fact that the trajectory will not pass through the circle at all.

4.1.2. Regions

A region is a cell attribute that contains a CSG tree of halfspaces which is used to describe the spatial extent of a cell.

4.1.3. Cells

A cell is defined to be the region bounded by a boolean combination of surface halfspaces. OpenMOC supports intersection, union and complement of surface halfspaces. The halfspaces are kept in the region cell attribute. The cell also has a fill attribute, filled by either a material or a universe, described in the following section.

Figure 5 illustrates the use of five surface halfspaces to make up a simple pin cell. The halfspace for each surface is indicated by “+” or “-” symbols, while each cell is uniquely identified by a color and number. The fuel pin is described by the negative halfspace of the ZCylinder surface, while the moderator is made up of the intersection of the positive halfspace of the ZCylinder and positive/negative halfspaces of the left/right and bottom/top XPlanes and YPlanes, respectively.

../_images/csg-cells-halfspace-intersection.png

Figure 5: Two cells representing a fuel pin cell.

4.1.4. Universes

A universe is a collection of one or more cells that fill the entirety of the xy-plane. Each cell may be filled with a material or a separate universe. Universes allow unique structures to be created from cells, and for simple replication of that structure throughout a model by placing it in various locations throughout the geometry. The universe-based CSG formulation in OpenMOC is similar to that used in Monte Carlo neutron transport codes such as [OpenMC], [MCNP] and [Serpent].

A universe of 10 cells constructed from the halfspace intersections of two XPlanes, two YPlanes and one ZCylinder surface is depicted in Figure 6. The halfspace for each surface is indicated by “+” or “-” symbols, while each cell is uniquely identified by a color and number.

../_images/surfs-cells.png

Figure 6: A universe composed of 10 cells.

4.1.5. Lattices

Lattices are an extremely useful construct for modeling regular, repeating structures. This is especially the case for reactor cores which typically contain rectangular or hexagonal arrays of fuel pins. For this reason, lattices are a common structure in many neutron transport codes, such as OpenMC, MCNP and Serpent.

OpenMOC currently contains two lattice implementation for 3D Cartesian arrays. A lattice can be specified by the number of array elements along the x, y and z axes, the dimensions of each lattice cell, and the universe to fill each lattice cell. The lattice specification represents a coordinate transformation such that the center of each lattice cell maps to the origin of the universe within it. This allows for a single universe to be replicated in some or all lattice cells without redundantly storing the universe many times in memory.

Alternatively, a lattice can be defined using a set of widths in each Cartesian direction, to form a 3D non-uniform array. This is especially useful to model water gaps in PWRs, fuel bundle walls in BWRs and the baffle in both reactors.

Figure 7 illustrates a simple 4 \times 4 lattice, with each lattice cell filled by one of three different universes. Each universe contains two cells representing the moderator and a fuel pin of some diameter.

../_images/csg-lattice-cells.png

Figure 7: A 4 \times 4 lattice.

4.2. References

[Wikipedia]Wikipedia, “Constructive Solid Geometry,” http://en.wikipedia.org/wiki/Constructive_solid_geometry (2013).
[OpenMC]
  1. Romano and B. Forget, “The OpenMC Monte Carlo Particle Transport Code.” Annals of Nuclear Energy, 51, pp. 274-281 (2013).
[MCNP]X-5 Monte Carlo Team, “MCNP - A General Monte Carlo N-Particle Transport Code, Version 5.” Technical Report LA-UR-03-1987, Los Alamos National Laboratory (2008).
[Serpent]
  1. Leppanen, “Serpent - A Continuous Energy Monte Carlo Reactor Physics Burnup Calculation Code,” http://montecarlo.vtt.fi/download/Serpent_manual.pdf (2013).