Introduction to orthogonal coordinates

In \(\mathbb{R}^3\), we can think that each point is given by the intersection of three surfaces. Thus, we have three families of curved surfaces that intersect each other at right angles. These surfaces are orthogonal locally, but not (necessarily) globally, and are defined by

\[u_1 = f_1(x, y, z)\, ,\quad u_2 = f_2(x, y, z)\, ,\quad u_3=f_3(x, y, z) \, .\]

These functions should be invertible, at least locally, and we can also write

\[x = x(u_1, u_2, u_3)\, ,\quad y = y(u_1, u_2, u_3)\, ,\quad z = z(u_1, u_2, u_3)\, ,\]

where \(x, y, z\) are the usual Cartesian coordinates. The curve defined by the intersection of two of the surfaces gives us one of the coordinate curves.

Scale factors

Since we are interested in how these surface intersect each other locally, we want to express differential vectors in terms of the coordinates. Thus, the differential for the position vector (\(\mathbf{r}\)) is given by

\[\mathrm{d}\mathbf{r} = \frac{\partial\mathbf{r}}{\partial u_1}\mathrm{d}u_1 + \frac{\partial\mathbf{r}}{\partial u_2}\mathrm{d}u_2 + \frac{\partial\mathbf{r}}{\partial u_3}\mathrm{d}u_3\, ,\]


\[\mathrm{d}\mathbf{r} = \sum_{i=1}^3 \frac{\partial\mathbf{r}}{\partial u_i}\mathrm{d}u_i\, .\]

The factor \(\partial \mathbf{r}/\partial u_i\) is a non-unitary vector that takes into account the variation of \(\mathbf{r}\) in the direction of \(u_i\), and is then tangent to the coordinate curve \(u_i\). We can define a normalized basis \(\hat{\mathbf{e}}_i\) using

\[\frac{\partial\mathbf{r}}{\partial u_i} = h_i \hat{\mathbf{e}}_i\, .\]

The coefficients \(h_i\) are functions of \(u_i\) and we call them scale factors. They are really important since they allow us to measure distances while we move along our coordinates. We would need them to define vector operators in orthogonal coordinates. When the coordinates are not orthogonal we would need to use the metric tensor, but we are going to restrict ourselves to orthogonal systems.

Hence, we have the following

\[\begin{split}\begin{align} &h_i = \left|\frac{\partial\mathbf{r}}{\partial u_i}\right|\, ,\\ &\hat{\mathbf{e}}_i = \frac{1}{h_i} \frac{\partial \mathbf{r}}{\partial u_i}\, . \end{align}\end{split}\]

Curvilinear coordinates available

The following coordinate systems are available:

  • Cartesian;
  • Cylindrical;
  • Spherical;
  • Parabolic cylindrical;
  • Parabolic;
  • Paraboloidal;
  • Elliptic cylindrical;
  • Oblate spheroidal;
  • Prolate spheroidal;
  • Ellipsoidal;
  • Bipolar cylindrical;
  • Toroidal;
  • Bispherical; and
  • Conical.

To obtain the transformation for a given coordinate system we can use the function vector.transform_coords().

import sympy as sym
from continuum_mechanics import vector

First, we define the variables for the coordinates \((u, v, w)\).

u, v, w = sym.symbols("u v w")

And, we compute the coordinates for the parabolic system using vector.transform_coords(). The first parameter is a string defining the coordinate system and the second is a tuple with the coordinates.

vector.transform_coords("parabolic", (u, v, w))
\[\displaystyle \left( u v \cos{\left(w \right)}, \ u v \sin{\left(w \right)}, \ \frac{u^{2}}{2} - \frac{v^{2}}{2}\right)\]

The scale factors for the coordinate systems mentioned above are availabe. We can compute them for bipolar cylindrical coordinates. The coordinates are defined by

\[\begin{split}\begin{align} &x = a \frac{\sinh\tau}{\cosh\tau - \cos\sigma}\, ,\\ &y = a \frac{\sin\sigma}{\cosh\tau - \cos\sigma}\, ,\\ &z = z\, , \end{align}\end{split}\]

and have the following scale factors

\[h_\sigma = h_\tau = \frac{a}{\cosh\tau - \cos\sigma}\, ,\]

and \(h_z = 1\).

sigma, tau, z, a = sym.symbols("sigma tau z a")
z = sym.symbols("z")
scale = vector.scale_coeff_coords("bipolar_cylindrical", (sigma, tau, z), a=a)
\[\displaystyle \left( \frac{a}{- \cos{\left(\sigma \right)} + \cosh{\left(\tau \right)}}, \ \frac{a}{- \cos{\left(\sigma \right)} + \cosh{\left(\tau \right)}}, \ 1\right)\]

Finally, we can compute vector operators for different coordinates.

The Laplace operator for the bipolar cylindrical system is given by

\[\nabla^2 \phi = \frac{1}{a^2} \left( \cosh \tau - \cos\sigma \right)^{2} \left( \frac{\partial^2 \phi}{\partial \sigma^2} + \frac{\partial^2 \phi}{\partial \tau^2} \right) + \frac{\partial^2 \phi}{\partial z^2}\, ,\]

and we can compute it using the function vector.lap(). For this function, the first parameter is the expression that we want to compute the Laplacian for, the second parameter is a tuple with the coordinates and the third parameter is a tuple with the scale factors.

phi = sym.symbols("phi", cls=sym.Function)
lap = vector.lap(phi(sigma, tau, z), coords=(sigma, tau, z), h_vec=scale)
\[\displaystyle \frac{a^{2} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(\sigma,\tau,z \right)} + \left(\cos{\left(\sigma \right)} - \cosh{\left(\tau \right)}\right)^{2} \frac{\partial^{2}}{\partial \sigma^{2}} \phi{\left(\sigma,\tau,z \right)} + \left(\cos{\left(\sigma \right)} - \cosh{\left(\tau \right)}\right)^{2} \frac{\partial^{2}}{\partial \tau^{2}} \phi{\left(\sigma,\tau,z \right)}}{a^{2}}\]