pencil.math.integration

Contains methods for integrating quantities in different coordinate systems.

Functions

integrate(quantity[, dx, dy, dz, x, y, z, ...])

integrate(quantity, dx=1.0, dy=1.0, dz=1.0, x=None, y=None, z=None,

Module Contents

pencil.math.integration.integrate(quantity, dx=1.0, dy=1.0, dz=1.0, x=None, y=None, z=None, coordinate_system='cartesian', axis=(0, 1, 2))
integrate(quantity, dx=1.0, dy=1.0, dz=1.0, x=None, y=None, z=None,

coordinate_system=’cartesian’, axis=[0, 1, 2])

Integrate a field along axis ‘axis’ using the trapezoidal rule. Works for Cartesian, cylindrical and spherical coordinates. Works with non-uniform grids.

Parameters:
  • quantity (ndarray) – Quantity to be integrated over of shape [nz, ny, nx].

  • dx (floats) – Grid spacing in the three dimensions. Not needed when x, y, z are specified.

  • dy (floats) – Grid spacing in the three dimensions. Not needed when x, y, z are specified.

  • dz (floats) – Grid spacing in the three dimensions. Not needed when x, y, z are specified.

  • x (ndarrays) – Radial (x), polar (y) and vertical (z) coordinates, 1d arrays. These override dx, dy and dz. Can be non-uniform grids.

  • y (ndarrays) – Radial (x), polar (y) and vertical (z) coordinates, 1d arrays. These override dx, dy and dz. Can be non-uniform grids.

  • z (ndarrays) – Radial (x), polar (y) and vertical (z) coordinates, 1d arrays. These override dx, dy and dz. Can be non-uniform grids.

  • coordinate_system (string) – Coordinate system under which to take the divergence. Takes ‘cartesian’, ‘cylindrical’ and ‘spherical’.

  • axis (list of int) – Axis along which to integrate.