Divergence free interpolant for 2D and 3D systems
Project description
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.
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for Divergence_Free_Interpolant-0.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c6e4a6ed2add3a1a4bacc9196c94d25978cdce586564302b11a54df692b9f26 |
|
MD5 | 8b674089e143626f86fa3e762705fbe7 |
|
BLAKE2b-256 | e90b51e5a184ae9c73ee3597af80377ac972622815418d8a2e94d3bc7bbf44c0 |
Hashes for Divergence_Free_Interpolant-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0df81d9dad07d39225d63fa806804a8d84fc0eb7efa66941f33621599604de1f |
|
MD5 | 0df8a35b9b0c62d0693a54367c5141db |
|
BLAKE2b-256 | 422447cd05d4570847b593d8f3f392fbef7e951e63d89f87aede5c941cb37506 |