High-order meshfree numerics, from sampled geometry to PDE solution.
kernelpack-matlab is the MATLAB implementation of the
KernelPack numerical toolkit. Its
purpose is to make modern meshfree methods usable as a coherent computational
stack: represent an irregular geometry, generate a well-spaced point cloud,
construct polynomially augmented local operators, and solve PDEs on fixed or
evolving domains and surfaces.
The library consolidates a broader research program in node generation, geometric modeling, RBF-FD, partition-of-unity methods, stabilization, and PDEs on moving geometries. MATLAB serves as the most transparent implementation for studying, modifying, and extending those algorithms.
Approach | Capabilities | Install | Quick start | Workflows | Examples | Verification | Papers
KernelPack organizes a meshfree discretization into reusable numerical layers:
- Geometry. Fit smooth or piecewise-smooth models to sampled boundaries and surfaces; evaluate positions, normals, projections, and level sets.
- Nodes. Generate quasi-uniform or variable-density Poisson point clouds, then classify interior, boundary, ghost, and dual nodes from the geometry.
- Approximation. Combine lower odd-degree polyharmonic splines with centered and scaled polynomial reproduction to build local RBF-FD, overlapped RBF-FD, weighted-least-squares, PU, and interpolation operators.
- PDEs. Reuse the same domain descriptors and local approximation tools in elliptic, parabolic, advection-diffusion-reaction, and surface solvers.
- Evolution. Update geometry, point clouds, operators, stabilization, and solution histories when a domain or manifold moves.
The result is a path from scattered geometric data to high-order PDE solvers without constructing a conforming volume mesh.
The repositories are sibling implementations of the same numerical ideas, not language bindings and not exact API replicas.
| Implementation | Best suited for | Computational model |
|---|---|---|
| MATLAB (this repository) | Numerical-method development, transparent research prototypes, convergence studies, and publication workflows | MATLAB sparse linear algebra, vectorized kernels, and optional parfor assembly |
kernelpack-python |
Conventional scientific-Python applications and CPU workflows | NumPy/SciPy with Numba-compiled local kernels |
kernelpack-jax |
Accelerator execution, batched studies, and fixed-topology differentiable computation | JAX jit/vmap kernels with optional Warp spatial primitives |
All three follow the same geometry -> nodes -> operators -> solvers architecture. Features may arrive in one implementation before the others.
| Layer | MATLAB implementation |
|---|---|
| Geometry | Smooth and piecewise-smooth embedded geometry, PHS fits, RBF level sets, projections, normals, parametric spherical and toroidal SBF models, and externally supplied material trajectories |
| Nodes and domains | Fixed- and variable-radius Poisson sampling, level-set clipping, boundary refinement, interior/boundary/ghost bookkeeping, dual node sets, and KD-tree search |
| Polynomial tools | Tensor-product Jacobi and Legendre recurrences, total-degree and hyperbolic-cross index sets, and centered/scaled multivariate polynomial bases |
| Local approximation | Standard and overlapped PHS+poly RBF-FD, cross-node operators, weighted least squares, localized PU approximation, and scalar or divergence-free interpolation |
| Fixed-domain PDEs | Poisson, variable-coefficient Poisson, BDF1--BDF3 diffusion, scalar PU diffusion, and multispecies PU diffusion |
| Moving-domain PDEs | Semi-Lagrangian BDF1--BDF3 advection-diffusion-reaction with evolving embedded boundaries, carve/refill node updates, and selective operator reconstruction |
| Surface PDEs | Tangent-plane RBF-FD on stationary and moving manifolds, defect-corrected operator updates, surface hyperviscosity, geometry-based quadrature, conservation projection, marker rearrangement, and history backfill |
| Geometric evolution | Mean-curvature flow and interpolation of externally generated material-surface trajectories |
The primary namespaces are kp.geometry, kp.nodes, kp.domain, kp.poly,
kp.rbffd, kp.divfree, kp.manifold, and kp.solvers.
kp.geometry.triangulateClosedSurface is a visualization helper; the PDE
operators themselves remain meshfree. kp.solvers.MeshfreeGeometricMultilevelSolver
currently preserves the MGM configuration interface, but the executable
hierarchy and V-cycle are not part of this public release.
- MATLAB R2022b or newer
- Statistics and Machine Learning Toolbox for KD-tree searches
- Parallel Computing Toolbox is optional; parallel-capable routines fall back to serial execution when it is unavailable
export_figis optional and used only by publication-figure scripts
The core package has no required third-party MATLAB runtime dependency. The fluid-driven membrane example uses an optional IBAMR trajectory dataset from a separate release asset.
Clone the repository and add its root to the MATLAB path:
git clone https://github.com/VarShankar/kernelpack-matlab.gitaddpath('path/to/kernelpack-matlab')The repository is also a MIP package:
eval(webread('https://mip.sh/install.txt'))
mip install https://github.com/VarShankar/kernelpack-matlab
mip load kernelpack_matlab
mip test kernelpack_matlabThe following example samples a disk, builds a meshfree domain, and solves
t = linspace(0, 2*pi, 201).';
t(end) = [];
surface = kp.geometry.EmbeddedSurface();
surface.setDataSites([cos(t), sin(t)]);
surface.buildClosedGeometricModelPS(2, 0.08, numel(t));
surface.buildLevelSetFromGeometricModel([]);
generator = kp.nodes.DomainNodeGenerator();
domain = generator.buildDomainDescriptorFromGeometry(surface, 0.08, ...
'Seed', 17, 'StripCount', 5);
solver = kp.solvers.PoissonSolver( ...
'LapAssembler', 'fd', 'BCAssembler', 'fd', ...
'LapStencil', 'rbf', 'BCStencil', 'rbf');
solver.init(domain, 4);
result = solver.solve( ...
@(X) 4 * ones(size(X, 1), 1), ...
@(X) zeros(size(X, 1), 1), ...
@(X) ones(size(X, 1), 1), ...
@(neu, dir, normals, Xb) zeros(size(Xb, 1), 1));
X = domain.getIntBdryNodes();
tri = delaunay(X(:, 1), X(:, 2));
trisurf(tri, X(:, 1), X(:, 2), result.u, result.u);
shading interp;
view(2);
axis equal tight;
colorbar;A DomainDescriptor separates geometry and node generation from the PDE. The
same descriptor can feed standard or overlapped RBF-FD and weighted-least-
squares operators, making discretization choices replaceable without changing
boundary construction. The fixed-domain solvers support Dirichlet, Neumann,
and mixed boundary rows; diffusion solvers reuse time-independent sparse
operators through BDF1, BDF2, or BDF3 stepping.
run('examples/poisson_solver_example.m')
run('examples/variable_poisson_solver_example.m')
run('examples/diffusion_solver_example.m')kp.solvers.MovingDomainADRSolver advances advection-diffusion-reaction
problems on domains with moving embedded boundaries. Lagrangian boundary
markers are advanced with RK3; cached SBF models reconstruct the boundaries;
the background cloud is carved and refilled; and local interpolation supplies
semi-Lagrangian BDF history values. Diffusion and reaction are implicit, while
RBF-FD and interpolation records are retained away from the changing geometry.
The same implementation supports the public two- and three-dimensional
examples.
run('examples/moving_domain_adr_example.m')
moving_domain_adr_convergence_2d_2021;
moving_domain_adr_convergence_3d_xi4;The manifold package constructs target-centered tangent-plane PHS+Legendre RBF-FD operators. It supports stationary-surface ADR, conservative transport on prescribed moving surfaces, operator updates by direct solves or defect correction, adaptive hyperviscosity, SBF or PCA normals, geometry-derived quadrature, conservation projection, marker rearrangement, and semi-Lagrangian reconstruction of multistep history. The same local operators also drive mean-curvature flow.
stationary_surface_adr_tp_convergence_study;
moving_surface_adr_tp_convergence_study;
mean_curvature_flow_ellipsoid_example;The fluid-driven biconcave-membrane example is one demanding application of
this general surface machinery. Its IBAMR trajectory is distributed in the
data-v1 release
and can be installed with download_rbc_capstone_data.
kp.divfree provides global and local divergence-free PHS+polynomial
interpolation. The shared polynomial, stencil, and search layers can also be
used directly for scattered-data approximation and custom differential
operators without adopting a packaged PDE solver.
Complete workflows live in examples. Useful entry points are:
| Goal | Example |
|---|---|
| Inspect geometry construction | geometry_examples.m |
| Generate and classify domain nodes | nodes_examples.m |
| Solve Poisson in two or three dimensions | poisson_solver_example.m, poisson_solver_example_3d.m |
| Solve a variable-coefficient elliptic problem | variable_poisson_solver_example.m |
| Advance BDF diffusion | diffusion_solver_example.m |
| Compare PU diffusion formulations | pu_diffusion_convergence_2d.m, multispecies_pu_diffusion_convergence_2d.m |
| Build a divergence-free interpolant | divfree_interp_example.m |
| Solve moving-domain ADR | moving_domain_adr_example.m |
| Verify stationary and moving surface ADR | stationary_surface_adr_tp_convergence_study.m, moving_surface_adr_tp_convergence_study.m |
| Evolve a surface by mean curvature | mean_curvature_flow_sphere_example.m, mean_curvature_flow_ellipsoid_example.m |
| Study marker rearrangement and history backfill | moving_surface_adr_tp_spheroid_rearrangement_study.m |
| Replay transport on an IBAMR membrane trajectory | moving_surface_adr_tp_rbc_capstone.m |
Run the public verification suite from the repository root:
addpath(pwd);
addpath(fullfile(pwd, 'tests'));
run_public_checks;Data-dependent membrane checks run separately after downloading the release asset:
ibamr_surface_trajectory_checks;
moving_surface_rbc_capstone_checks;The public suite also runs in GitHub Actions on every push and pull request.
KernelPack consolidates methods developed across several publications. Cite
the software using CITATION.cff, and cite the papers that
correspond to the components used in your work.
| Component | Publication |
|---|---|
| Surface RBF-FD | V. Shankar, G. B. Wright, R. M. Kirby, and A. L. Fogelson, A radial basis function (RBF)-finite difference (FD) method for diffusion and reaction-diffusion equations on surfaces, Journal of Scientific Computing 63 (2015), 745--768 |
| Overlapped RBF-FD | V. Shankar, The overlapped radial basis function-finite difference (RBF-FD) method: A generalization of RBF-FD, Journal of Computational Physics 342 (2017), 211--228 |
| Geometric models and Poisson node generation | V. Shankar, R. M. Kirby, and A. L. Fogelson, Robust node generation for mesh-free discretizations on irregular domains and surfaces, SIAM Journal on Scientific Computing 40 (2018), A2584--A2608 |
| Bulk hyperviscosity and PHS-degree selection | V. Shankar and A. L. Fogelson, Hyperviscosity-based stabilization for radial basis function-finite difference (RBF-FD) discretizations of advection-diffusion equations, Journal of Computational Physics 372 (2018), 616--639 |
| Surface hyperviscosity | V. Shankar, G. B. Wright, and A. Narayan, A robust hyperviscosity formulation for stable RBF-FD discretizations of advection-diffusion-reaction equations on manifolds, SIAM Journal on Scientific Computing 42 (2020), A2371--A2401 |
| Moving-domain ADR and matrix updates | V. Shankar, G. B. Wright, and A. L. Fogelson, An efficient high-order meshless method for advection-diffusion equations on time-varying irregular domains, Journal of Computational Physics 445 (2021), 110633 |
| Lagrangian-Eulerian moving-surface ADR | M. Lowery, G. B. Wright, and V. Shankar, A high-order, meshless, Lagrangian--Eulerian RBF-FD method for advection--diffusion--reaction on moving manifolds, arXiv:2608.19384 (2026) |
KernelPack is research software. The public API is usable and tested, but the
project is still evolving and may change as methods are consolidated across
the C++, MATLAB, Python, and JAX implementations. Bug reports, focused pull
requests, and reproducible numerical examples are welcome; see
CONTRIBUTING.md and SECURITY.md.
kernelpack-matlab is released under the BSD 3-Clause License,
which permits academic and commercial use, modification, and redistribution
subject to its terms.




