This repository containes the code for solving a Poisson equation in parallel in two dimensions in PetSc. It solves the inhomogeneous Poisson equation with Neumann boundary conditions on all boundaries.
The Poisson equation in two-dimensions is given by
In this example
git clone https://github.com/nataraj2/petsc.git
./configure --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90
- Then set
PETSC_DIR = <path>
. The output of step 2 on the screen will tell the exact command. Just copy paste it. Add it to thebashrc
file. - The Cpp and Fortran directories contain the code for C++ and Fortran respectively. To run, just do
sh run_poisson2d_neumann.sh
python PoissonSolution.py
- plots the contours of the exact and petsc solutions.