Previous Up Next

B  Coordinate transformation details

Particle positions and vectors defined on the particles can be plotted in non-cartesian coordinate systems. The coordinate system can be set via the particle plot o)ptions menu, 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.

B.1   Cylindrical Polar Coordinates

For cylindrical coordinates the transformations are:

$r & = & 
$x^2 + y^2$
& & x & = & rcosφ$
$φ& = & tan-1(y/x) &; & y & = & rsinφ$
$z & = & z & & z & = & z$
$$

where vectors transform according to:

$v_r & = & v_x 
x
r
 + v_y 
y
r
& & v_x & = & v_r cosφ- v_φsinφ$
$v_φ& = & v_x 


-y
r



+ v_y 


x
r



&; &v_y & = & v_r sinφ+ v_φcosφ$
$v_z & = & v_z & & v_z & = & v_z. $
$$

In the case where these vectors are velocities, the $v_φ$ component corresponds to $v_φ = rφ$.

B.2   Spherical Polar Coordinates

For spherical coordinates the transformations are:

$r & = & 
$x^2 + y^2 + z^2$
& & x & = & rcosφsinθ$
$φ& = & tan-1(y/x) &; & y & = & rsinφsinθ$
$θ& = & cos-1(z/r) & & z & = & rcosθ$
$$

where vectors transform according to:

$v_r & = & v_x 
x
r
 + v_y 
y
r
 + v_z
z
r
& & v_x & = & v_r cosφsinθ- v_φsinφ+ v_θcosφcosθ$
$v_φ& = & v_x 





-y
$x^2 + y^2$






+ v_y 





x
$x^2 + y^2$






&; &v_y & = & v_r sinφsinθ+ v_φcosφ+ v_θ sinφcosθ$
$v_θ& = & v_x
xz
$x^2 + y^2$
 + v_y
yz
$x^2 + y^2$
 - v_z
(x^2 + y^2)
r
$x^2 + y^2$
& & v_z & = & v_r cosθ- v_θsinθ. $
$$

In the case where these vectors are velocities, the components $v_φ$ and $v_θ$ correspond to $v_φ = rsinθφ$ and $v_θ = rθ$ respectively.

B.3   Toroidal Coordinates

Toroidal coordinates represent a local frame of reference inside a torus. The coordinate transformations are given by

$r & = & 
$[(x^2 + y^2)^1/2 - R]^2 + z^2$
& & x & = & (rcosθ+ R) cosφ$
$θ& = & tan-1 





z
(
$x^2 + y^2$
 - R)






&; & y & = & (rcosθ+ R)sinφ$
$φ& = & tan-1(y/x) & & z & = & rsinθ$
$$

where $R$ is the radius of the torus. The use of the inverse tangent in $θ$ instead of $θ= sin-1(z/r)$ is necessary to get the quadrant correct (via the atan2 function). Vectors transform according to:

$v_r & = & v_x 
x(r_cyl - R)
r r_cyl
 + v_y 
y(r_cyl - R)
r r_cyl
 + v_z 
z
r
& & v_x & = & v_r cosθcosφ- v_θsinθcosφ- v_φsinφ$
$v_θ& = & v_x 
-zx
r r_cyl
  + v_y
-zy
r r_cyl
  + v_z
(r_cyl - R)
r
&; &v_y & = & v_r cosθsinφ- v_θsinθsinφ+ v_φcosφ$
$v_φ& = & v_x 


-y
r_cyl



+ v_y 


x
r_cyl



& & v_z & = & v_rsinθ+ v_θ cosθ$
$$

where we have defined, for convenience, $$ r_cyl = √x^2 + y^2 = rcosθ+ R. $$ The torus radius $R$ is a parameter in the geometry module and is set to $1$ by default.


SPLASH: A visualisation tool for SPH data ©2004–2014Daniel Price.
http://users.monash.edu.au/~dprice/splash/
Previous Up Next