This project contains the files which solve the Maxwell's constraint equation for electric fields:
This is done in the electrostatic limit:
Hence the reduced equation we need to solve is:
The solver makes use of ArrayFire and requires it to be built and installed on the system of usage in addition to the python interface(arrayfire-python. The following Python packages are also required:
- numpy
- pytest
Once ArrayFire is installed successfully, all other dependencies can be installed using pip install -r requirements.txt
- First build ArrayFire from source. Suggested installation folder:
${HOME}/arrayfire
- This code needs Python3 to run. Suggested install : Anaconda for Python3
- After installing Anaconda, type
which python
in the terminal. Output should show that python from Anaconda is being used. - Next, inside the Poisson_Solver folder, use:
pip install -r requirements.txt
to install required Python3 libraries.
The function fft_poisson
assumes that in the density array, x
varies along axis 0, y
varies along axis 1, z
varies along axis 2. Additionally, we consider cell centered formulation to be used throughout. Hence the density array needs to be passed to the function following these conventions:
from fft_poisson_3d import fft_poisson
potential, Ex, Ey, Ez = fft_poisson(rho, dx, dy, dz)
The solver can be tested by running:
py.test test_fft_poisson_3d.py