Difference between revisions of "Universe-based geometry type in Serpent"
(→Surfaces) |
(→Cells) |
||
Line 114: | Line 114: | ||
where <math>K = u^2 + v^2</math>, <math>L = u(x - x_0) + v(y - y_0)</math> and <math>M = (x - x_0)^2 + (y - y_0)^2 - r^2</math>. | where <math>K = u^2 + v^2</math>, <math>L = u(x - x_0) + v(y - y_0)</math> and <math>M = (x - x_0)^2 + (y - y_0)^2 - r^2</math>. | ||
− | = Cells = | + | == 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 :''' <math>S_1 {\;\cap\;} S_2</math> - Point is inside the cell if it is inside ''both'' surface <math>S_1</math> and <math>S_2</math> | ||
+ | * '''Union :''' <math>S_1 {\;\cup\;} S_2</math> - Point is inside the cell if it is inside ''either'' surface <math>S_1</math> or <math>S_2</math>, or both | ||
+ | * '''Complement :''' <math>\setminus S_1</math> - Point is inside the cell if it is outside surface <math>S_1</math> | ||
+ | |||
+ | 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): | ||
+ | |||
+ | <math> | ||
+ | \begin{align} | ||
+ | S_1 {\;\cup\;} S_2 &= S_2 {\;\cup\;} S_1 | ||
+ | \\ | ||
+ | S_1{\;\cap\;} S_2 &= S_2 {\;\cap\;} S_1 | ||
+ | \end{align} | ||
+ | </math> | ||
+ | |||
+ | associativity (two or more similar operations can be grouped in an arbitrary manner): | ||
+ | |||
+ | <math> | ||
+ | \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} | ||
+ | </math> | ||
+ | |||
+ | and distributivity (precedence of intersection over union): | ||
+ | |||
+ | <math> | ||
+ | (S_1 {\;\cup\;} S_2) {\;\cap\;} S_3 = (S_1{\;\cap\;} S_3) {\;\cup\;} (S_2 {\;\cap\;} S_3) | ||
+ | </math> | ||
+ | |||
+ | The analogies to arithmetic operations are best illustrated by examples (<math>X_i</math> are real numbers). | ||
+ | |||
+ | <math> | ||
+ | \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} | ||
+ | </math> | ||
+ | |||
+ | <math> | ||
+ | \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} | ||
+ | </math> | ||
+ | |||
+ | <math> | ||
+ | \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} | ||
+ | </math> |
Revision as of 21:28, 8 March 2016
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:
and
where , and are the unit vectors defining the three-dimensional Cartesian coordinate system. Direction vector is normalized to unity:
or
Coefficients , and are the direction cosines, i.e. the cosines of the angle that vector 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 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:
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:
where and are constants. Common examples of quadratic surfaces obtained from the parametrized quadratic equation include the plane perpendicular to x-axis at :
sphere centered at with radius :
and straight infinite cylinder parallel to z-axis centered at with radius :
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 , , 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:
i.e. by setting a point located at distance from position in the direction of motion on the surface, and solving for . When the equation has multiple solutions, the nearest point corresponds to the smallest positive value of . 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 is obtained from
and the distance to a straight infinite cylinder parallel to z-axis centered at with radius from:
where , and .
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 : - Point is inside the cell if it is inside both surface and
- Union : - Point is inside the cell if it is inside either surface or , or both
- Complement : - Point is inside the cell if it is outside surface
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):
associativity (two or more similar operations can be grouped in an arbitrary manner):
and distributivity (precedence of intersection over union):
The analogies to arithmetic operations are best illustrated by examples ( are real numbers).