Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / chem / KPP / kpp / kpp-2.1 / drv / general.c
blob44a9d4eba65b30c897a4034079e8d612946ea13a
1 int InitSaveData();
2 void Initialize();
3 int SaveData();
4 int CloseSaveData();
5 int GenerateMatlab( char * prefix );
6 void GetMass( double CL[], double Mass[] );
7 void INTEGRATE( double TIN, double TOUT );
9 int main()
11 KPP_REAL dval[NSPEC];
12 int i;
14 /* ---- TIME VARIABLES ------------------ */
16 RTOLS = 1e-3;
17 TSTART = 3600*12;
18 TEND = TSTART + 3600*24*5;
19 DT = 3600.;
20 TEMP = 236.21;
22 Initialize();
24 for( i = 0; i < NVAR; i++ ) {
25 RTOL[i] = RTOLS;
26 ATOL[i] = 1.0;
28 STEPMIN = 0.01;
29 STEPMAX = 900;
31 /* ********** TIME LOOP **************************** */
33 InitSaveData();
35 printf("\n%7s %7s ", "done[%]", "Time[h]");
36 for( i = 0; i < NMONITOR; i++ )
37 printf( "%8s ", SPC_NAMES[MONITOR[i]] );
38 for( i = 0; i < NMASS; i++ )
39 printf( "(%6s) ", SMASS[i] );
41 TIME = TSTART;
42 while (TIME <= TEND) {
43 GetMass( C, dval );
44 printf("\n%6.1f%% %7.2f ", (TIME-TSTART)/(TEND-TSTART)*100, TIME/3600 );
45 for( i = 0; i < NMONITOR; i++ )
46 printf( "%9.3e ", C[ MONITOR[i] ]/CFACTOR );
47 for( i = 0; i < NMASS; i++ )
48 printf( "%9.3e ", dval[i]/CFACTOR );
50 SaveData();
52 INTEGRATE( TIME , TIME+DT );
53 TIME += DT;
56 /* *********** END TIME LOOP *********************** */
58 printf("\n");
59 CloseSaveData();
61 return 0; /*didnt return anything initially */