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

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.1.tar.gz (62.3 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.1-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gbmsc_pde-0.1.1.tar.gz
  • Upload date:
  • Size: 62.3 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.1.tar.gz
Algorithm Hash digest
SHA256 32bc9f7bd44d575860db48b4afc4530d2008b3860f5eb692f185a701abab6aa5
MD5 86b610d795c06fe5bc92d9aa80ead063
BLAKE2b-256 05e5a64a55e69f146e58c977ae25082a175ee4ff8d23332b3df1fa8582f10232

See more details on using hashes here.

Provenance

The following attestation bundles were made for gbmsc_pde-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: gbmsc_pde-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37d3c222f4af0fad45a10d5ba6c13aed45c986d5d3812f6867d7308ab5fbf3a4
MD5 5f8ff6d76f459b899f48e25df378cfa2
BLAKE2b-256 6083ef7dc8f657cc9d5bb02fcbc4babb2559781aac8ef0f525f8070085f50122

See more details on using hashes here.

Provenance

The following attestation bundles were made for gbmsc_pde-0.1.1-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