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
These functions should be invertible, at least locally, and we can also write
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
or
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
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
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)\).
sym.init_printing()
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))
The scale factors for the coordinate systems mentioned above are availabe. We can compute them for bipolar cylindrical coordinates. The coordinates are defined by
and have the following scale factors
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)
scale
Finally, we can compute vector operators for different coordinates.
The Laplace operator for the bipolar cylindrical system is given by
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)
sym.simplify(lap)