Add documentation on torus distance/normal

This commit is contained in:
Paul Romano 2021-12-22 08:57:44 -05:00
parent b0fbb4e804
commit a57d7dcd7f
4 changed files with 110 additions and 10 deletions

View file

@ -118,7 +118,19 @@ to fully define the surface.
+----------------------+------------+------------------------------+-------------------------+
| General quadric | quadric | :math:`Ax^2 + By^2 + Cz^2 + | :math:`A \; B \; C \; D |
| surface | | Dxy + Eyz + Fxz + Gx + Hy + | \; E \; F \; G \; H \; |
| | | Jz + K` | J \; K` |
| | | Jz + K = 0` | J \; K` |
+----------------------+------------+------------------------------+-------------------------+
| Torus parallel to the| x-torus | :math:`(x-x_0)^2/B^2+\frac{( | :math:`x_0 \; y_0 \; |
| :math:`x`-axis | | \sqrt{(y-y_0)^2+(z-z_0)^2} - | z_0 \; A \; B \; C` |
| | | A)^2}{C^2} - 1 = 0` | |
+----------------------+------------+------------------------------+-------------------------+
| Torus parallel to the| y-torus | :math:`(y-y_0)^2/B^2+\frac{( | :math:`x_0 \; y_0 \; |
| :math:`y`-axis | | \sqrt{(x-x_0)^2+(z-z_0)^2} - | z_0 \; A \; B \; C` |
| | | A)^2}{C^2} - 1 = 0` | |
+----------------------+------------+------------------------------+-------------------------+
| Torus parallel to the| z-torus | :math:`(z-z_0)^2/B^2+\frac{( | :math:`x_0 \; y_0 \; |
| :math:`z`-axis | | \sqrt{(x-x_0)^2+(y-y_0)^2} - | z_0 \; A \; B \; C` |
| | | A)^2}{C^2} - 1 = 0` | |
+----------------------+------------+------------------------------+-------------------------+
.. _universes:
@ -437,6 +449,72 @@ Defining the terms
we then have the simple quadratic equation :math:`ad^2 + 2kd + c = 0` which can
be solved as described in :ref:`cylinder_distance`.
Torus Parallel to an Axis
-------------------------
The equation for a torus parallel to, for example, the x-axis is
.. math::
:label: dist-xtorus-sqrt
\frac{(x-x_0)^2}{B^2} + \frac{(\sqrt{(y-y_0)^2 + (z-z_0)^2} - A)^2}{C^2} -
1 = 0.
First, it needs to be cast into a polynomial form. Rearranging terms,
.. math::
:label: dist-xtorus-1
(D\bar{x}^2 + \bar{y}^2 + \bar{z}^2 + A^2 - C^2)^2 = 4A^2(\bar{y}^2 +
\bar{z}^2)
where :math:`D = (C/B)^2`, :math:`\bar{x} = x - x_0`, :math:`\bar{y} = y - y_0`,
and :math:`\bar{z} = z - z_0`. To find the distance to the surface, we thus need
to solve
.. math::
:label: dist-xtorus-2
(D(\bar{x} + du)^2 + (\bar{y} + dv)^2 + (\bar{z} + dw)^2 + A^2 - C^2)^2 =
4A^2((\bar{y} + dv)^2 + (\bar{z} + dw)^2).
Expanding and collecting like powers of :math:`d` yields
.. math::
:label: dist-xtorus-3
(c_2d^2 + c_1d + c_0)^2 = c_2'd^2 + c_1'd + c_0'
where
.. math::
:label: dist-xtorus-4
\begin{align*}
c_2 &= Du^2 + v^2 + w^2 \\
c_1 &= 2(Du\bar{x} + v\bar{y} + w\bar{z}) \\
c_0 &= D\bar{x}^2 + \bar{y}^2 + \bar{z}^2 + A^2 - C^2 \\
c_2' &= 4A^2 (v^2 + w^2) \\
c_1' &= 8A^2 (v\bar{y} + w\bar{z}) \\
c_0' &= 4A^2(\bar{y}^2 + \bar{z}^2).
\end{align*}
Expanding the left-hand side and collecting like powers of :math:`d` on one
side, we obtain
.. math::
:label: dist-xtorus-5
(c_2^2)d^4 + (2c_1c_2)d^3 + (c_1^2 + 2c_0c_2 - c_2')d^2 + (2c_0c_1 - c_1')d
+ (c_0^2 - c_0') = 0.
The above equation is a fourth-order (quartic) polynomial equation. Although
there is an analytical solution to the general quartic equation, it can be
subject to roundoff errors when evaluated numerically. OpenMC uses an external
`quartic equation solver <https://doi.org/10.1145/3386241>`_ developed by
Orellana and De Michele that is based on the decomposition of the quartic
polynomial into two quadratics.
.. _find-cell:
----------------------------
@ -899,6 +977,27 @@ Dxy + Eyz + Fxz + Gx + Hy + Jz + K = 0`. Thus, the gradient to the surface is
\nabla f = \left ( \begin{array}{c} 2Ax + Dy + Fz + G \\ 2By + Dx + Ez + H
\\ 2Cz + Ey + Fx + J \end{array} \right ).
Torus Parallel to an Axis
-------------------------
A cone parallel to, for example, the x-axis has the form
.. math::
:label: reflection-torus-1
f(x,y,z) = \frac{(x-x_0)^2}{B^2} + \frac{(\sqrt{(y-y_0)^2 + (z-z_0)^2} -
A)^2}{C^2} - 1.
The gradient to the surface is therefore
.. math::
:label: reflection-torus-grad
\nabla f = \left ( \begin{array}{c} 2\bar{x}/B^2 \\ 2\bar{y}(g - A)/(C^2g)
\\ 2\bar{z}(g - A)/(C^2g) \end{array} \right )
where :math:`g = \sqrt{\bar{y}^2 + \bar{z}^2}` and, as always, :math:`\bar{x} =
x - x_0`, :math:`\bar{y} = y - y_0`, and :math:`\bar{z} = z - z_0`.
.. _white: