# 4.2.2.1 pde.grids.coordinates.base module

class CoordinatesBase[source]

Bases: `object`

Base class for orthonormal coordinate systems

axes: list[str]

name of each coordinate axis

Type:

list

basis_rotation(points)[source]

returns rotation matrix rotating basis vectors to Cartesian coordinates

Parameters:

points (`ndarray`) – Coordinates of the point(s)

Returns:

Rotation matrices for all points. The returnd array has the shape (dim, dim) + points_shape, assuming points has the shape points_shape + (dim,).

Return type:

`ndarray`

cell_volume(c_low, c_high)[source]

calculate the volume between coordinate lines

Parameters:
Returns:

Enclosed volumes for all given cells

Return type:

`ndarray`

coordinate_limits: list[tuple[float, float]]

the limits of each coordinate axis

Type:
dim: int

spatial dimension of the coordinate system

Type:

int

distance(p1, p2)[source]

Calculate the distance between two points

Parameters:
Returns:

Distance between the two positions

Return type:

float

mapping_jacobian(points)[source]

returns the Jacobian matrix of the coordinate mapping

Parameters:

points (`ndarray`) – Coordinates of the point(s)

Returns:

The Jacobian

Return type:

`ndarray`

metric(points)[source]

calculate the metric tensor at coordinate points

Parameters:

points (`ndarray`) – The coordinates of the points

Returns:

Metric tensor at the points

Return type:

`ndarray`

pos_diff(p1, p2)[source]

return Cartesian vector(s) pointing from p1 to p2

Parameters:
Returns:

The difference vectors between the points with periodic boundary conditions applied.

Return type:

`ndarray`

pos_from_cart(points)[source]

convert Cartesian coordinates to coordinates in this system

Parameters:

points (`ndarray`) – Points given in Cartesian coordinates.

Returns:

Points given in the coordinates of this system

Return type:

`ndarray`

pos_to_cart(points)[source]

convert coordinates to Cartesian coordinates

Parameters:

points (`ndarray`) – The coordinates of points in the current coordinate system

Returns:

Cartesian coordinates of the points

Return type:

`ndarray`

scale_factors(points)[source]

calculate the scale factors at various points

Parameters:

points (`ndarray`) – The coordinates of the points

Returns:

Scale factors at the points

Return type:

`ndarray`

vec_to_cart(points, components)[source]

convert the vectors at given points to a Cartesian basis

Parameters:
Returns:

The vectors specified at the same position but with components given in Cartesian coordinates.

Return type:

`ndarray`

volume_factor(points)[source]

calculate the volume factors at various points

Parameters:

points (`ndarray`) – Coordinates of the point(s)

Returns:

Volume factors at the points

Return type:

`ndarray`

exception DimensionError[source]

Bases: `ValueError`

exception indicating that dimensions were inconsistent