Skip to main content

Module vector_calculus

Module vector_calculus 

Source
Expand description

Differential operators on volume fields: gradient, divergence, curl, Laplacians, and time derivatives.

Spatial derivatives are taken along each native axis with Lagrange stencils (five points, fourth order, when an axis has at least five samples, otherwise three; any spacing; wrapping on periodic axes; shifted inside the axis near the ends of bounded ones), and combined into Cartesian derivatives through the local frame and scale factors, ∂/∂x_j = Σ_a (û_a)_j / h_a ∂/∂u_a, which is the curvilinear formula applied to the smooth Cartesian components. Results on samples where a scale factor vanishes (r = 0, ρ = 0, or a pole inside a spherical shell) are undefined and returned as NaN. Gradients and curls are returned in the linear basis of the domain’s coordinate system; use to_basis for another.

These operators need volume domains with at least two samples per axis; surface fields have no full 3D derivatives.

See the book entry Fields on grids.

Traits§

FieldScalar
Values the operators work on: real (time domain) or complex (harmonic).