Metadata-Version: 2.4
Name: gbmsc-pde
Version: 0.1.1
Summary: PDE solvers using the Grid-Based Multinode Shepard Collocation method.
Author: Anouar El Harrak
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/e-anouar/gbmsc-pde
Project-URL: Repository, https://github.com/e-anouar/gbmsc-pde
Project-URL: Issues, https://github.com/e-anouar/gbmsc-pde/issues
Project-URL: Changelog, https://github.com/e-anouar/gbmsc-pde/blob/main/CHANGELOG.md
Project-URL: Documentation, https://e-anouar.github.io/gbmsc-pde/
Keywords: GBMSC,pde,numerical-methods,approximation,interpolation,Shepard,scientific-computing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23
Requires-Dist: scipy>=1.9
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: ruff>=0.8; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.6; extra == "docs"
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.25; extra == "docs"
Provides-Extra: plot
Requires-Dist: matplotlib>=3.7; extra == "plot"
Provides-Extra: examples
Requires-Dist: matplotlib>=3.7; extra == "examples"
Requires-Dist: jupyter>=1.0; extra == "examples"
Dynamic: license-file

# gbmsc-pde

`gbmsc-pde` is a Python package for solving linear PDEs on two-dimensional
rectangular domains with the **Grid-Based Multinode Shepard Collocation Method
(GBMSC)**.

Version: `0.1.1`

## Method

GBMSC uses a structured source grid, samples local multinode tensor-product
subgrids, builds local Lagrange interpolants on those subgrids, and blends the
local interpolants with Shepard weights.  PDE equations are enforced by
collocation at source nodes, with sparse differential operators assembled from
the blended approximation.

## Features

- Structured 2D source-grid generation.
- Local multinode Lagrange interpolation on sliding subgrids.
- Shepard blending of local approximants.
- Sparse first- and second-derivative operators.
- Linear PDE assembly with diffusion, convection, reaction, and source terms.
- Dirichlet, Neumann, and Robin boundary-condition helpers.
- Direct, CG, and GMRES sparse linear solvers.
- Exact-nodal interpolation mode for source-node reconstruction.

## Installation

Install from a local checkout:

```bash
pip install .
```

For development:

```bash
pip install -e ".[dev]"
```

For documentation tooling:

```bash
pip install -e ".[docs]"
```

For plotting support:

```bash
pip install ".[plot]"
```

## Quick Start

```python
import numpy as np

from gbmsc_pde import (
    BoundaryConditions,
    GBMSCApproximation,
    LinearPDE,
    LinearSolver,
    SourceGrid,
)

grid = SourceGrid(grid_shape=(21, 21), subgrid_shape=(5, 5))
approximation = GBMSCApproximation(grid, step=(4, 4), support_mode="nodal_limit")

pde = LinearPDE(approximation)
pde.add_diffusion_term(-1.0)
pde.add_source_term(lambda x, y: np.ones_like(x))

bcs = BoundaryConditions(grid)
bcs.add_dirichlet(grid.boundary_indices()["all"], 0.0)

u = LinearSolver(pde, bcs).solve()
solution_grid = u.reshape(grid.grid_shape)

grid.plot(solution_grid, view="2d")
```

The step must align with the local subgrid size:

```text
N_x = step_x * k_x + n_x
N_y = step_y * k_y + n_y
```

for integer `k_x` and `k_y`.

## Public API

Preferred names:

```python
from gbmsc_pde import (
    SourceGrid,
    GBMSCApproximation,
    BoundaryConditions,
    LinearPDE,
    LinearSolver,
)
```

New code should use these names consistently: `SourceGrid`,
`GBMSCApproximation`, `BoundaryConditions`, `LinearPDE`, and `LinearSolver`.

## Project Layout

```text
src/
  gbmsc_pde/
    approximation/   GBMSC approximation and interpolation routines
    boundary/        Boundary-condition containers and appliers
    source_grid/     Structured source-grid utilities
    operators/       Sparse differential-operator builders
    pde/             Linear PDE terms and assembly
    solvers/         Linear solvers
```

## Development

Run tests:

```bash
pytest
```

Run lightweight lint checks:

```bash
ruff check src tests examples/gbmsc_pde/*.py
```

Build source and wheel distributions:

```bash
python -m build
```

Check package metadata before uploading:

```bash
twine check dist/*
```

Build the documentation site:

```bash
mkdocs build
```

See `CONTRIBUTING.md` for the full release checklist.

## Contribution Policy

This project is currently not accepting external contributions. Issues and
pull requests may be used by the maintainer for project tracking, but there is
no expectation that external contributions will be reviewed or merged.

## Versioning

This project uses semantic versioning.  The first public release is `0.1.0`.

## Citation

If this package supports academic work, please cite it using the metadata in
`CITATION.cff`.  If you also use the underlying numerical method, cite the
method preprint as described in the documentation citation page.

## License

Distributed under the Apache License 2.0. See `LICENSE`.
