This article describes how to build a simple FACSIMILE model. This article is applicable to all versions of FACSIMILE.

Model Details

We will create a model of the following reaction scheme.

(1)   H2 ---> H + H
(2)   H + O2  ---> OH + O
(3)  O + H2 --->  OH + H
(4)  OH + H2 --> H2O + H

We will use the following rate coefficients for the reactions
Reaction (1)   Forward 5.8E-46  Reverse 1.9E-32
Reaction (2)   Forward 3.4E-16  Reverse 4.0E-11
Reaction (3)   Forward 6.6E-15  Reverse 7.4E-14
Reaction (4)   Forward 3.4E-13  Reverse 1.1E-17

We will use the following Initial concentrations
H2 = 4.0E+19
O2 = 3.0E+19

The units used are molecules/cm3    and  cm3/molecule s

The reactions are quite fast so we will follow the reactions to 0.5 milliseconds and record the output every 10 microseconds

The Model Structure

Every FACSIMILE model has several basic sections in the model definition. The most common are ;-
Declarations
Initialisation
Integration
Output

The Declaration Section

FACSIMILE uses two types of variables

VARIABLES these are numeric items which are changed by the integration.
PARAMETERS these are values which are unchanged by the integration.

For this model the VARABLES are the chemical species in the reactions and the PARAMETERS are the rate coefficients. There is also another PARAMETER, TIME which does not need to be declared this monitors the progress of the integration.

So, for our first declaration line we will define the names for the forward and reverse rate coefficients for the reactions. The FACSIMILE code is:-

PARAMETER k1 k1r k2 k2r k3 k3r k4 k4r ;

The next line defines the names of the reactants and products. The FACSIMILE code is:-

VARIABLE H H2 O O2 OH H2O ;

In FACSIMILE each instruction is terminated by a semi-colon. So we could have written the VARIABLE line as :-

VARIABLE
H H2 O O2 OH H2O
;

With the same meaning. This form is useful if you have many names as FACSIMILE only reads the first 72 characters of each physical line.

The Initialisation Section

Another structure used in FACSIMILE is the block. A block is initiated with a COMPILE {blockName} and terminated by **. There are several predefined block names, which give instructions for specific phases of the integration, there are also user defined blocks. We are going to set the values for the rate coefficients and the initial values of H2 and O2 in a FACSIMILE block called INITIAL.

The instructions in this block are executed at the start of the integration. The code is as follows.

COMPILE INITIAL ;
k1  = 5.8E-46;
k1r = 1.9E-32;
k2  = 3.4E-16;
k2r = 4.0E-11;
k3  = 6.6E-15;
k3r = 7.4E-14;
k4  = 3.4E-13;
k4r = 1.1E-17;

H2= 4.0E19;
O2=3.0E19;
** ;

The Integration Section

We now define the Chemistry. We do this in another FACSIMILE block called EQUATIONS. The syntax of a chemical reaction in FACSIMILE is

% ForwardRateCoefficient % ReverseRateCoeffient : Reactants = Products ;

So our EQUATIONS block is:-

COMPILE EQUATIONS ;
%k1 % k1r : H2 =  H + H  ;        
%k2 % k2r : H + O2 =  OH + O ;      
%k3 % k3r : O + H2 = OH + H  ;
%k4 % k4r : OH + H2 = H2O + H ;
**;

The Output Section

Now we need to define which output we require from our model.

First we need to tell FACSIMILE to open a file to contain our output. For ease of maintenance these commands are normally placed at the head of the model file.

The instruction is:-

EXECUTE OPEN 8 "simple.out" UNKNOWN ;

simple.out is the name of the output files and 8 is the number of the output stream.

FACSIMILE uses a structure called a PSTREAM as a way to easily define formatted output. There can be more than one PSTREAM and each as an identifier number, each PSTREAM is connected to a file by means of the output stream number from the open command. As this is a simple model we will use a simple PSTREAM which outputs all the VARIABLES. We define the PSTREAM as follows:-

SETPSTREAM 1 8 ;
TIME H2 O2 H2O H O OH ;
**;

This sets up PSTREAM number 1 and connects it to the file simple.out using output stream 8.

We need to invoke this PSTREAM when we require output so we first wrap it in a custom block called OUT. The code looks like this:-

COMPILE OUT;
PSTREAM 1;
**;

We use a special block called WHENEVER to specify when the integrator generates output. We require output at time 0 and every 1E+5 seconds up to 5E+4 seconds. At each time point we call the block OUT to generate our output. The code looks like this:-

WHENEVER
TIME= 0 + 1E-5*50 % CALL OUT;
**;

 

 

Final Steps

We have now written most of the model but we have to add two final instructions. The are:-

BEGIN;
STOP;

BEGIN tells the integrator to start integrating the problem and STOP tells the integrator to terminate once the process is complete.

 

The Complete Model

The full model is shown below. The model can now be run in your version of FACSIMILE (see instructions that came with your application).

EXECUTE OPEN 8 "simple.out" UNKNOWN;

PARAMETER k1 k1r k2 k2r k3 k3r k4 k4r ;
VARIABLE H H2 O O2 OH H2O;

COMPILE INITIAL;
k1  = 5.8E-46;
k1r = 1.9E-32;
k2  = 3.4E-16;
k2r = 4.0E-11;
k3  = 6.6E-15;
k3r = 7.4E-14;
k4  = 3.4E-13;
k4r = 1.1E-17;

H2= 4.0E19;
O2=3.0E19;
**;

COMPILE EQUATIONS ;
%k1 % k1r : H2 =  H + H  ;        
%k2 % k2r : H + O2 =  OH + O ;      
%k3 % k3r : O + H2 = OH + H  ;
%k4 % k4r : OH + H2 = H2O + H ;
**;

SETPSTREAM 1 8 ;
TIME H2 O2 H2O H O OH ;
**;

COMPILE OUT;
PSTREAM 1;
**;

WHENEVER
TIME= 0 + 1E-5*50 % CALL OUT;
**;

BEGIN;

STOP;

The Output

The listing below is the first few lines of simple.out after the model has run.

PRINT STREAM NO.  1
TIME        H2          O2          H2O         H           O           OH        
 0.0000      4.0000E+19  3.0000E+19  0.0000      0.0000      0.0000      0.0000    
 1.0000E-05  4.0000E+19  3.0000E+19  3.6040E-32  4.8799E-31  1.2053E-32  5.9449E-34
 2.0000E-05  4.0000E+19  3.0000E+19  1.7145E-31  1.0669E-30  3.2589E-32  1.4260E-33
 3.0000E-05  4.0000E+19  3.0000E+19  4.3214E-31  1.7664E-30  5.7773E-32  2.4381E-33
 4.0000E-05  4.0000E+19  3.0000E+19  8.4475E-31  2.6125E-30  8.8266E-32  3.6629E-33
 5.0000E-05  4.0000E+19  3.0000E+19  1.4408E-30  3.6356E-30  1.2513E-31  5.1439E-33

Below is a graph made from the output file.