source: palm/trunk/UTIL/chemistry/gasphase_preproc/kpp/src/gdata.h @ 3298

Last change on this file since 3298 was 2696, checked in by kanani, 6 years ago

Merge of branch palm4u into trunk

File size: 5.7 KB
Line 
1/******************************************************************************
2
3  KPP - The Kinetic PreProcessor
4        Builds simulation code for chemical kinetic systems
5
6  Copyright (C) 1995-1996 Valeriu Damian and Adrian Sandu
7  Copyright (C) 1997-2005 Adrian Sandu
8
9  KPP is free software; you can redistribute it and/or modify it under the
10  terms of the GNU General Public License as published by the Free Software
11  Foundation (http://www.gnu.org/copyleft/gpl.html); either version 2 of the
12  License, or (at your option) any later version.
13
14  KPP is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  details.
18
19  You should have received a copy of the GNU General Public License along
20  with this program; if not, consult http://www.gnu.org/copyleft/gpl.html or
21  write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22  Boston, MA  02111-1307,  USA.
23
24  Adrian Sandu
25  Computer Science Department
26  Virginia Polytechnic Institute and State University
27  Blacksburg, VA 24060
28  E-mail: sandu@cs.vt.edu
29
30******************************************************************************/
31
32#define KPP_VERSION "2.2.3"
33
34#ifndef _GDATA_H_
35#define _GDATA_H_
36
37#include <stdio.h>
38
39#define MAX_EQN         400
40#define MAX_SPECIES     500
41#define MAX_SPNAME       30
42#define MAX_IVAL         40
43/* MAX_EQNTAG = max length of equation ID in eqn file */
44#define MAX_EQNTAG       12
45/* MAX_K = max length of rate expression in eqn file */
46#define MAX_K           150
47#define MAX_ATOMS        10
48#define MAX_ATNAME       10
49#define MAX_ATNR        250
50#define MAX_PATH        120
51#define MAX_FILES        20
52#define MAX_EQNLEN      100
53
54#define NO_CODE         -1
55#define max( x, y ) (x) > (y) ? (x) : (y)
56#define min( x, y ) (x) < (y) ? (x) : (y)
57
58#define IncName(x)   FileName((x),"MODELS","models","")
59#define ModelName(x) FileName((x),"MODELS","models",".def")
60#define IntegName(x) FileName((x),"INTEG","int",".def")
61
62enum krtypes { NUMBER, EXPRESION, PHOTO };
63enum table_modes { F_TEXT, FC_TEXT, C_TEXT, S_TEXT }; 
64enum lang { NO_LANG, C_LANG, F77_LANG, F90_LANG, MATLAB_LANG };
65enum inl_code { F77_GLOBAL,    F77_INIT,    F77_DATA,    F77_UTIL,    F77_RATES,    F77_RCONST,
66              F90_GLOBAL,    F90_INIT,    F90_DATA,    F90_UTIL,    F90_RATES,    F90_RCONST,
67              C_GLOBAL,      C_INIT,      C_DATA,      C_UTIL,      C_RATES,      C_RCONST,
68              MATLAB_GLOBAL, MATLAB_INIT, MATLAB_DATA, MATLAB_UTIL, MATLAB_RATES, MATLAB_RCONST,
69              INLINE_OPT
70              };
71
72enum jacobian_format { JAC_OFF, JAC_FULL, JAC_LU_ROW, JAC_ROW };             
73
74                     
75typedef short int CODE;
76typedef float EQ_VECT[ MAX_EQN ];
77
78typedef struct {
79                 char name[ MAX_ATNAME ];
80                 char check;
81                 char masscheck;
82               } ATOM_DEF;
83
84typedef struct {
85                 unsigned char code;
86                 unsigned char nr; 
87               } ATOM;
88
89typedef struct {
90                 char type;
91                 char lookat;
92                 char moni;
93                 char trans;
94                 short int nratoms;
95                 char name[ MAX_SPNAME ];
96                 char ival[ MAX_IVAL ];
97                 ATOM atoms[ MAX_ATOMS ]; 
98               } SPECIES_DEF;
99
100typedef struct {
101                 char type;
102                 union {
103                   char st[ MAX_K ];
104                   float f;
105                 } val;
106                 char label[ MAX_EQNTAG ];
107               } KREACT;
108
109typedef struct {
110                 char * code;
111                 int maxlen;
112               } ICODE;
113
114
115extern int SpeciesNr;
116extern int EqnNr;
117extern int SpcNr;
118extern int AtomNr;
119extern int VarNr;
120extern int VarActiveNr;
121extern int FixNr;
122extern int VarStartNr;
123extern int FixStartNr;
124extern int Hess_NZ;
125extern int LU_Jac_NZ;
126extern int Jac_NZ;
127
128extern int generateSD;
129
130extern int initNr;
131extern int xNr;
132extern int yNr;
133extern int zNr;
134
135extern int falseSpcNr;
136
137extern int useAggregate;
138extern int useJacobian;
139extern int useJacSparse;
140extern int useHessian;
141extern int useStoicmat;
142extern int useDouble;
143extern int useReorder;
144extern int useMex;
145extern int useDummyindex;
146extern int useEqntags;
147extern int useLang;
148extern int useStochastic;
149
150/* if useValues=1 KPP replaces parameters like NVAR etc.
151       by their values in vector/matrix declarations */
152extern int useDeclareValues; 
153
154extern char Home[ MAX_PATH ];
155extern char integrator[ MAX_PATH ];
156extern char driver[ MAX_PATH ];
157extern char runArgs[  MAX_PATH ];
158
159extern char *eqFileName;
160extern char *rootFileName;
161
162extern ATOM_DEF AtomTable[ MAX_ATNR ];
163extern SPECIES_DEF SpeciesTable[ MAX_SPECIES ];
164extern KREACT   kr       [ MAX_EQN ];
165extern CODE     ReverseCode[ MAX_SPECIES ];
166extern CODE     Code     [ MAX_SPECIES ];
167extern float**  Stoich_Left;
168extern float**  Stoich;
169extern float**  Stoich_Right;
170extern int      Reactive [ MAX_SPECIES ];
171
172extern int **structB;
173extern int **structJ;
174extern int **LUstructJ;
175
176extern ICODE InlineCode[ INLINE_OPT ];
177
178extern char *fileList[ MAX_FILES ];
179extern int fileNr;
180
181extern char varDefault[ MAX_IVAL ];
182extern char radDefault[ MAX_IVAL ];
183extern char fixDefault[ MAX_IVAL ];
184extern double cfactor;
185
186void CmdFunction( char *cmd );
187void CmdJacobian( char *cmd );
188void CmdHessian( char *cmd );
189void CmdDeclareValues( char *cmd );
190void CmdDouble( char *cmd );
191void CmdReorder( char *cmd );
192void CmdMex( char *cmd );
193void CmdDummyindex( char *cmd );
194void CmdEqntags( char *cmd );
195void CmdUse( char *cmd );
196void CmdLanguage( char *cmd );
197void CmdIntegrator( char *cmd );
198void CmdDriver( char *cmd );
199void CmdRun( char *cmd );
200void CmdStochastic( char *cmd );
201
202void Generate();
203
204char * FileName( char *name, char* env, char *dir, char *ext );
205
206int*  AllocIntegerVector( int n, char* message );
207int** AllocIntegerMatrix( int m, int n, char* message );
208void FreeIntegerMatrix ( int** mat, int m, int n );
209int Index( int i );
210
211#endif
212
Note: See TracBrowser for help on using the repository browser.