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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebb1985757e9ac1ca79a430ee3ebc1fc806f2b7628adecd6dc5e1536c7e4616d |
|
MD5 | 6668b6a4b1e02333b703946c9a3224c1 |
|
BLAKE2b-256 | d6be4e10b388ca1e8848c5df3d71f17bde5f73bf6ecdf6d14d93b8edd428f670 |
Hashes for Divergence_Free_Interpolant-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1145d6d6f420d1c8af86944c95682d6dd0a71edce0dc4bd61f9eb4e4f25beec |
|
MD5 | 805a40e9d69f0b29a5c9cbeec9b7d19e |
|
BLAKE2b-256 | 062264fa2e07014618ae850f159de055973bd99f721b084a41f3391c43070ef0 |