Coder Social home page Coder Social logo

poissonfortran's Introduction

Parallel Poisson solver using PETSc (C++ and Fortran)

your_alternative_textyour_alternative_text your_alternative_text

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.

Governing equation, domain and boundary conditions

The Poisson equation in two-dimensions is given by
$\cfrac{\partial^2 u}{\partial x^2} + \cfrac{\partial^2 u}{\partial y^2} = f$.
In this example $f = 8\pi^2\cos(2\pi x)\cos(2\pi y)$ and the domain is given by $(0,1)\times(0,1)$. Neumann boundary conditions are imposed on all boundaries $\cfrac{\partial u}{\partial n} = 0$. The exact solution is given by $u(x,y) = \cos(2\pi x)\cos(2\pi y)$.

Installation and compilation

  1. git clone https://github.com/nataraj2/petsc.git
  2. ./configure --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90
  3. 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 the bashrc file.
  4. The Cpp and Fortran directories contain the code for C++ and Fortran respectively. To run, just do sh run_poisson2d_neumann.sh
  5. python PoissonSolution.py - plots the contours of the exact and petsc solutions.

poissonfortran's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.