So, you have just extracted the source in a directory and you want to have fun ? Ok. This example doesn't require any external library except the Boost headers, which are assumed to lie in a standard include directory on your system. Boost.Build should be installed since you used it to build Boost. By the way, don't tell, but you don't need root access to install libraries.
We do need to set a few things up to begin with.
First, be sure to set the BOOST_BUILD_PATH
environment variable to point to your Boost.Build installation directory.
Then, copy the site-config-sample.jam
from your source directory to $BOOST_BUILD_PATH/site-config.jam
.
Have a look at the comment line documentation within this file and edit it if necessary.
Then cd back to the source directory and type:
bjam burgers-dist spatial-scheme=wavelets wavelet=dtcwt debug
Basically, you have asked bjam to make the target named "burgers-dist", with the feature "spatial-scheme" set to "wavelets",
and "wavelet" set to "dtcwt", and to use the "debug" variant.
You may have to add "mpi=on" if you have configured mpi, but this will not matter later since the application is not actually using MPI.
Now if you are lucky the program should be compiled and stored in /tmp/bin/burgers-dtcwt-wavelets
(or maybe $(install-prefix)/bin/burgers-dtcwt-wavelets
if you have changed that in site-config.jam
).
What the program that we have just compiled does is to solve the initial value problem
for the Burgers equation with
periodic boundary conditions.
We want to provide an initial condition to our Burgers solver in the form of an ASCII file called in.dat
.
The format that it expects is very simple :
N can be any power of 2 that you like. If you want to go fast, just take 8 and enter some values by hand. If you want to see nice plots later, you can use a Perl script such as this one to generate the file:
#!/usr/bin/perl my $N = 512; open OUT,">in.dat"; print OUT "$N\n"; print OUT sin(8*atan2(1,1)*$_/$N)." " foreach(1..$N);
In the directory containing the input file, type: /tmp/bin/burgers-dtcwt-wavelets init=0 total_time=0.5 max_timestep=0.05 tplot=1
Parameters are passed using the "name=value" syntax. Default values are usually provided for most parameters if you don't specify them on the command line, but a few important parameters may be mandatory.
You will see a lot of terminal activity when the program runs : that's because we compiled in debug mode. The program tells us every operation that it does: lots of wavelet transforms, reduction operations, decimations. The complete run should not take more than 1 minute on a standard 2009 computer.