Universe-based geometry type in Serpent

From Serpent Wiki
Revision as of 20:28, 8 March 2016 by Jaakko Leppänen (Talk | contribs) (Cells)

Jump to: navigation, search

From here on it is assumed that the tracking takes place in a three-dimensional Cartesian coordinate system. In vector notation, the position and direction of motion are defined by two vectors:


\boldsymbol{r} = x\boldsymbol{\hat i} + y\boldsymbol{\hat j} + z\boldsymbol{\hat k}

and


{\boldsymbol{\hat{\Omega}}} = u\boldsymbol{\hat i} + v\boldsymbol{\hat j} + w\boldsymbol{\hat k}

where \boldsymbol{\hat i}, \boldsymbol{\hat j} and \boldsymbol{\hat k} are the unit vectors defining the three-dimensional Cartesian coordinate system. Direction vector {\boldsymbol{\hat{\Omega}}} is normalized to unity:


{\boldsymbol{\hat{\Omega}}}\cdot{\boldsymbol{\hat{\Omega}}} = 1

or


u^2 + v^2 + w^2 = 1

Coefficients u, v and w are the direction cosines, i.e. the cosines of the angle that vector {\boldsymbol{\hat{\Omega}}} forms with the positive x-, y- and z-axis, respectively.

Basic building blocks

Surfaces

Monte Carlo transport codes are most typically based on the constructive solid geometry (CSG) type, in which the geometry is composed of homogeneous material cells, defined using combinations of elementary and derived surface types.

The most elemental building block is the surface, described using algebraic equations, typically of the quadratic type. The action that puts an arbitrary position \boldsymbol{r} on one or the other side of a surface is based on a simple test carried out by substituting the coordinates into the surface equation:


S(\boldsymbol{r}) = S(x,y,z)  
\left\{
\begin{array}{ll}
        < 0 & \text{if the point is inside the surface} \\
         = 0 & \text{if the point on the surface} \\
        > 0 & \text{if the point is outside the surface} \\
\end{array} 
\right . 

This surface test also fixes the concepts of ``inside and ``outside for each surface type, which is important when forming the cells from the surface combinations.

The general quadratic surface can be written in parametric form as:


S(x, y, z) =
Ax^2 + By^2 + Cz^2 + Dxy + Eyz + Fzx 
 + Gx + Hy + Iz + J

where A, B, C, D, E, F, G, H, I and J are constants. Common examples of quadratic surfaces obtained from the parametrized quadratic equation include the plane perpendicular to x-axis at x_0:


S(x, y, z) = x - x_0

sphere centered at (x_0,y_0,z_0) with radius r:


S(x, y, z) = (x - x_0)^2 + (y - y_0)^2 - (z - z_0)^2 - r^2

and straight infinite cylinder parallel to z-axis centered at (x_0, y_0) with radius r:


S(x, y) = (x - x_0)^2 + (y - y_0)^2 - r^2

There are also non-quadratic surfaces, such as the torus, for which the surface test cannot be performed by substituting the coordinates into a single equation.

Monte Carlo codes often provide additional derived surface types, which are formed by combinations of elementary surfaces. For example, a cuboid with boundaries [x_1, x_2], [y_1, y_2], [z_1, z_2] consists of six planes perpendicular to the coordinate axes, and surface test works by testing the position of the point with respect to all of them. Other derived surface types convenient for reactor modeling include truncated cylinders, and square and hexagonal prisms.

Surface equations are also used for determining the distance to the nearest material boundary in the direction of motion. The points where the particle path intersects the surface are obtained by solving the surface equation with condition:


S(\boldsymbol{r} + \delta{\boldsymbol{\hat{\Omega}}}) = S(x + \delta u, y + \delta v, z + \delta w) = 0

i.e. by setting a point located at distance \delta from position \boldsymbol{r} in the direction of motion {\boldsymbol{\hat{\Omega}}} on the surface, and solving for \delta. When the equation has multiple solutions, the nearest point corresponds to the smallest positive value of \delta. If all solutions are negative or no solution exists, the surface is away from the line-of-sight.

As an example, the distance to a plane perpendicular to x-axis at x_0 is obtained from


x + \delta u - x_0 = 0 \Longleftrightarrow
\delta =
\frac{x_0 - x}{u}

and the distance to a straight infinite cylinder parallel to z-axis centered at (x_0, y_0) with radius r from:


(x + \delta u - x_0)^2 + (y + \delta v - y_0)^2 - r^2 = 0 
\Longleftrightarrow
\delta = \frac{-L \pm \sqrt{L^2 - KM}}{K}

where K = u^2 + v^2, L = u(x - x_0) + v(y - y_0) and M = (x - x_0)^2 + (y - y_0)^2 - r^2.

Cells

The next building block in the CSG hierarchy is the cell, which is constructed from the combination of surfaces, and it defines a homogeneous material region. The construction is based on three operators:

  • Intersection : S_1 {\;\cap\;} S_2 - Point is inside the cell if it is inside both surface S_1 and S_2
  • Union : S_1 {\;\cup\;} S_2 - Point is inside the cell if it is inside either surface S_1 or S_2, or both
  • Complement : \setminus S_1 - Point is inside the cell if it is outside surface S_1

The intersection and union operator behave very similar to arithmetic multiplication and addition, respectively, and they share the properties of commutativity (order of operands is exchangeable):


\begin{align}
S_1 {\;\cup\;} S_2 &= S_2 {\;\cup\;} S_1
\\
S_1{\;\cap\;} S_2 &= S_2 {\;\cap\;} S_1
\end{align}

associativity (two or more similar operations can be grouped in an arbitrary manner):


\begin{align}
(S_1 {\;\cup\;} S_2) {\;\cup\;} S_3 &= S_1 {\;\cup\;} (S_2 {\;\cup\;} S_3)
\\
(S_1 {\;\cap\;} S_2) {\;\cap\;} S_3 &= S_1 {\;\cap\;} (S_2 {\;\cap\;} S_3)
\end{align}

and distributivity (precedence of intersection over union):


(S_1 {\;\cup\;} S_2) {\;\cap\;} S_3 = (S_1{\;\cap\;} S_3) {\;\cup\;} (S_2 {\;\cap\;} S_3)

The analogies to arithmetic operations are best illustrated by examples (X_i are real numbers).


\begin{align}
X_1 + X_2 &= X_2 + X_1
\\
X_1\times X_2 &= X_2 \times X_1
\\
S_1 {\;\cup\;} S_2 &= S_2 {\;\cup\;} S_1
\\
S_1{\;\cap\;} S_2 &= S_2 {\;\cap\;} S_1
\end{align}


\begin{align}
(X_1 + X_2) + X_3 &= X_1 + (X_2 + X_3)
\\
(X_1 \times X_2) \times X_3 &= X_1 \times (X_2 \times X_3)
\\
(S_1 {\;\cup\;} S_2) {\;\cup\;} S_3 &= S_1 {\;\cup\;} (S_2 {\;\cup\;} S_3)
\\
(S_1 {\;\cap\;} S_2) {\;\cap\;} S_3 &= S_1 {\;\cap\;} (S_2 {\;\cap\;} S_3)
\end{align}


\begin{align}
(X_1 + X_2) \times X_3 &= (X_1\times X_3) + (X_2 \times X_3)
\\
(S_1 {\;\cup\;} S_2) {\;\cap\;} S_3 &= (S_1{\;\cap\;} S_3) {\;\cup\;} (S_2 {\;\cap\;} S_3)
\end{align}