differential_geometry.general_ops.dense_element_wise_laplacian#

differential_geometry.general_ops.dense_element_wise_laplacian(field: ndarray, Lterm_field: ndarray, inverse_metric_field: ndarray, rank: int, *varargs, field_axes: Sequence[int] | None = None, derivative_axes: Sequence[int] | None = None, out: ndarray | None = None, first_derivative_field: ndarray | None = None, second_derivative_field: ndarray | None = None, edge_order: Literal[1, 2] = 2) ndarray[source]#

Compute the Laplacian (Laplace-Beltrami operator) of a tensor field in a general curvilinear coordinate system, using either a full or diagonal inverse metric.

This function implements:

\[\Delta T = F^\mu \, \partial_\mu T + g^{\mu\nu} \, \partial_\mu \partial_\nu T\]

and dispatches to the appropriate low-level method depending on the shape of the inverse metric.

Note

This is a very thin wrapper around dense_scalar_laplacian() with the sole intent of providing a “general” alias for the operation. This function does have a slightly different signature as it allows for inference of ndim.

Parameters:
  • field (numpy.ndarray) – Input tensor field of shape (F1, ..., Fm, ...), where the final axes (if any) correspond to tensor indices, and the first m axes are spatial.

  • Lterm_field (numpy.ndarray) – Log-volume term array of shape (..., ndim), where the last axis matches the number of coordinate directions.

  • inverse_metric_field (numpy.ndarray) – Either a diagonal inverse metric (shape (..., ndim)) or a full tensor (shape (..., ndim, ndim)).

  • rank (int) – Number of trailing axes of field corresponding to its tensor rank.

  • *varargs – Grid spacing along each axis. Must match number of spatial axes or derivative axes.

  • field_axes (list of int, optional) – Maps each spatial axis of field to a corresponding coordinate axis. Defaults to [0, 1, …, m-1].

  • derivative_axes (list of int, optional) – Subset of axes over which derivatives are taken. Defaults to field_axes.

  • out (numpy.ndarray, optional) – Output buffer to store result. Must be broadcast-compatible with spatial shape of inputs.

  • first_derivative_field (numpy.ndarray, optional) – Optional precomputed first derivative field of shape field.shape + (ndim,).

  • second_derivative_field (numpy.ndarray, optional) – Optional precomputed second derivative field of shape field.shape + (ndim, ndim).

  • edge_order ({1, 2}, default 2) – Accuracy order of numerical finite differences.

Returns:

Laplacian of the input tensor field, with shape field.shape.

Return type:

numpy.ndarray

Raises:

ValueError – If the metric type is not recognized.