differential_geometry.dense_ops.dense_scalar_laplacian#
- differential_geometry.dense_ops.dense_scalar_laplacian(tensor_field: ndarray, Lterm_field: ndarray, inverse_metric_field: ndarray, rank: int, ndim: 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.
- Parameters:
tensor_field (
numpy.ndarray
) – Input tensor field of shape(F1, ..., Fm, ...)
, where the final axes (if any) correspond to tensor indices, and the firstm
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 tensor_field corresponding to its tensor rank.ndim (
int
) – The number of total dimensions in the relevant coordinate system. This determines the maximum allowed value form
and the number of elements in the trailing dimension of the output.*varargs – Grid spacing along each axis. Must match number of spatial axes or derivative axes.
field_axes (
list
ofint
, optional) – Maps each spatial axis of tensor_field to a corresponding coordinate axis. Defaults to [0, 1, …, m-1].derivative_axes (
list
ofint
, 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 shapetensor_field.shape + (ndim,)
.second_derivative_field (
numpy.ndarray
, optional) – Optional precomputed second derivative field of shapetensor_field.shape + (ndim, ndim)
.edge_order (
{1, 2}
, default2
) – Accuracy order of numerical finite differences.
- Returns:
Laplacian of the input tensor field, with shape
tensor_field.shape
.- Return type:
- Raises:
ValueError – If the metric type is not recognized.