4.3.2.1 pde.grids.coordinates.base module

Base classes for coordinate systems.

CoordinatesBase

Base class for orthonormal coordinate systems.

DimensionError

Exception indicating that dimensions were inconsistent.

class CoordinatesBase[source]

Bases: object

Base class for orthonormal coordinate systems.

basis_rotation(points: FloatingArray) → FloatingArray[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 returned array has the shape (dim, dim) + points_shape, assuming points has the shape points_shape + (dim,).

Return type:

ndarray

cell_volume(c_low: FloatingArray, c_high: FloatingArray) → FloatingArray[source]

Calculate the volume between coordinate lines.

Parameters:
  • c_low (ndarray) – Lower values of the coordinate lines enclosing the volume

  • c_high (ndarray) – Upper values of the coordinate lines enclosing the volume

Returns:

Enclosed volumes for all given cells

Return type:

ndarray

distance(p1: FloatingArray, p2: FloatingArray, *, axis: int = -1) → float[source]

Calculate the distance between two points.

Parameters:
  • p1 (ndarray) – First position

  • p2 (ndarray) – Second position

  • axis (int) – Determines the axis along which the coordinates of the points are given

Returns:

Distance between the two positions

Return type:

float

mapping_jacobian(points: FloatingArray) → FloatingArray[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: FloatingArray) → FloatingArray[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_from_cart(points: FloatingArray, *, axis: int = -1) → FloatingArray[source]

Convert Cartesian coordinates to coordinates in this system.

Parameters:
  • points (ndarray) – Points given in Cartesian coordinates.

  • axis (int) – Determines the axis along which the coordinates of the points are given

Returns:

Points given in the coordinates of this system

Return type:

ndarray

pos_to_cart(points: FloatingArray, *, axis: int = -1) → FloatingArray[source]

Convert coordinates to Cartesian coordinates.

Parameters:
  • points (ndarray) – The coordinates of points in the current coordinate system

  • axis (int) – Determines the axis along which the coordinates of the points are given

Returns:

Cartesian coordinates of the points

Return type:

ndarray

scale_factors(points: FloatingArray) → FloatingArray[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: FloatingArray, components: FloatingArray) → FloatingArray[source]

Convert the vectors at given points to a Cartesian basis.

Parameters:
  • points (ndarray) – The coordinates of the point(s) where the vectors are specified.

  • components (ndarray) – The components of the vectors at the given points

Returns:

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

Return type:

ndarray

volume_factor(points: FloatingArray) → ArrayLike[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.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.