pg_utils.sympy_supp.vector_calculus_3d.OrthogonalCoordinates3D

class pg_utils.sympy_supp.vector_calculus_3d.OrthogonalCoordinates3D(x1, x2, x3, x1_name=None, x2_name=None, x3_name=None)[source]

Bases: object

Base class for orthogonal curvilinear coordinates in 3D

Example: define a Cartesian system:

x, y, z = sympy.symbols("x y z")
cart3d = OrthogonalCoordinates3D(x, y, z, x1_name='x', x2_name='y', x3_name='z')

OrthogonalCoordinates3D implements indexing. The coordinates can be retrieved in two different ways (following last example):

>>> cart3d.y    # invoking coordinate by name
y
>>> cart3d[1]   # invoking coordinate by index
y

Computational utilities of OrthogonalCoordinates3D, such as grad, curl etc., are all abstract methods; therefore, the class is intended to be inherited and used, instead of being used directly.

__init__(x1, x2, x3, x1_name=None, x2_name=None, x3_name=None) None[source]

Constructor

Parameters:
  • x1 (sympy.Symbol) – first coordinate

  • x2 (sympy.Symbol) – second coordinate

  • x3 (sympy.Symbol) – third coordinate

  • x1_name (str) – optional name for x1; if given, the attribute will be named by x1_name; else, the attribute will be named “x1”.

  • x2_name (str) – see x1_name

  • x3_name (str) – see x1_name

Methods

__init__(x1, x2, x3[, x1_name, x2_name, x3_name])

Constructor

curl(vector_in, **kwargs)

Compute curl/rot of a vector

div(vector_in, **kwargs)

Compute divergence of a vector

grad(scalar_in, **kwargs)

Compute gradient of a scalar

laplacian(tensor_in[, rank])

Compute Laplacian of a tensor

transform_to(tensor_in, new_sys[, coeffs_new])

Transform to other coordinate systems

Attributes

coords

Setter/getter interface for the coordinates, indexable

property coords[source]

Setter/getter interface for the coordinates, indexable

curl(vector_in, **kwargs)[source]

Compute curl/rot of a vector

abstract method, to be overriden

div(vector_in, **kwargs)[source]

Compute divergence of a vector

abstract method, to be overriden

grad(scalar_in, **kwargs)[source]

Compute gradient of a scalar

abstract method, to be overriden

laplacian(tensor_in, rank=0, **kwargs)[source]

Compute Laplacian of a tensor

abstract method, to be overriden

transform_to(tensor_in, new_sys: OrthogonalCoordinates3D, coeffs_new=False)[source]

Transform to other coordinate systems

abstract method, to be overriden