RAD1D: Reaction-Advection-Diffusion in 1D

Description

The program solves a one-dimensional reaction-advection-diffusion problem with periodic boundary conditions.  RAD1D uses a semi-implicit scheme where diffusion is treated implicitly (backwards Euler method) and advection and reaction are treated explicitly (Lax-Wendroff and Euler method, respectively).  For more details on the numerical method, please read ModelDerive.pdf.

Building RAD1D

First, download the source code (in RAD1D.tar) and untar it (tar xvf RAD1D.tar).  This will create a directory called RAD1D containing the source code, Makefile, and an example input file.  Next, edit the Makefile for your system (you should set the CC variable to the name of your c compiler).  To build, type "make" and the executable rad1d should appear in your directory.

Running RAD1D

To run RAD1D, you must set four parameters, provide initial data, and specify four functions.  You do this by creating a command (.cmnd) file and passing it to rad1d.  The first four lines of the command file set the parameters:
 
# name type description
1: m int number of grid points
2: L double length of the domain
3: dt double time step
4: T double max time (when simulation should end)

The next line should contain the name of the file with the initial concentrations:
 

# name type description
5: string name of the file containing the initial concentration

The initial concentration file should have m lines, where line j is the concentration at the jth grid point.  The remaining lines control the functions for velocity (u), diffusion (k), growth (g), and carrying capacity (K).  Each function is decribed by a pair of lines, which for u look like:
 

# name type description
6: case int case number for function
    0=constant, 1=space, 2=space & time
7: value double case==0: value of the function
or 
name string case>0: file containing function

The case number must be an integer between 0 and 2.  If the case is 0, then the function is constant in space and time, and the next line should contain the value.  If the case is 1 or 2, then the next line will contain the name of a valid function file (described below).  Case 1 indicates that the function is variable in space only, while case 2 indicates that the function varies in space and time.  Lines 6-7 specify u, 8-9 specify k, 10-11 specify g, and 12-13 specify K.

Function Files

The format of the input files describing functions for cases 1-2 must specify the number of time observations (1 if case==1, >1 otherwise), indicate when the observations where made, and give the value of the function at the m grid points.   The first line should indicate, N,  the number of time observations.  The file must have N*(m+1) additional lines arranged in groups of m+1 lines.  The first line in the record is the time when the sample was taken, and the remaining m lines are the values of the function at the m grid points.  If N=1 and m=2, then the file will look like:
 

# name type description
1: N int number of time samples (2 in this case)
2: t1 double first time observation
3: v(t1,x1) double function value at time=t1 and grid point x1
4: v(t1,x2) double function value at time=t1 and grid point x2

If N were greater than 1, the the next line would be t2 followed by the function values at the time.  If case=1, the N must equal 1, and the time will be ignored.  For case 2, N must be >1, the times must be sorted (t1<t2<t3<...<tN), t1 must be less than or equal to 0, and tN must be greater than or equal to T.  The last two conditions ensure that there are function values for the entire simulation period.