1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
.. _sec:coordtransforms:
Coordinate transforms
=====================
Particle positions and vectors defined on the particles can be plotted
in non-cartesian coordinate systems. The coordinate system can be set
via the :ref:`sec:menu-o`, via the ``change coordinate system``
option. The actual coordinate transformations are defined in a
standalone Fortran module called ``geometry.f90`` and the precise
details can be determined by looking in this file. For reference,
however the transformations are given below.
Cylindrical Polar Coordinates
------------------------------
For cylindrical coordinates the transformations are:
.. math::
\begin{array}{lclp{1cm}lcl}
R & = & \sqrt{x^2 + y^2} & & x & = & R\cos\phi \\
\phi & = & \tan^{-1}{(y/x)} &; & y & = & R\sin\phi \\
z & = & z & & z & = & z\\
\end{array}
where vectors transform according to:
.. math::
\begin{array}{lclp{1cm}lcl}
v_R & = & v_x \frac{x}{R} + v_y \frac{y}{R} & & v_x & = & v_R \cos\phi - v_\phi \sin\phi \\
v_\phi & = & v_x \left(\frac{-y}{R}\right) + v_y \left(\frac{x}{R}\right) &; &v_y & = & v_R \sin\phi + v_\phi \cos\phi \\
v_z & = & v_z & & v_z & = & v_z. \\
\end{array}
In the case where these vectors are velocities, the :math:`v_{\phi}`
component corresponds to :math:`v_{\phi} = r\dot{\phi}`. At the origin
we assume :math:`\phi = 0`, implying :math:`\cos\phi = 1` and therefore
:math:`\frac{x}{R} = 1` and :math:`\frac{y}{R} = 0`. This ensures the
transformations are reversible everywhere.
Spherical Polar Coordinates
----------------------------
For spherical coordinates the transformations are:
.. math::
\begin{array}{lclp{1cm}lcl}
r & = & \sqrt{x^2 + y^2 + z^{2}} & & x & = & r\cos\phi\sin\theta\\
\phi & = & \tan^{-1}{(y/x)} &; & y & = & r\sin\phi\sin\theta \\
\theta & = & \cos^{-1}(z/r) & & z & = & r\cos\theta \\
\end{array}
where vectors transform according to:
.. math::
\begin{array}{lclp{1cm}lcl}
v_r & = & v_x \frac{x}{r} + v_y \frac{y}{r} + v_{z}\frac{z}{r} & & v_x & = & v_r \cos\phi\sin\theta- v_\phi \sin\phi + v_\theta \cos\phi\cos\theta \\
v_\phi & = & v_x \left(\frac{-y}{\sqrt{x^2 + y^{2}}}\right) + v_y \left(\frac{x}{\sqrt{x^2 + y^{2}}}\right) &; &v_y & = & v_r \sin\phi\sin\theta + v_\phi \cos\phi + v_{\theta} \sin\phi\cos\theta \\
v_\theta & = & v_{x}\frac{xz}{r \sqrt{x^{2} + y^{2}}} + v_{y}\frac{yz}{r \sqrt{x^{2} + y^{2}}} - v_{z}\frac{(x^{2} + y^{2})}{r\sqrt{x^{2} + y^{2}}} & & v_z & = & v_r \cos\theta - v_\theta \sin\theta. \\
\end{array}
In the case where these vectors are velocities, the components
:math:`v_{\phi}` and :math:`v_{\theta}` correspond to
:math:`v_{\phi} = r\sin{\theta}\dot{\phi}` and
:math:`v_{\theta} = r\dot{\theta}` respectively.
Toroidal Coordinates
---------------------
Toroidal coordinates represent a local frame of reference inside a
torus. The coordinate transformations are given by
.. math::
\begin{array}{lclp{1cm}lcl}
r & = & \sqrt{[(x^2 + y^2)^{1/2} - R]^{2} + z^{2}} & & x & = & (r\cos\theta + R) \cos\phi \\
\theta & = & \tan^{-1} \left[\frac{z}{(\sqrt{x^{2} + y^{2}} - R)}\right] &; & y & = & (r\cos\theta + R)\sin\phi \\
\phi & = & \tan^{-1}(y/x) & & z & = & r\sin\theta \\
\end{array}
where :math:`R` is the radius of the torus. The use of the inverse
tangent in :math:`\theta` instead of :math:`\theta = \sin^{-1}(z/r)` is
necessary to get the quadrant correct (via the ``atan2`` function).
Vectors transform according to:
.. math::
\begin{array}{lclp{2cm}lcl}
v_r & = & v_x \frac{x(r_{cyl} - R)}{r r_{cyl}} + v_y \frac{y(r_{cyl} - R)}{r r_{cyl}} + v_{z} \frac{z}{r} & & v_x & = & v_r \cos\theta\cos\phi- v_\theta \sin\theta\cos\phi - v_\phi\sin\phi \\
v_\theta & = & v_x \frac{-zx}{r r_{cyl}} + v_y\frac{-zy}{r r_{cyl}} + v_{z}\frac{(r_{cyl} - R)}{r} &; &v_y & = & v_r \cos\theta\sin\phi - v_\theta \sin\theta\sin\phi + v_\phi\cos\phi \\
v_\phi & = & v_{x} \left(\frac{-y}{r_{cyl}}\right) + v_{y} \left(\frac{x}{r_{cyl}}\right) & & v_z & = & v_{r}\sin\theta + v_{\theta} \cos\theta \\
\end{array}
where we have defined, for convenience,
.. math:: r_{\rm cyl} = \sqrt{x^{2} + y^{2}} = r\cos\theta + R. \nonumber
and the velocities :math:`v_\theta` and :math:`v_\phi` correspond to
:math:`r \dot{\theta}` and :math:`r_{\rm cyl} \dot{\phi}`, respectively.
The torus radius :math:`R` is a parameter in the ``geometry`` module and
is set to :math:`1` by default.
Flared Cylindrical Polar Coordinates
-------------------------------------
For flared cylindrical coordinates the transformations are:
.. math::
\begin{array}{lclp{1cm}lcl}
R & = & \sqrt{x^2 + y^2} & & x & = & R\cos\phi \\
\phi & = & \tan^{-1}{(y/x)} &; & y & = & R\sin\phi \\
z' & = & z \left(R_{\rm ref}/{R}\right)^\beta & & z & = & z' (R/R_{\rm ref})^\beta \\
\end{array}
where :math:`R_{\rm ref}` is the reference radius and :math:`\beta` is
the flaring index, both parameters that can be set by the user. Vectors
transform according to:
.. math::
\begin{array}{lclp{1cm}lcl}
v_R & = & v_x \frac{x}{R} + v_y \frac{y}{R} & & v_x & = & v_R \cos\phi - v_\phi \sin\phi \\
v_\phi & = & v_x \left(\frac{-y}{R}\right) + v_y \left(\frac{x}{R}\right) &; &v_y & = & v_R \sin\phi + v_\phi \cos\phi \\
v_{z'} & = & -\beta \frac{xz}{R^2} \left(\frac{R_{\rm ref}}{R}\right)^\beta v_x -\beta \frac{yz}{R^2} \left(\frac{R_{\rm ref}}{R}\right)^\beta v_y + \left(\frac{R_{\rm ref}}{R}\right)^\beta v_z & & v_z & = & \beta \frac{z'}{R} \left(\frac{R}{R_{\rm ref}}\right)^\beta v_R + \left(\frac{R}{R_{\rm ref}}\right)^\beta v_{z'}. \\
\end{array}
In the case where these vectors are velocities, the :math:`v_{\phi}`
component corresponds to :math:`v_{\phi} = r\dot{\phi}`.
Logarithmic Flared Cylindrical Polar Coordinates
-------------------------------------------------
For logarithmic flared cylindrical coordinates the transformations are:
.. math::
\begin{array}{lclp{1cm}lcl}
d & = & \log_{10} ( \sqrt{x^2 + y^2} ) & & x & = & R\cos\phi \\
\phi & = & \tan^{-1}{(y/x)} &; & y & = & R\sin\phi \\
z' & = & z \left(R_{\rm ref}/{R}\right)^\beta & & z & = & z' (R/R_{\rm ref})^\beta \\
\end{array}
where :math:`R_{\rm ref}` is the reference radius and :math:`\beta` is
the flaring index, both parameters that can be set by the user. Vectors
transform according to:
.. math::
\begin{array}{lclp{1cm}lcl}
v_d & = & v_x \frac{x}{R}f^{-1} + v_y \frac{y}{R}f^{-1} & & v_x & = & f v_d \cos\phi - v_\phi \sin\phi \\
v_\phi & = & v_x \left(\frac{-y}{R}\right) + v_y \left(\frac{x}{R}\right) &; &v_y & = & f v_d \sin\phi + v_\phi \cos\phi \\
v_{z'} & = & -\beta \frac{xz}{R^2} \left(\frac{R_{\rm ref}}{R}\right)^\beta v_x -\beta \frac{yz}{R^2} \left(\frac{R_{\rm ref}}{R}\right)^\beta v_y + \left(\frac{R_{\rm ref}}{R}\right)^\beta v_z & & v_z & = & \beta \frac{z'}{R} \left(\frac{R}{R_{\rm ref}}\right)^\beta f v_d + \left(\frac{R}{R_{\rm ref}}\right)^\beta v_{z'}. \\
\end{array}
where :math:`R \equiv 10^d` and correspondingly :math:`d = \log_{10} R`
and :math:`f \equiv R \ln (10)`.
|