Skip to content

gbmsc_pde Documentation

gbmsc_pde solves linear PDEs on two-dimensional rectangular tensor-product source grids using the Grid-Based Multinode Shepard Collocation Method.

The package is organized around six public components:

For a short method overview, see rectangular_method.md. For software and method citation guidance, see citation.md.

Basic Workflow

import numpy as np

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

grid = SourceGrid(grid_shape=(31, 31), subgrid_shape=(5, 5))
approximation = GBMSCApproximation(grid, step=(2, 2), support_mode="nodal_limit")

pde = LinearPDE(approximation)
pde.add_diffusion_term(-1.0)
pde.add_source_term(lambda x, y: 2.0 * np.pi**2 * np.sin(np.pi * x) * np.sin(np.pi * y))

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

solution = LinearSolver(pde, boundary_conditions).solve()

Data Ordering

All source-node vectors use the flattened order of grid.coords, consistent with NumPy row-major flattening of arrays with shape grid.grid_shape.

solution_grid = solution.reshape(grid.grid_shape)

For rectangular LinearPDE rows, collocation points are source grid points. The recommended mode for new experiments is:

support_mode="nodal_limit"

This mode evaluates the source-node limiting Shepard formula by cancelling the common singular factor shared by active subgrids. The modes "active" and "all" are available for compatibility and comparison.

API Reference

See api.md for generated API documentation.