reaction
|
a.e,
a.m,
a.p,
a.s,
bail.c,
derivs.c,
errors,
extract.c,
extracter.c,
initial.c,
inlist.c,
lastchange,
makefile,
parse.c,
posting1,
rates.c,
reader.c,
readme,
reprint.c,
rxn.c,
rxn.h,
select.c,
setfiles.c,
wr_results.c,
wr_species.c,
|
|
|
/*
The permission is granted to use the software as is and redistribute it in
its original and complete form. If you find this program useful and publish
results obtained by it, please cite the program as:
Michael Whitbeck, Desert Research Institute, 1991, "REACT - Program to solve
kinetic equations for chemical systems". Version 1.00, this code is
available from the authors or from Dr. Whitbeck.
*/
/*
initial
*/
#include
#include "rxn.h"
extern int inlist();
void initial(s,t,tout,stop,step,atol,rtol)
int s; double *t, *tout, *stop, *step, atol[], rtol[];
{
int i,id;
char line[80],word[20], *species;
float first, last, interval, value, av, rv;
for (i=1; i<=NS; i++) Y[i] = 0.00;
if ((params = fopen(parameters,"r"))==NULL)
bail("Could not open parameter file");
fscanf(params,"%f%f%f%e\n", &first, &last, &interval, &value);
*t = first; *tout = *step = interval; *stop = last;
*tout += first;
for (i=1; i<=NS; i++) {atol[i] = rtol[i] = value;}
#ifdef DEBUG
for (i=1; i<=NS; i++) printf("%15.4e %15.4e\n", atol[i],rtol[i]);
#endif
species = (char *)malloc(strlen(SPECIES)+1);
strcpy(species,SPECIES);
while (!feof(params)) {
fscanf (params,"%s %e %e %e\n", word, &value, &av, &rv);
if ((id = inlist(species,word))) {
Y[id] = value; atol[id] = av; rtol[id] = rv;
}
else {
sprintf(line,"The species >%s< is not in the mechanism", word);
bail(line);
}
}
#ifdef DEBUG
for (i=1; i<=NS; i++) printf("%15.4e %15.4e %15.4e\n",Y[i], atol[i],rtol[i]);
#endif
free(species);
fclose(params);
}
|