Difference between revisions of "Universe-based geometry type in Serpent"
(→Surfaces) |
Ana Jambrina (Talk | contribs) (→Cells) |
||
(24 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | Similar to several other Monte Carlo codes, the basic geometry description in Serpent is based on a [https://en.wikipedia.org/wiki/Constructive_solid_geometry constructive solid geometry (CSG)] model, in which homogeneous material cells are defined using combinations of elementary and derived surface types. A general description is provided here, and there are several [[Collection of example input files|input examples]] that illustrate the construction of reactor geometries in practice. In addition to CSG geometries, Serpent also supports [[Unstructured mesh based geometry type|unstructured mesh]] and [[Unstructured surface based geometry type|tessellated surface (CAD)]] based types. | ||
− | From here on it is assumed that | + | The description below is quite technical, as it was adopted from lecture material on the Monte Carlo method. From here on it is assumed that |
− | + | particle tracking takes place in a three-dimensional Cartesian coordinate system. In vector notation, the position and direction of motion are defined by two vectors: | |
− | In vector notation, the | + | |
− | position and direction of motion are defined by two | + | |
− | vectors: | + | |
<math> | <math> | ||
Line 29: | Line 27: | ||
u^2 + v^2 + w^2 = 1 | u^2 + v^2 + w^2 = 1 | ||
</math> | </math> | ||
+ | |||
+ | [[File:Directions_large.png|thumb|300px|Direction vector in the Cartesian coordinate system.]] | ||
Coefficients <math>u</math>, <math>v</math> and <math>w</math> are the direction cosines, i.e. the | Coefficients <math>u</math>, <math>v</math> and <math>w</math> are the direction cosines, i.e. the | ||
cosines of the angle that vector <math>{\boldsymbol{\hat{\Omega}}}</math> forms with the positive x-, y- and | cosines of the angle that vector <math>{\boldsymbol{\hat{\Omega}}}</math> forms with the positive x-, y- and | ||
− | z-axis, respectively | + | z-axis, respectively: |
+ | |||
+ | <math> | ||
+ | \begin{align} | ||
+ | u &= \cos\eta_x | ||
+ | \\ | ||
+ | v &= \cos\eta_y | ||
+ | \\ | ||
+ | w &= \cos\eta_z | ||
+ | \end{align} | ||
+ | </math> | ||
+ | |||
− | = Basic building blocks = | + | == Basic building blocks == |
− | == Surfaces == | + | === Surfaces === |
− | + | The most elemental building block of a CSG geometry is the surface, described using algebraic equations, typically of the quadratic type. The action that puts an arbitrary position <math>\boldsymbol{r}</math> 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: | |
− | + | ||
− | The most elemental building block is the surface, described using algebraic equations, typically of the quadratic type. The action that puts an arbitrary position <math>\boldsymbol{r}</math> 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: | + | |
<math> | <math> | ||
Line 52: | Line 61: | ||
\right . | \right . | ||
</math> | </math> | ||
− | This surface test also fixes the concepts of | + | 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: |
− | 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: | + | |
<math> | <math> | ||
Line 74: | Line 79: | ||
<math> | <math> | ||
− | S(x, y, z) = (x - x_0)^2 + (y - y_0)^2 | + | S(x, y, z) = (x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 - r^2 |
</math> | </math> | ||
Line 86: | Line 91: | ||
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. | 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. | ||
− | + | Serpent also provides additional derived surface types, which are formed by combinations of elementary surfaces. For example, a cuboid with boundaries <math>[x_1, x_2]</math>, <math>[y_1, y_2]</math>, <math>[z_1, z_2]</math> 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. For detailed description, see the list of [[Surface_types|available surface types]]. | |
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: | 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: | ||
Line 96: | Line 101: | ||
i.e. by setting a point located at distance <math>\delta</math> from position <math>\boldsymbol{r}</math> in the direction of motion <math>{\boldsymbol{\hat{\Omega}}}</math> on the surface, and solving for <math>\delta</math>. When the equation has multiple solutions, the nearest point corresponds to the smallest positive value of <math>\delta</math>. If all solutions are negative or no solution exists, the surface is away from the line-of-sight. | i.e. by setting a point located at distance <math>\delta</math> from position <math>\boldsymbol{r}</math> in the direction of motion <math>{\boldsymbol{\hat{\Omega}}}</math> on the surface, and solving for <math>\delta</math>. When the equation has multiple solutions, the nearest point corresponds to the smallest positive value of <math>\delta</math>. If all solutions are negative or no solution exists, the surface is away from the line-of-sight. | ||
− | + | For example, the distance to a plane perpendicular to x-axis at <math>x_0</math> is obtained from | |
<math> | <math> | ||
Line 114: | Line 119: | ||
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 = | + | Surface distances are needed for stopping particle tracks on material boundaries in the conventional surface-tracking mode, which is one of the two [[Delta- and surface-tracking|tracking modes]] available in Serpent. |
+ | |||
+ | === 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> | ||
+ | |||
+ | Cells are constructed using the [[Input syntax manual#cell (cell definition)|cell card]], which provides the list of constituent surfaces. The default operator is the intersection, which is applied if no other operator is listed between two surfaces. The operator identifiers for union and complement are ":" and "-", respectively. Cell lists can also include parentheses and the complement cell operator "#", which is a shorthand notation for the complement of the cell list of another cell. Construction of a simple pin-cell geometry using the boolean operators, together with the corresponding Serpent input notations is demonstrated in the following. | ||
+ | |||
+ | Consider a 2D pin-cell model of a light water reactor fuel pin surrounded by coolant. The pin consist of a fuel pellet with an outer diameter of 0.824 cm, enclosed inside a 0.063 cm thick cladding. The square pitch of the unit cell is 1.330 cm. The surfaces are defined by equations: | ||
+ | |||
+ | [[File:Pincell.png|thumb|300px|Pin-cell geometry example.]] | ||
+ | |||
+ | <math> | ||
+ | \begin{align} | ||
+ | S_1(x,y,z) &= x^2 + y^2 - 0.412 | ||
+ | \\ | ||
+ | S_2(x,y,z) &= x^2 + y^2 - 0.475 | ||
+ | \\ | ||
+ | S_3(x,y,z) &= x + 0.665 | ||
+ | \\ | ||
+ | S_4(x,y,z) &= x - 0.665 | ||
+ | \\ | ||
+ | S_5(x,y,z) &= y + 0.665 | ||
+ | \\ | ||
+ | S_6(x,y,z) &= y - 0.665 | ||
+ | \end{align} | ||
+ | </math> | ||
+ | |||
+ | or using Serpent input notation: | ||
+ | <nowiki> | ||
+ | surf S1 cyl 0.0 0.0 0.412 | ||
+ | surf S2 cyl 0.0 0.0 0.475 | ||
+ | surf S3 px -0.665 | ||
+ | surf S4 px 0.665 | ||
+ | surf S5 py -0.665 | ||
+ | surf S6 py 0.665</nowiki> | ||
+ | |||
+ | These surfaces are used to define four cells using intersections, unions and complements: | ||
+ | |||
+ | <math> | ||
+ | \begin{align} | ||
+ | C_1 &: S_1 &:& \text{Fuel} | ||
+ | \\ | ||
+ | C_2 &: (\setminus S_1){\;\cap\;} S_2 &:& \text{Cladding} | ||
+ | \\ | ||
+ | C_3 &: (\setminus S_2){\;\cap\;} | ||
+ | (\setminus S_3){\;\cap\;} S_4 | ||
+ | {\;\cap\;} (\setminus S_5){\;\cap\;} S_6 | ||
+ | &:& \text{Coolant} | ||
+ | \\ | ||
+ | C_4 &: S_3{\;\cup\;} (\setminus S_4){\;\cup\;} S_5 {\;\cup\;} (\setminus S_6) | ||
+ | &:& \text{Outside world} | ||
+ | \end{align} | ||
+ | </math> | ||
+ | |||
+ | which in Serpent input could be written as: | ||
+ | <nowiki> | ||
+ | cell 1 0 fuel -S1 | ||
+ | cell 2 0 clad S1 -S2 | ||
+ | cell 3 0 cool S2 S3 -S4 S5 -S6 | ||
+ | cell 4 0 outside -S3 :S4:-S5 :S6</nowiki> | ||
+ | |||
+ | The last cell, described as the "outside world", is not a part of the actual geometry, but it needs to be defined in order to tell the geometry routine that the particle has escaped the system, or that [[boundary conditions]] need to be invoked. | ||
+ | |||
+ | It is important to pay attention to what is the value of the surface equation inside and outside each surface. In the case of surface <math>S_1</math> (infinite cylinder), for example, the surface equation yields a positive value when the point is outside the cylinder. This means that the complement of <math>S_1</math> defines the space inside it. The selection of "inside" and "outside" is completely arbitrary. Serpent follows the same convention as MCNP, while the opposite is used in CSG model in SCALE, for example. | ||
+ | |||
+ | <u>Notes:</u> | ||
+ | * The previous example illustrates how complements, intersections and unions work in terms of cell definitions within a universe-based geometry. However, in practice, Serpent does not allow unions within the "outside" cell definition. | ||
+ | |||
+ | == Nests == | ||
+ | == Universes and lattices == | ||
+ | |||
+ | [[Category:Input]] | ||
+ | [[Category:Theory]] |
Latest revision as of 17:01, 9 May 2022
Similar to several other Monte Carlo codes, the basic geometry description in Serpent is based on a constructive solid geometry (CSG) model, in which homogeneous material cells are defined using combinations of elementary and derived surface types. A general description is provided here, and there are several input examples that illustrate the construction of reactor geometries in practice. In addition to CSG geometries, Serpent also supports unstructured mesh and tessellated surface (CAD) based types.
The description below is quite technical, as it was adopted from lecture material on the Monte Carlo method. From here on it is assumed that particle 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
The most elemental building block of a CSG geometry 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.
Serpent also provides 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. For detailed description, see the list of available surface types.
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.
For 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 .
Surface distances are needed for stopping particle tracks on material boundaries in the conventional surface-tracking mode, which is one of the two tracking modes available in Serpent.
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).
Cells are constructed using the cell card, which provides the list of constituent surfaces. The default operator is the intersection, which is applied if no other operator is listed between two surfaces. The operator identifiers for union and complement are ":" and "-", respectively. Cell lists can also include parentheses and the complement cell operator "#", which is a shorthand notation for the complement of the cell list of another cell. Construction of a simple pin-cell geometry using the boolean operators, together with the corresponding Serpent input notations is demonstrated in the following.
Consider a 2D pin-cell model of a light water reactor fuel pin surrounded by coolant. The pin consist of a fuel pellet with an outer diameter of 0.824 cm, enclosed inside a 0.063 cm thick cladding. The square pitch of the unit cell is 1.330 cm. The surfaces are defined by equations:
or using Serpent input notation:
surf S1 cyl 0.0 0.0 0.412 surf S2 cyl 0.0 0.0 0.475 surf S3 px -0.665 surf S4 px 0.665 surf S5 py -0.665 surf S6 py 0.665
These surfaces are used to define four cells using intersections, unions and complements:
which in Serpent input could be written as:
cell 1 0 fuel -S1 cell 2 0 clad S1 -S2 cell 3 0 cool S2 S3 -S4 S5 -S6 cell 4 0 outside -S3 :S4:-S5 :S6
The last cell, described as the "outside world", is not a part of the actual geometry, but it needs to be defined in order to tell the geometry routine that the particle has escaped the system, or that boundary conditions need to be invoked.
It is important to pay attention to what is the value of the surface equation inside and outside each surface. In the case of surface (infinite cylinder), for example, the surface equation yields a positive value when the point is outside the cylinder. This means that the complement of defines the space inside it. The selection of "inside" and "outside" is completely arbitrary. Serpent follows the same convention as MCNP, while the opposite is used in CSG model in SCALE, for example.
Notes:
- The previous example illustrates how complements, intersections and unions work in terms of cell definitions within a universe-based geometry. However, in practice, Serpent does not allow unions within the "outside" cell definition.