Giter Club home page Giter Club logo

heat-equation's Introduction

Two dimensional heat equation

Example implementations of two dimensional heat equation with various parallel programming approaches.

Heat (or diffusion) equation is

img

where u(x, y, t) is the temperature field that varies in space and time, and α is thermal diffusivity constant. The two dimensional Laplacian can be discretized with finite differences as

img

Given an initial condition (u(t=0) = u0) one can follow the time dependence of the temperature field with explicit time evolution method:

img

Note: Algorithm is stable only when

img

How to build

For building and running the example one needs to have the libpng library installed. Working MPI environment is required for all cases except for the serial one. In addition:

  • Hybrid MPI-OpenMP version requires MPI implementation with MPI_THREAD_MULTIPLE support
  • CUDA version requires CUDA environment and CUDA aware MPI

Move to proper subfolder and modify the top of the Makefile according to your environment (proper compiler commands and compiler flags). Code can be built simply with make

How to run

The number of MPI ranks has to be a factor of the grid dimension (default dimension is 2000). For GPU versions, number of MPI tasks per node has to be the same as number of GPUs per node.

The default initial temperature field is a disk. Initial temperature field can be read also from a file, the provided bottle.dat illustrates what happens to a cold soda bottle in sauna.

  • Running with defaults: mpirun -np 4 ./heat_mpi
  • Initial field from a file: mpirun -np 4 ./heat_mpi bottle.dat
  • Initial field from a file, given number of time steps: mpirun -np 4 ./heat_mpi bottle.dat 1000
  • Defauls pattern with given dimensions and time steps: mpirun -np 4 ./heat_mpi 800 800 1000

The program produces a series of heat_XXXX.png files which show the time development of the temperature field

heat-equation's People

Contributors

jussienko avatar mabraham 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.