Skip to main content

Divergence Free Interpolation

Divergence free vector field interpolant for 2D and 3D cases. Described in [1], relies on radial basis functions [2]. The current implementation works as expected, but does not scale well, an improvement would be to implement a multilevel approach [3], but implementing a thinning algorithm [4] proved to be challenging.

3D vector field

Installation

  pip install Divergence-Free-Interpolant

Test case dependecies

  pip install pyvista matplotlib

Basic functionality

Import

  import numpy as np
  import Divergence_Free_Interpolant as dfi

Initialize

  initialized_interpolant = dfi.interpolant(nu = 5, k = 3, dim = 3)

nu - Radial basis function parameter: int, default value 5, in most cases does not have to be changed

k - Radial basis function parameter: int, default value 3, in most cases does not have to be changed

dim - Dimensionality of space to interpolate: int, default value 3, currently only supports 2 and 3, can be expanded indefinitely.

Condition the interpolant

  positions = np.random(3, 10)
  vectorfield = np.random(3, 10)
  initialized_interpolant.condition(positions, vectorfield, support_radius = 0.2, method = 'linsolve')

positions - vector field coordinates: np.ndarray, shape = (dim, N)

vectorfield - vector field values: np.ndarray, shape = (dim, N)

support_radius - kernel radius: float, default value 1

method - method to use for solving the linear system: str, default value linsolve, accepts SVD, penrose, linsolve, lstsq

Interpolate

  x, y, z = 0.3, 0.4, 0.6
  vector = initialized_interpolant(x, y, z)

x - x coordinates at which to interpolate: array_like

y - y coordinates at which to interpolate: array_like

z - z coordinates at which to interpolate: array_like

vector - interoplated vector values at the given points: np.ndarray, shape = (..., dim)

__call__ is vectorized

if dim == 2 will not accept the z component

See tests/test_case_2D.py and tests/test_case_3D.py for more detailed examples.

References

[1] Fuselier, Edward J. “Sobolev-Type Approximation Rates for Divergence-Free and Curl-Free RBF Interpolants.” Mathematics of Computation, vol. 77, no. 263, 2008, pp. 1407–23. http://www.jstor.org/stable/40234564

[2] Wendland, H. Piecewise polynomial, positive definite and compactly supported radial functions of minimal degree. Adv Comput Math 4, 389–396 (1995). https://doi.org/10.1007/BF02123482

[3] Patricio Farrell, Kathryn Gillow, Holger Wendland, Multilevel interpolation of divergence-free vector fields, IMA Journal of Numerical Analysis, Volume 37, Issue 1, January 2017, Pages 332–353, https://doi.org/10.1093/imanum/drw006

[4] Floater M. S. Iske A. Thinning algorithms for scattered data interpolation . BIT , 38 , 705 –720 . (1998)

Metadata

Release files for Divergence-Free-Interpolant 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Divergence-Free-Interpolant 0.1.6
File Size Uploaded
Divergence_Free_Interpolant-0.1.6.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Divergence-Free-Interpolant 0.1.6
File Interpreter ABI Platform
Divergence_Free_Interpolant-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 11.7 kB

Release files / Divergence_Free_Interpolant-0.1.6.tar.gz

Download URL Divergence_Free_Interpolant-0.1.6.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ebb1985757e9ac1ca79a430ee3ebc1fc806f2b7628adecd6dc5e1536c7e4616d
BLAKE2b-256 checksum
How to use checksums
d6be4e10b388ca1e8848c5df3d71f17bde5f73bf6ecdf6d14d93b8edd428f670
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Release files / Divergence_Free_Interpolant-0.1.6-py3-none-any.whl

Download URL Divergence_Free_Interpolant-0.1.6-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1145d6d6f420d1c8af86944c95682d6dd0a71edce0dc4bd61f9eb4e4f25beec
BLAKE2b-256 checksum
How to use checksums
062264fa2e07014618ae850f159de055973bd99f721b084a41f3391c43070ef0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page