To compile you need the following files:

collision.c    initlat.c      propagate.c   testcons.c     util.c
dispersion.c   makesolid.c    ran1.c        testparam.c    writevel.c
gravity.c      model.c        relaxation.c  user.c
bgk.h          Makefile

----------------------------------------------------------------

On the sun workstations of 
athena please type:
"make CC=suncc"
to link and create the miscbgk executabled.
For any other workstations use the appropiate
C compiler.
If errors occur during compiling please
let me know.
Again you need a script file. An example script
file"diff.bgk" is include to run the channel flow experiment.
Type miscbgk<diff.bgk to run the code with this script.
The layout of the script file is similar as before.
However the is a sligt modification of the script file
Each line in the script file 
schould begin with a single character whose
listed below, followed by a single
space.
    '.':           indicates the end of the scrpt file
    'f':           output file name
    'r':           seed random generator
    'm':           select FCHC model and set the direction vectors
    's':           read solid and set universe
    'i':           initialize lattice: mode, density, red fraction
    'c':           main loop:
    'p':           read two parameters lambda_Nu, lambda_D
    'd':           compute diffussion
    'g':           gravity
    'n':           color red

In the first part of the problemset we ask you to compute
the diffusion coefficient.
In order to do so we suggest that you initiate the concentration
with a sine wave.
I have coded this up for you. You might consult initlat.c
A script file to compute the concentration could be

m D3Q19
f testdif
u 128  4 1
i d 1 1.0 6.0
p -1.98 -1.5
d t 20 10
.
The line 
i d 1 1.0 6.0
means:
initiate the lattice with a wave of concentration of red with
spacial frequency equal to 6.0.
The code should output something like:


computation of diffusion coefficient
40.710636
--------------------------------------------------
dimensionless wave nr.: 6
frames:                 :10 
steps:                  :20 
--------------------------------------------------
t       k^2 t           ln(A(0)/(A(t)))
20      1.734891        0.103474
40      3.469783        0.200483
60      5.204674        0.297496
80      6.939566        0.394475
100     8.674457        0.491475
120     10.409348       0.588487
140     12.144239       0.685486
......

If you divide right column by the second, you 
should get the diffusion coefficient.
Since everything is done for you
it is your task to explain why this work.
Hint inspect file testparam.c

Yet another script:

m D3Q19
f chan
s solid
i n 1.0 1.0
p -1.5 -1.5
g 0.00005 
c v 100 20 t 
c c 20 150 t 
.
This script will allow the flow to become stationary within 100*20 time
steps. Then blue fluid will be injected at the (line: c c 20 150 t)
channel inlet. the code will write every 150 time steps the
blue concentration averaged over the channel width to a file
called chan.cons.
I have included a matlab file readcons.m that can read this binary file. 
You should be able to compare this concentration field with
your predictions.

--------------------------------------------------------------------
The file "solid" can be generated with a program
called makesolid.
To compile and link to an executable called makesolid
please type 
"make CC=(your C compiler) makesolid"

this program can make two types of solids;
-a channel with walls at x=1 and x=Nx and length
 Nz.
-or a disk inside a open box (now walls) with
 dimensions Nx*1*Nz. The disk has radius RADIUS and
 is centered at (XC,ZC).

To choose a solid set either the parameter 
CHANNEL or DISK to 0. For example, the setting
#define CHANNEL 1
#define DISK    0
will generate a channel.
You have your own code to generate a disk of solids
To include any change of these paramters in your
solid you have to remake makesolid.
The output filename and the dimensions of the solid file
can be set from the command line for example
 "makesolid Nx=32 Nz=64 file=foo "
will generate a solid with dimensions 32*1*64 and saves it in a
binary file called 'foo'

--------------------------------------------------------------------


Good luck and best regards,
Olav




















