This project provides GPU-accelerated solutions to the 2D Poisson equation using the Finite Pointset Method (FPM) — a meshfree Lagrangian method well-suited for complex geometries and evolving domains.
Implemented in Python using Jupyter notebooks, and accelerated with CuPy for NVIDIA GPUs (CUDA 12.x), the solvers cover:
- 🔴
dirichlet.ipynb
— Dirichlet boundary conditions on all sides - 🔵
neumann.ipynb
— Neumann boundary conditions on all sides - 🟡
mixed.ipynb
— Mixed Dirichlet and Neumann conditions
The solution domain is discretized using a meshfree point cloud, and the Laplacian operator in the Poisson equation is approximated via a second-order Taylor expansion fitted with Gaussian-weighted least squares over local neighbors.
- Discretization: Irregular point cloud on a unit square domain
- Laplacian Approximation: Based on Taylor expansion + weighted least squares
- Weight Function: Gaussian kernel with compact support
- Boundary Conditions: Imposed directly by adjusting the local minimization system
- Solver: Dense GPU-based system solve using
cp.linalg.solve()
- Output: Visualized as 2D heatmaps or 3D surfaces using
matplotlib
This approach leverages CuPy's GPU parallelism to significantly reduce solve time compared to CPU-based methods like NumPy or SciPy.
poisson_equation/ ├── dirichlet.ipynb # Poisson solver with Dirichlet BCs ├── neumann.ipynb # Poisson solver with Neumann BCs ├── mixed.ipynb # Poisson solver with Mixed BCs ├── environment.yml # Conda environment (includes CuPy) ├── requirements.txt # pip alternative for non-conda users └── README.md # This file
⚠️ Requires Anaconda and a CUDA-enabled GPU (with CUDA 12.x drivers).
git clone https://github.com/nsreelekha/poisson_equation.git
cd poisson_equation
conda env create -f environment.yml
conda activate cupy129env
python -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
pip install -r requirements.txt
You can run the notebooks using Jupyter.
jupyter notebook
Then open any of the following:
-
📘 dirichlet.ipynb — fixed boundary values
-
📘 neumann.ipynb — derivative (flux) conditions
-
📘 mixed.ipynb — combination of Dirichlet and Neumann BCs
Each notebook will:
-
✅ Assemble a grid
-
✅ Set up boundary conditions
-
✅ Solve the 2D Poisson equation on the GPU using CuPy
-
✅ Visualize the solution using Matplotlib
All dependencies are managed via Conda or requirements.txt
- cupy-cuda12x — GPU array library (NumPy-compatible)
- numpy, scipy, matplotlib
- pycuda (optional)
- Python 3.11
These are installed automatically when you run:
conda env create -f environment.yml
-
No GPU? Replace all import cupy as cp with import numpy as cp in the notebooks to run on CPU (slower).
-
Environment errors? Re-create the environment:
conda env remove -n cupy129env
conda env create -f environment.yml
- Kernel crashes or CuPy import errors? Make sure your system has a working CUDA 12.x installation that matches the cupy-cuda12x package.
MIT License
Sreelekha Nampally
🎓 B.Tech in Mathematics and Computing, NIT Mizoram
🛠️ Project developed as part of Summer Internship at IIT Tirupati
🌐 LinkedIn | GitHub