astronomix._spatial_operators._differencing

astronomix._spatial_operators._differencing#

High-order finite-difference operators on interface-defined fields.

Provides the 6th-order interface-to-centre derivative used by the finite-difference (constrained-transport) backend and the magnetic-field divergence built from it.

Module Contents#

Functions#

finite_difference_int6

High-order FD derivative, assumed f defined at interfaces, and the i-th index corresponds to the i+1/2 interface.

API#

astronomix._spatial_operators._differencing.finite_difference_int6(f_int, axis)[source]#

High-order FD derivative, assumed f defined at interfaces, and the i-th index corresponds to the i+1/2 interface.

The finite difference formula is:
df/dx at i = c1 * (f_{i+1/2} - f_{i-1/2})
  • c2 * (f_{i+3/2} - f_{i-3/2})

  • c3 * (f_{i+5/2} - f_{i-5/2})

Note that the i+1/2 interface corresponds to index i in the array.

6th order: c1 = 75/64, c2 = -25/384, c3 = 3/640 4th order: c1 = 9/8, c2 = -1/24, c3 = 0