Skip to content

ENCCS/HeatEquation.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HeatEquation.jl

This is a Julia version of an educational heat-equation implementation in C/C++/Fortran demostrating various parallel programming approaches from CSC – IT Center for Science.

The two dimensional heat equation

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 run

An example run is demonstrated in example.jl:

using HeatEquation

ncols, nrows = 1000, 1000 
nsteps = 500

# initialize current and previous states to the same state
curr, prev = initialize(ncols, nrows)

# visualize initial field
visualize_field(curr)

# simulate temperature evolution for nsteps
simulate!(curr prev, nsteps)

# visualize final field
visualize_field(curr)

How to test

cd test
julia --project=.. runtests.jl

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages