DenseMathOpsMixin#

class grids.mixins.mathops.DenseMathOpsMixin[source]#

Mixin class for dense differential geometry operations on structured grids.

This class provides high-level numerical implementations of common differential geometry operators—such as gradients, divergence, and Laplacians—on fields defined over structured grids with curvilinear coordinate systems.

It serves as a convenience interface to the low-level functions in differential_geometry, managing:

  • Axis labeling and broadcasting between tensor fields and grid domains.

  • Automatic handling of coordinate expressions like metric tensors and volume terms.

  • Support for lazy-loading or memory-intensive buffers through optional chunked execution.

  • Compatibility with ghost zones and progress bars.

Methods

__init__()

compute_function_on_grid(func, /[, ...])

Evaluate a coordinate-based function over the grid domain.

dense_adjust_tensor_signature(tensor_field, ...)

Adjust the index signature of a tensor field by raising or lowering multiple indices.

dense_contract_with_metric(tensor_field, ...)

Contract a tensor index with the metric tensor or its inverse.

dense_contravariant_gradient(tensor_field, ...)

Compute the contravariant gradient of a dense-representation tensor field on a grid.

dense_covariant_gradient(tensor_field, ...)

Compute the covariant gradient of a dense-representation tensor field on a grid.

dense_element_wise_laplacian(field, ...[, ...])

Compute the element-wise Laplacian of an array-valued field on the grid.

dense_element_wise_partial_derivatives(...)

Compute the element-wise partial derivatives of an array-valued field over the grid.

dense_gradient(tensor_field, field_axes, /)

Compute the element-wise gradient of a tensor field over a grid.

dense_lower_index(tensor_field, field_axes, ...)

Lower a single contravariant index of a tensor field.

dense_raise_index(tensor_field, field_axes, ...)

Raise a single covariant index of a tensor field.

dense_scalar_laplacian(field, field_axes, /)

Compute the element-wise Laplacian of a tensor field.

dense_vector_divergence(vector_field, ...[, ...])

Compute the divergence of a vector field, with automatic basis dispatching.

dense_vector_divergence_contravariant(...[, ...])

Compute the divergence of a contravariant vector field on a grid.

dense_vector_divergence_covariant(...[, ...])

Compute the divergence of a covariant vector field on a grid.