wiki:Examples/Laplace

Laplace

Solves the Laplace equation u_xx + u_yy = 0 in a rectangular domain, by iteratively applying a stencil function.

The first argument is the number of iterations to use. The second is a BMP file containing boundary conditions.

 repa-laplace 10000 pls-400x400.bmp pls-400x400-out.bmp

Code

The main algorithm is at SolverStencil.hs

The wrapper is at Main.hs

Test Data

In the input file, greyscale gives the boundary conditions, blue specifies where to determine the solution.

pls-400x400.bmp pls-400x400-out.bmp
full size full size

Runtime

Compiled with GHC 6.13.20100309. 400x400 image. 10000 iterations.

Running on a Intel i7 iMac. 2.8Ghz, 4 cores x 2 threads/core. 256k L1, 8MB L2, 8GB main memory.

Times stated include IO.

Threads Time(s)
1 64.67
2 37.29
3 27.45
4 31.96
5 28.08
6 24.39
7 23.83
8 24.67
Last modified 9 months ago Last modified on Nov 29, 2013 6:32:18 AM

Attachments (2)

Download all attachments as: .zip