pg_utils.sympy_supp.vector_calculus_3d.SphericalCoordinates
- class pg_utils.sympy_supp.vector_calculus_3d.SphericalCoordinates(r, t, p, r_name='r', t_name='t', p_name='p')[source]
Bases:
OrthogonalCoordinates3D
Spherical coordinate system in 3D
Example: define a spherical coordinate system. The default names for the coordinates are r (radius), t (colatitude) and p (azimuth):
>>> x1, x2, x3 = sympy.symbols("x_1 x_2 x_3") >>> sph3d = SphericalCoordinates3D(x1, x2, x3) >>> sph3d.r # Invoking the radial coordinate x_1 >>> sph3d.p # Invoking the azimuthal coordinate x_3
You can also pass in additional names to name the coordinates:
>>> sph3d = SphericalCoordinates3D(x1, x2, x3, r_name="x1") >>> sph3d.x1 # Invoking the radial coordinate x_1 >>> sph3d.p # Invoking the azimuthal coordinate x_3
It also supports indexing:
>>> sph3d[1] x_2
Methods
__init__
(r, t, p[, r_name, t_name, p_name])curl
(vector_in, **kwargs)Vector curl, to be implemented
div
(vector_in, **kwargs)Compute the divergence of a vector in spherical coordinates
grad
(scalar_in, **kwargs)Scalar gradient, to be implemented
laplacian
(tensor_in[, rank])Tensor Laplacian, to be implemented
surface_div
(vector_in, **kwargs)Compute the surface divergence of a 2-D vector in spherical coordinates
surface_grad
(scalar_in, **kwargs)Surface gradient, to be implemented
transform_to
(v_in, new_sys[, coeffs_new])Attributes
Setter/getter interface for the coordinates, indexable
- div(vector_in, **kwargs)[source]
Compute the divergence of a vector in spherical coordinates
- Parameters:
vector_in (array-like) – input vector, assumed to be 3-component array, with sympy.Expr as components
**kwargs – additional arguments passed to
sympy.diff
- Returns:
divergence scalar, sympy.Expr
- surface_div(vector_in, **kwargs)[source]
Compute the surface divergence of a 2-D vector in spherical coordinates
- Parameters:
vector_in (array-like) – input vector, assumed to be 2-component array, with sympy.Expr as components. These are assumed to be colatitudal (theta) and azimuthal (phi) components of a vector field.
**kwargs – additional arguments passed to
sympy.diff
- Returns:
surface divergence, sympy.Expr