Skip to main content

PDE solvers using the Grid-Based Multinode Shepard Collocation method.

Project description

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.0

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:

pip install .

For development:

pip install -e ".[dev]"

For documentation tooling:

pip install -e ".[docs]"

For plotting support:

pip install ".[plot]"

Quick Start

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:

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:

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

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

Project Layout

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:

pytest

Run lightweight lint checks:

ruff check src tests examples/gbmsc_pde/*.py

Build source and wheel distributions:

python -m build

Check package metadata before uploading:

twine check dist/*

Build the documentation site:

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gbmsc_pde-0.1.0.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gbmsc_pde-0.1.0-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file gbmsc_pde-0.1.0.tar.gz.

File metadata

  • Download URL: gbmsc_pde-0.1.0.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gbmsc_pde-0.1.0.tar.gz
Algorithm Hash digest
SHA256 49e74b2b2789a4e50ab59a1b14e07c2ceef1d2e3051d3439638ea13013db767e
MD5 293608603605d5e096660a1326850766
BLAKE2b-256 365dc1aef585af1850b498e84bb6a16b1d82bbdb38cf52de0cb306c2c2ca1732

See more details on using hashes here.

Provenance

The following attestation bundles were made for gbmsc_pde-0.1.0.tar.gz:

Publisher: publish.yml on e-anouar/gbmsc-pde

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gbmsc_pde-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gbmsc_pde-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gbmsc_pde-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 629a832b7bc820e2a3582143d88521571ffabcc66ecc61d11e3493102a025e49
MD5 40f4cab8a57f12ff510e819a126c4152
BLAKE2b-256 b53f540af209fdb2b678e8b02619db6b807548f790ceafb8aa02abd449277016

See more details on using hashes here.

Provenance

The following attestation bundles were made for gbmsc_pde-0.1.0-py3-none-any.whl:

Publisher: publish.yml on e-anouar/gbmsc-pde

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page