1 - There are many ways to solve PDEs. In this repository we are implementing the PCG, an iterative solver.
For example here we are trying to solve 2D poisson
With centered finite difference method we discretize the equation into a sparse matrix problem, which is solved iteratively.
2- We use a JIT compiled PCG using Numba to accelerate computations on CPU @nojit(Parallel=True)
. (may extend it to GPU acceleration in the near future).
To clone this repository:
clone https://github.com/moaziat/JIT-PCG-Solver.git
pip install requirements.txt
cd JIT parallelized solver/
python poisson2D_parallel.py
nx
, ny
: Grid points in x/y dimensions (default: 500, 500)
xmin
, xmax
: Domain boundaries in x direction
ymin
, ymax
: Domain boundaries in y direction
dx
, dy
: Computed step sizes
The default problem simulates two point sources in the domain:
- Positive source at (1/4, 1/4)
- Negative source at (3/4, 3/4)
The potential field is generated by these sources.
The implementation follows ideas from the 12 Steps to Navier-Stokes course by Lorena A. Barba: https://lorenabarba.com/blog/cfd-python-12-steps-to-navier-stokes/.
For issues or suggestions, feel free to reach out to the repository owner @moaziat.