Metadata-Version: 2.4
Name: numgrids
Version: 0.6.1
Summary: Working with numerical grids made easy.
Author-email: Matthias Baer <matthias.r.baer@googlemail.com>
License: MIT
Project-URL: Homepage, https://github.com/maroba/numgrids
Project-URL: Documentation, https://maroba.github.io/numgrids/
Project-URL: Repository, https://github.com/maroba/numgrids
Project-URL: Issues, https://github.com/maroba/numgrids/issues
Project-URL: Changelog, https://maroba.github.io/numgrids/dev/changelog.html
Keywords: numerical grids,spectral methods,finite differences,chebyshev,pde,differential equations,curvilinear coordinates,scientific computing
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.22
Requires-Dist: scipy>=1.11
Requires-Dist: findiff>=0.10
Provides-Extra: plot
Requires-Dist: matplotlib>=3.5; extra == "plot"
Provides-Extra: xarray
Requires-Dist: xarray>=2023.1; extra == "xarray"
Provides-Extra: all
Requires-Dist: numgrids[plot,xarray]; extra == "all"
Provides-Extra: test
Requires-Dist: numgrids[all]; extra == "test"
Requires-Dist: pytest>=7; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: netCDF4; extra == "test"
Provides-Extra: docs
Requires-Dist: numgrids[all]; extra == "docs"
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: furo; extra == "docs"
Requires-Dist: sphinx-design; extra == "docs"
Requires-Dist: myst-parser; extra == "docs"
Requires-Dist: nbsphinx; extra == "docs"
Requires-Dist: ipython; extra == "docs"
Requires-Dist: ipykernel; extra == "docs"
Provides-Extra: dev
Requires-Dist: numgrids[docs,test]; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Dynamic: license-file

<h1 align="center">numgrids</h1>

<p align="center"><b>Numerical grids, spectral derivatives and PDE solvers in a few lines of NumPy-friendly Python.</b></p>

<p align="center">
  <img src="https://raw.githubusercontent.com/maroba/numgrids/main/docs/assets/hero.png" width="100%" alt="A vibration mode of a circular drum, an eigenfunction of the Laplacian on the sphere, and the eigenstates of the quantum harmonic oscillator">
</p>

Setting up grids, differentiation matrices, boundary conditions and coordinate
transformations by hand is tedious and error-prone. *numgrids* handles all of
this, so you can focus on the physics or mathematics of your problem.

## numgrids in 30 seconds

What are the vibration frequencies of a circular drum? They are the square roots of the
eigenvalues of the Laplacian on a disk, with the rim clamped:

```python
from numgrids import *

drum = PolarGrid(radial(30, 1.0), periodic(40))     # the full disk, including its center
eigenvalues, modes = (-drum.laplacian_operator()).eig(k=6, bcs=0)

print(eigenvalues ** 0.5)
# [2.40482556 3.83170597 3.83170597 5.1356223  5.1356223  5.52007811]
```

These are the zeros of the Bessel functions, correct to 13 digits on a 30 × 40 grid.

## Features

- **Grids and coordinates**: Chebyshev, equidistant, periodic and logarithmic axes in any dimension;
  polar, cylindrical, spherical (volume and surface), elliptic and spheroidal coordinates, or your own;
  full disks, cylinders, spheres and balls without coordinate singularities
- **Calculus**: spectral (FFT, Chebyshev) or finite-difference derivatives; gradient, divergence, curl,
  Laplacian; volume and surface integrals; spectral interpolation
- **Solving equations**: operator algebra, `solve()` for boundary value problems, `eig()` for eigenvalue
  problems, Dirichlet/Neumann/Robin conditions in one line, time evolution (method of lines)
- **Tools**: adaptive mesh refinement, convergence studies, plotting, save/load, xarray/NetCDF;
  all operators export SciPy sparse matrices

## Installation

```shell
pip install numgrids
```

Optional extras: `numgrids[plot]` (matplotlib), `numgrids[xarray]` (xarray), or `numgrids[all]`.

## Learn more

- Documentation, user guide and API reference: **[maroba.github.io/numgrids](https://maroba.github.io/numgrids/)**
- Example notebooks: [maroba.github.io/numgrids/examples](https://maroba.github.io/numgrids/examples/operators-and-solvers.html)
- Source code and issues: [github.com/maroba/numgrids](https://github.com/maroba/numgrids)
