pihm/print_functions.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * File        : print_function.c                                              *
00003  * Function    : print out model result to stdout or output files              *
00004  * Programmer  : Yizhong Qu @ Pennsylvania State Univeristy                    *
00005  * Version     : May, 2004 (1.0)                                               * 
00006  *-----------------------------------------------------------------------------*
00007  *                                                                             *
00008  * In this file, several print function defined serves to print our model      *
00009  * result to stdout(monitor) or output files with the same prefix as in input  *
00010  * files. Users can modify all the following print function as need accordingly*
00011  * There are 3 files so far: *.res, *.flux, and *.etis. In res file, all state *
00012  * variables, including Overland depth, Unsaturated and Saturated Storage for  *
00013  * every element, and River stage for each river segment are saved. All fluxes *
00014  * are saved in flux file. etis file has all envapotranspiration and inter-    *
00015  * ception storages in it.                                                     *
00016  *                                                                             *
00017  * This code is free for users with research purpose only, if appropriate      *
00018  * citation is refered. However, there is no warranty in any format for this   *
00019  * product.                                                                    *
00020  *                                                                             *
00021  * For questions or comments, please contact the authors of the reference.     *
00022  * One who want to use it for other consideration may also contact Dr.Duffy    *
00023  * at cxd11@psu.edu.                                                           *    
00024  *******************************************************************************/
00025 
00026 #include <stdio.h>
00027 #include <stdlib.h>
00028 #include <math.h>
00029 #include <string.h>
00030 
00031 #include "nvector_serial.h"
00032 #include "sundials_types.h"   
00033 #include "ihm.h"  
00034 #include "cvode.h" 
00035 #include "cvode_dense.h"
00036    
00037 
00038 void PrintModelData(Model_Data DS)
00039 {
00040   PrintEle(DS);
00041   PrintEleAtt(DS);
00042   PrintNode(DS);
00043   PrintRiv(DS);
00044   PrintSoil(DS);
00045   PrintForcing(DS);
00046   PrintTS(DS->TSD_Inc, DS->NumInc);
00047   fflush(stdout);
00048 }
00049 
00050 void PrintEle(Model_Data DS)
00051 {
00052   int i;
00053   
00054   printf("\nElements Information: \n");
00055   printf("\n   Index     N-1     N-2     N-3    Nr-1    Nr-2    Nr-3");
00056   printf("      Edge-1      Edge-2      Edge-3           X           Y       Z_MIN       Z_MAX        AREA\n");
00057   printf("\n");
00058   
00059   for (i=0; i<DS->NumEle; i++)
00060   {
00061     printf("%8d", DS->Ele[i].index);
00062     printf("%8d%8d%8d", DS->Ele[i].node[0], DS->Ele[i].node[1], DS->Ele[i].node[2]);
00063     printf("%8d%8d%8d", DS->Ele[i].nabr[0], DS->Ele[i].nabr[1], DS->Ele[i].nabr[2]);
00064 
00065     printf("%12.5f%12.5f%12.5f", DS->Ele[i].edge[0], DS->Ele[i].edge[1], 
00066                               DS->Ele[i].edge[2]);
00067     printf("%12.5f%12.5f%12.5f%12.5f", DS->Ele[i].x, DS->Ele[i].y, DS->Ele[i].zmin, 
00068                                    DS->Ele[i].zmax);
00069     printf("%12.5f", DS->Ele[i].area);
00070     printf("\n");
00071   }
00072   printf("\n");
00073 }
00074 
00075 void PrintEleAtt(Model_Data DS)
00076 {
00077   int i;
00078   
00079   printf("\nElements Attibute Information: \n");
00080   printf("\nIndex  Soil   LAI    IC    BC  Prep  Temp Humid  WVel    Rn     G     P\n\n");
00081   
00082   for (i=0; i<DS->NumEle; i++)
00083   {  
00084     printf("%6d%6d%6d", i+1, DS->Ele[i].soil, DS->Ele[i].LC);
00085     printf("%f\t%f\t%f\t%f\t%f\t%6d", DS->Ele_IC[i].interception,DS->Ele_IC[i].snow,DS->Ele_IC[i].surf,DS->Ele_IC[i].unsat,DS->Ele_IC[i].sat, DS->Ele[i].BC);
00086     printf("%6d%6d", DS->Ele[i].prep, DS->Ele[i].temp);
00087     printf("%6d%6d", DS->Ele[i].humidity, DS->Ele[i].WindVel);
00088     printf("%6d%6d", DS->Ele[i].Rn, DS->Ele[i].G);
00089     printf("%6d\n", DS->Ele[i].pressure);
00090   }  
00091 }
00092 
00093 
00094 void PrintNode(Model_Data DS)
00095 {
00096   int i;
00097   
00098   printf("\nNode Information: \n");
00099   printf("\n  Index       X       Y   Z_min   Z_Max\n");
00100   printf("\n");
00101   
00102   for (i=0; i<DS->NumNode; i++)
00103   {
00104     printf("%7d", DS->Node[i].index);
00105     printf("%8.3lf%8.3lf", DS->Node[i].x, DS->Node[i].y);
00106     printf("%8.3lf%8.3lf", DS->Node[i].zmin, DS->Node[i].zmax);
00107     printf("\n");
00108   }
00109   printf("\n");
00110 }
00111 
00112 
00113 void PrintSoil(Model_Data DS)
00114 {
00115   int i;
00116   
00117   printf("\nSoil Information: \n");
00118   printf("\n  Index    Ksat   SitaS   SitaR   Alpha    Beta");
00119   printf("      Sf Inc_type\n\n");
00120   
00121   for(i=0; i<DS->NumSoil; i++)
00122   {
00123     printf("%7d", DS->Soil[i].index);
00124     printf("%8.4f%8.4f%8.4f", DS->Soil[i].Ksat, DS->Soil[i].SitaS, DS->Soil[i].SitaR);
00125     printf("%8.4f%8.4f%8.4f", DS->Soil[i].Alpha, DS->Soil[i].Beta, DS->Soil[i].Sf);
00126     printf("%9d", DS->Soil[i].Inf);
00127     printf("\n");
00128   }
00129 }
00130 
00131 
00132 void PrintTS(TSD *Data, int NumTS)
00133 {
00134   int i, j;
00135   
00136   printf("\nTime Series Data Information: \n\n");
00137   
00138   for(i=0; i<NumTS; i++)
00139   {
00140     printf("%5s%6d%6d\n\n", Data[i].name, Data[i].index, Data[i].length);
00141     for(j=0; j<Data[i].length; j++)
00142     {
00143       printf("%16.6f %16.6f\n", Data[i].TS[j][0], Data[i].TS[j][1]);
00144     }
00145     printf("\n");
00146   }
00147 }
00148 
00149 
00150 void PrintRiv(Model_Data DS)
00151 {
00152   int i;
00153   
00154   printf("\nRiver Segments Information: \n");
00155   printf("\n  Index           X           Y           Z");
00156   printf("       Depth      Length F_node T_node Down L_ele R_ele Shape Mat  IC  BC RES\n");
00157   printf("\n");
00158   
00159   for(i=0; i<DS->NumRiv; i++)
00160   {
00161     printf("%7d%12.4f%12.4f%12.4f%12.4f%12.4f", DS->Riv[i].index, DS->Riv[i].x, 
00162                                                 DS->Riv[i].y, DS->Riv[i].zmin, 
00163                                                 DS->Riv[i].depth, DS->Riv[i].Length);
00164     printf("%7d%7d%5d", DS->Riv[i].FromNode, DS->Riv[i].ToNode, DS->Riv[i].down);
00165     printf("%6d%6d%6d", DS->Riv[i].LeftEle, DS->Riv[i].RightEle, DS->Riv[i].shape);
00166     printf("%4d%f\t%4d%4d", DS->Riv[i].material, DS->Riv_IC[i].value, DS->Riv[i].BC, DS->Riv[i].reservoir);
00167     printf("\n");
00168   }
00169 }
00170 
00171 
00172 void PrintForcing(Model_Data DS)
00173 {
00174   PrintTS(DS->TSD_Prep, DS->NumPrep);
00175   PrintTS(DS->TSD_Temp, DS->NumTemp);
00176   PrintTS(DS->TSD_Humidity, DS->NumHumidity);
00177   PrintTS(DS->TSD_WindVel, DS->NumWindVel);
00178   PrintTS(DS->TSD_Rn, DS->NumRn);
00179   PrintTS(DS->TSD_G, DS->NumG);
00180   PrintTS(DS->TSD_LAI, DS->NumLC);
00181 }
00182 
00183 
00184 void PrintDY(Model_Data DS, N_Vector CV_Y, N_Vector CV_Ydot)
00185 {
00186   int i, index, Num;
00187         if(DS->UnsatMode ==1)
00188         {    
00189   Num = 2*DS->NumEle + DS->NumRiv;
00190   printf("\nY & DY [1 : %d] = \n\n", Num);
00191   
00192   printf("Elements Information\n\n");
00193   printf(" Index        Surf       Unsat         Sat        Surf       Sat\n\n");
00194   
00195   for(i=0; i<DS->NumEle; i++)
00196   {
00197     index = i-(i/DS->NumEle)*DS->NumEle + 1;
00198     printf("%6d%12.4f%12.4f%12.4f", index, NV_Ith_S(CV_Y, i), (pow(1+pow(DS->Ele[i].Alpha*((DS->Ele[i].zmax - DS->Ele[i].zmin)-NV_Ith_S(CV_Y, i + DS->NumEle)+0.05),-DS->Ele[i].Beta),-1/DS->Ele[i].Beta))/DS->Ele[i].Alpha,NV_Ith_S(CV_Y, i + DS->NumEle));
00199     printf("%12.4f%12.4f\n", NV_Ith_S(CV_Ydot, i), NV_Ith_S(CV_Ydot, i + DS->NumEle));
00200   }  
00201   
00202   printf("\n");
00203   printf("River Segments Information\n\n");
00204   printf(" Index           Y          DY\n\n");
00205   for(i=0; i<DS->NumRiv; i++)
00206   {
00207     printf("%6d%12.4f%12.4f\n", i+1, NV_Ith_S(CV_Y, i + 2*DS->NumEle), 
00208                                      NV_Ith_S(CV_Ydot, i + 2*DS->NumEle));
00209   }
00210         }
00211         if(DS->UnsatMode ==2)
00212         {    
00213   Num = 3*DS->NumEle + DS->NumRiv;
00214   printf("\nY & DY [1 : %d] = \n\n", Num);
00215   
00216   printf("Elements Information\n\n");
00217   printf(" Index        Surf       Unsat         Sat        Surf       Unsat         Sat\n\n");
00218   
00219   for(i=0; i<DS->NumEle; i++)
00220   {
00221     index = i-(i/DS->NumEle)*DS->NumEle + 1;
00222     printf("%6d%12.4f%12.4f%12.4f", index, NV_Ith_S(CV_Y, i), NV_Ith_S(CV_Y, i + DS->NumEle), 
00223                                            NV_Ith_S(CV_Y, i + 2*DS->NumEle));
00224     printf("%12.4f%12.4f%12.4f\n", NV_Ith_S(CV_Ydot, i), NV_Ith_S(CV_Ydot, i + DS->NumEle), 
00225                                    NV_Ith_S(CV_Ydot, i + 2*DS->NumEle));
00226   }  
00227   
00228   printf("\n");
00229   printf("River Segments Information\n\n");
00230   printf(" Index           Y          DY\n\n");
00231   for(i=0; i<DS->NumRiv; i++)
00232   {
00233     printf("%6d%12.4f%12.4f\n", i+1, NV_Ith_S(CV_Y, i + 3*DS->NumEle), 
00234                                      NV_Ith_S(CV_Ydot, i + 3*DS->NumEle));
00235   }
00236         }       
00237   
00238 }
00239 
00240 
00241 void PrintY(Model_Data DS, N_Vector CV_Y, realtype t)
00242 {
00243   int i, index, Num;
00244         if(DS->UnsatMode ==1)
00245         {    
00246   Num = 2*DS->NumEle + DS->NumRiv;
00247   printf("\nt = %8.2f   Y [1 : %d] = \n\n", t, Num);
00248   
00249   printf("Elements Information\n\n");
00250   printf(" Index        Surf       Unsat         Sat\n\n");
00251   
00252   for(i=0; i<DS->NumEle; i++)
00253   {
00254     index = i-(i/DS->NumEle)*DS->NumEle + 1;
00255     printf("%6d%12.4f%12.4f%12.4f\n", index, NV_Ith_S(CV_Y, i), (pow(1+pow(DS->Ele[i].Alpha*((DS->Ele[i].zmax - DS->Ele[i].zmin)-NV_Ith_S(CV_Y, i + DS->NumEle)+0.05),-DS->Ele[i].Beta),-1/DS->Ele[i].Beta))/DS->Ele[i].Alpha,
00256                                       NV_Ith_S(CV_Y, i + DS->NumEle));
00257   }  
00258   
00259   printf("\n");
00260   printf("River Segments Information\n\n");
00261   printf(" Index           Y\n\n");
00262   for(i=0; i<DS->NumRiv; i++)
00263   {
00264     printf("%6d%12.4f\n", i+1, NV_Ith_S(CV_Y, i + 2*DS->NumEle));
00265   }
00266         }
00267         if(DS->UnsatMode ==2)
00268         {    
00269   Num = 3*DS->NumEle + DS->NumRiv;
00270   printf("\nt = %8.2f   Y [1 : %d] = \n\n", t, Num);
00271   
00272   printf("Elements Information\n\n");
00273   printf(" Index        Surf       Unsat         Sat\n\n");
00274   
00275   for(i=0; i<DS->NumEle; i++)
00276   {
00277     index = i-(i/DS->NumEle)*DS->NumEle + 1;
00278     printf("%6d%12.4f%12.4f%12.4f\n", index, NV_Ith_S(CV_Y, i), 
00279                                       NV_Ith_S(CV_Y, i + DS->NumEle), 
00280                                       NV_Ith_S(CV_Y, i + 2*DS->NumEle));
00281   }  
00282   
00283   printf("\n");
00284   printf("River Segments Information\n\n");
00285   printf(" Index           Y\n\n");
00286   for(i=0; i<DS->NumRiv; i++)
00287   {
00288     printf("%6d%12.4f\n", i+1, NV_Ith_S(CV_Y, i + 3*DS->NumEle));
00289   }
00290         }       
00291   
00292 }
00293 
00294 void FPrintYheader(FILE *res_file, Model_Data mData)
00295 {
00296   int N;
00297         if(mData->UnsatMode ==1)
00298         {    
00299   N = 2*mData->NumEle + mData->NumRiv;
00300         }
00301         if(mData->UnsatMode ==2)
00302         {    
00303   N = 3*mData->NumEle + mData->NumRiv;
00304         }       
00305   fprintf(res_file, "\nPIHM 1.0 State Varibles Result: \n");
00306   fprintf(res_file, "\nNumEle = %8d  NumRiv = %8d\n", mData->NumEle, mData->NumRiv);
00307   fprintf(res_file, "Problem Size N = %8d\n", N); 
00308   fprintf(res_file, "\n");
00309 }
00310 
00311 void FPrintY(Model_Data DS, N_Vector CV_Y, realtype t, FILE *res_file)
00312 {
00313   int i, Num;
00314         if(DS->UnsatMode ==1)
00315         {    
00316   Num = 2*DS->NumEle + DS->NumRiv;
00317 
00318   fprintf(res_file, "Current time = %10.4f", t);
00319   
00320   if (DS->NumEle > 0)
00321   {
00322     fprintf(res_file, "\n\n  Overland Flow Depth (1 :%8d):\n", DS->NumEle);
00323     fprintf(res_file, "\n       ");
00324     for (i=0; i<10; i++)
00325     {
00326       fprintf(res_file, "%16d", i+1);
00327     }  
00328     fprintf(res_file, "\n       ");
00329     
00330     for(i=0; i<DS->NumEle; i++)
00331     {
00332       if (i%10 == 0) {fprintf(res_file, "\n %5d ", i/10);}
00333       fprintf(res_file, "%16.8f", NV_Ith_S(CV_Y, i));
00334     }
00335   
00336     fprintf(res_file, "\n\n  Unsaturated Soil Moisture Equivelant Depth (1 :%8d):\n", DS->NumEle);
00337     fprintf(res_file, "\n       ");
00338     for (i=0; i<10; i++)
00339     {
00340       fprintf(res_file, "%16d", i+1);
00341     }  
00342     fprintf(res_file, "\n       ");
00343     
00344     for(i=0; i<DS->NumEle; i++)
00345     {
00346       if (i%10 == 0) {fprintf(res_file, "\n %5d ", i/10);}
00347       fprintf(res_file, "%16.8f", (pow(1+pow(DS->Ele[i].Alpha*((DS->Ele[i].zmax - DS->Ele[i].zmin)-NV_Ith_S(CV_Y, i + DS->NumEle)+0.05),-DS->Ele[i].Beta),-1/DS->Ele[i].Beta))/DS->Ele[i].Alpha);
00348     }
00349   
00350     fprintf(res_file, "\n\n  Saturated Groundwater Depth (1 :%8d):\n", DS->NumEle);
00351     fprintf(res_file, "\n       ");
00352     for (i=0; i<10; i++)
00353     {
00354       fprintf(res_file, "%16d", i+1);
00355     }  
00356     fprintf(res_file, "\n       ");
00357     
00358     for(i=0; i<DS->NumEle; i++)
00359     {
00360       if (i%10 == 0) {fprintf(res_file, "\n %5d ", i/10);}
00361       fprintf(res_file, "%16.8f", NV_Ith_S(CV_Y, i+DS->NumEle));
00362     }
00363   }
00364   
00365   if (DS->NumRiv > 0)
00366   {
00367     fprintf(res_file, "\n\n  Channel Flow Depth (1 :%8d):\n", DS->NumRiv);
00368     fprintf(res_file, "\n       ");
00369     for (i=0; i<10; i++)
00370     {
00371       fprintf(res_file, "%16d", i+1);
00372     }  
00373     fprintf(res_file, "\n       ");
00374     
00375     for(i=0; i<DS->NumRiv; i++)
00376     {
00377       if (i%10 == 0) {fprintf(res_file, "\n %5d ", i/10);}
00378       fprintf(res_file, "%16.8f", NV_Ith_S(CV_Y, i+2*DS->NumEle));
00379     }
00380   
00381     /*fprintf(res_file, "%16.8f", DS->Q);*/
00382   }  
00383         }
00384         if(DS->UnsatMode ==2)
00385         {    
00386   Num = 3*DS->NumEle + DS->NumRiv;
00387 
00388   fprintf(res_file, "Current time = %10.4f", t);
00389   
00390   if (DS->NumEle > 0)
00391   {
00392     fprintf(res_file, "\n\n  Overland Flow Depth (1 :%8d):\n", DS->NumEle);
00393     fprintf(res_file, "\n       ");
00394     for (i=0; i<10; i++)
00395     {
00396       fprintf(res_file, "%16d", i+1);
00397     }  
00398     fprintf(res_file, "\n       ");
00399     
00400     for(i=0; i<DS->NumEle; i++)
00401     {
00402       if (i%10 == 0) {fprintf(res_file, "\n %5d ", i/10);}
00403       fprintf(res_file, "%16.8f", NV_Ith_S(CV_Y, i));
00404     }
00405   
00406     fprintf(res_file, "\n\n  Unsaturated Soil Moisture Equivelant Depth (1 :%8d):\n", DS->NumEle);
00407     fprintf(res_file, "\n       ");
00408     for (i=0; i<10; i++)
00409     {
00410       fprintf(res_file, "%16d", i+1);
00411     }  
00412     fprintf(res_file, "\n       ");
00413     
00414     for(i=0; i<DS->NumEle; i++)
00415     {
00416       if (i%10 == 0) {fprintf(res_file, "\n %5d ", i/10);}
00417       fprintf(res_file, "%16.8f", NV_Ith_S(CV_Y, i+DS->NumEle));
00418     }
00419   
00420     fprintf(res_file, "\n\n  Saturated Groundwater Depth (1 :%8d):\n", DS->NumEle);
00421     fprintf(res_file, "\n       ");
00422     for (i=0; i<10; i++)
00423     {
00424       fprintf(res_file, "%16d", i+1);
00425     }  
00426     fprintf(res_file, "\n       ");
00427     
00428     for(i=0; i<DS->NumEle; i++)
00429     {
00430       if (i%10 == 0) {fprintf(res_file, "\n %5d ", i/10);}
00431       fprintf(res_file, "%16.8f", NV_Ith_S(CV_Y, i+2*DS->NumEle));
00432     }
00433   }
00434   
00435   if (DS->NumRiv > 0)
00436   {
00437     fprintf(res_file, "\n\n  Channel Flow Depth (1 :%8d):\n", DS->NumRiv);
00438     fprintf(res_file, "\n       ");
00439     for (i=0; i<10; i++)
00440     {
00441       fprintf(res_file, "%16d", i+1);
00442     }  
00443     fprintf(res_file, "\n       ");
00444     
00445     for(i=0; i<DS->NumRiv; i++)
00446     {
00447       if (i%10 == 0) {fprintf(res_file, "\n %5d ", i/10);}
00448       fprintf(res_file, "%16.8f", NV_Ith_S(CV_Y, i+3*DS->NumEle));
00449     }
00450   
00451     /*fprintf(res_file, "%16.8f", DS->Q);*/
00452   }  
00453         }
00454 
00455   fprintf(res_file, "\n\n  Discharge at outlet = %16.8f\n", DS->Q);
00456   fprintf(res_file, "\n");
00457   fflush(res_file);
00458 }
00459 
00460 void FPrintFlux(Model_Data DS, realtype t, FILE *res_file)
00461 {
00462   int i, j, Num;
00463   
00464   fprintf(res_file, "t = %10.4f\n\n", t);
00465   Num = DS->NumEle;
00466   
00467   if (Num > 0) {fprintf(res_file, "  FluxSurf = \n");}
00468   for(i=0; i<Num; i++)
00469   {
00470     fprintf(res_file, "%6d", i+1); 
00471     for(j=0; j<3; j++)
00472     {
00473       fprintf(res_file, "%16.8f", DS->FluxSurf[i][j]);
00474     }
00475     fprintf(res_file, "\n");     
00476   }
00477   
00478   if (Num > 0) {fprintf(res_file, "\n  FluxSub = \n");}
00479   for(i=0; i<Num; i++)
00480   {
00481     fprintf(res_file, "%6d", i+1); 
00482     for(j=0; j<3; j++)
00483     {
00484       fprintf(res_file, "%16.8f", DS->FluxSub[i][j]);
00485     }
00486     fprintf(res_file, "\n");     
00487   }
00488   
00489   Num = DS->NumRiv;
00490   
00491   if (Num > 0) {fprintf(res_file, "\n  FluxRiv = \n");}
00492   for(i=0; i<Num; i++)
00493   {
00494     fprintf(res_file, "%6d", i+1); 
00495     for(j=0; j<6; j++)
00496     {
00497       fprintf(res_file, "%16.8f", DS->FluxRiv[i][j]);
00498     }
00499     fprintf(res_file, "\n");     
00500   }
00501   fprintf(res_file, "\nQ at outlet = %16.8f\n", DS->Q);
00502   fprintf(res_file, "\n");
00503   fflush(res_file);
00504 }
00505 
00506 void FPrintETISheader(FILE *res_file, Model_Data DS)
00507 {
00508   int Num;
00509   
00510   Num = DS->NumEle;
00511   
00512   fprintf(res_file, "\nIHM 1.0 ET and Interception Result: \n");
00513   fprintf(res_file, "\nNumEle = %8d  NumRiv = %8d\n", DS->NumEle, DS->NumRiv);
00514         if(DS->UnsatMode ==1)
00515         {    
00516   fprintf(res_file, "Problem Size N = %8d", 2*Num + DS->NumRiv); 
00517         }
00518         if(DS->UnsatMode ==2)
00519         {    
00520   fprintf(res_file, "Problem Size N = %8d", 3*Num + DS->NumRiv); 
00521         }
00522   fprintf(res_file, "\n");
00523 }
00524 
00525 void FPrintETIS(Model_Data DS, realtype t, FILE *res_file)
00526 {
00527   int i, j, Num;
00528   
00529   fprintf(res_file, "\nCurrent time = %10.4f", t);
00530   Num = DS->NumEle;
00531 
00532   if (Num > 0)
00533   {
00534     fprintf(res_file, "\n\n  Interception Storage (1 :%8d):\n", DS->NumEle);
00535     fprintf(res_file, "\n       ");
00536     for (i=0; i<10; i++)
00537     {
00538       fprintf(res_file, "%16d", i+1);
00539     }  
00540     fprintf(res_file, "\n       ");
00541   
00542     for(i=0; i<Num; i++)
00543     {
00544       if (i%10 == 0) {fprintf(res_file, "\n %5d ", i/10);}
00545       fprintf(res_file, "%16.10f", DS->EleIS[i]);
00546     }
00547 
00548     fprintf(res_file, "\n\n  Envapotranpiration (1 :%8d):\n", DS->NumEle);
00549   
00550     fprintf(res_file, "\n       ");
00551     for (i=0; i<10; i++)
00552     {
00553       for (j=0; j<4; j++)
00554       {
00555         fprintf(res_file, "%14d_%1d", i+1, j);
00556       }  
00557     }  
00558     fprintf(res_file, "\n       ");
00559   
00560     for(i=0; i<Num; i++)
00561     {
00562       if (i%10 == 0) {fprintf(res_file, "\n %5d ", i/10);}
00563       for(j=0; j<4; j++)
00564       {
00565         fprintf(res_file, "%16.10f", DS->EleET[i][j]);
00566       }
00567     }
00568   }
00569   fprintf(res_file, "\n");
00570   fflush(res_file);
00571 }
00572 
00573 void FPrintQ(Model_Data DS, realtype t, FILE *res_file)
00574 {
00575   fprintf(res_file, "\ntime = %10.4f,  Q = %-16.8f", t, DS->Q);
00576   fflush(res_file);
00577 }
00578 
00579 /*void PrintVerbose(int i, realtype t, long int iopt[], realtype ropt[])
00580 {
00581   printf("  Step %5d: ", i+1);  
00582   printf("t =%10.4lf  t_r =%10.4lf", t, ropt[TCUR]);
00583   printf("  DeltT =%6.4lf  N_DeltT =%6.4lf", ropt[HU], ropt[HCUR]);
00584   printf("  Order = %1ld",  iopt[QU]);
00585   printf("  InterStep =%6ld  RHS Eval =%6ld", iopt[NST], iopt[NFE]);
00586   printf("\n");
00587 }      
00588 
00589 void PrintFarewell(Control_Data cData, long int iopt[], realtype ropt[], realtype cputime_r, realtype cputime_s)
00590 {
00591   if (cData.Verbose != 1) {printf("\n");}
00592   printf("\nCongratulations! Simulation Finishes Successfully. \n");
00593   if(cData.Verbose == 1)
00594   { 
00595     PrintFinalStats(iopt, ropt); 
00596   }
00597   
00598   if (cData.Verbose != 1) {printf("\n");}
00599   if(cData.Solver == 1) {printf("Full Dense Direct Solver.\n");}
00600   else if(cData.Solver == 2) {printf("Iterative GMRES Solver.\n");}
00601   printf("Time taken to read in files    = %10.4f seconds. \n", cputime_r);
00602   printf("Time taken to solve ODE system = %10.4f seconds. \n", cputime_s);  
00603   printf("\nThanks for running PIHM 1.0. \n");
00604 }
00605 */
00606 /* function to print out Final Status to stdout */
00607 /* void PrintFinalStats(long int iopt[], realtype ropt[])
00608 {
00609   printf("\nFinal Statistics.. \n\n");
00610   printf("Num Int Steps = %-6ld  Num Linear Sol Setup = %-6ld  RHS Eval   = %-6ld  Num.Jac.Eval   = %-6ld\n",
00611          iopt[NST], iopt[NSETUPS], iopt[NFE], iopt[DENSE_NJE]);
00612   printf("Newton Iter # = %-6ld  Nonlinear Failure #  = %-6ld  Err Failed = %-6ld  Last Step Size = %-6.2lf\n",
00613          iopt[NNI], iopt[NCFN], iopt[NETF], ropt[HU]);
00614   printf("Real Workspace Size: CVODE = %-6ld Solver = %-6ld\n", iopt[LENRW], iopt[DENSE_LRW]); 
00615   printf("Int Workspace Size:  CVODE = %-6ld Solver = %-6ld\n\n", iopt[LENIW], iopt[DENSE_LIW]);
00616 }
00617 
00618 void FPrintFarewell(Control_Data cData, FILE *res_file, long int iopt[], realtype ropt[], realtype cputime_r, realtype cputime_s)
00619 {
00620   fprintf(res_file, "\nCongratulations! Simulation Finishes Successfully. \n");
00621   FPrintFinalStats(res_file, iopt, ropt); 
00622   fprintf(res_file, "The Solver is ");
00623   
00624   if(cData.Solver == 1) {fprintf(res_file, "Full Dense Direct Solver.\n");}
00625   else if(cData.Solver == 2) {fprintf(res_file, "Iterative GMRES Solver.\n");}
00626   
00627   fprintf(res_file, "Time taken to read in files    = %10.4f seconds. \n", cputime_r);
00628   fprintf(res_file, "Time taken to solve ODE system = %10.4f seconds. \n", cputime_s);  
00629   fprintf(res_file, "\nThanks for running PIHM 1.0. \n");  
00630 }
00631 */
00632 /* function to print out Final Status to output files */
00633 /* void FPrintFinalStats(FILE *res_file, long int iopt[], realtype ropt[])
00634 {
00635   fprintf(res_file, "\nFinal Statistics.. \n\n");
00636   fprintf(res_file, "Num Int Steps = %-6ld  Num Linear Sol Setup = %-6ld  RHS Eval   = %-6ld  Num.Jac.Eval   = %-6ld\n",
00637          iopt[NST], iopt[NSETUPS], iopt[NFE], iopt[DENSE_NJE]);
00638   fprintf(res_file, "Newton Iter # = %-6ld  Nonlinear Failure #  = %-6ld  Err Failed = %-6ld  Last Step Size = %-6.2lf\n",
00639          iopt[NNI], iopt[NCFN], iopt[NETF], ropt[HU]);
00640   fprintf(res_file, "Real Workspace Size: CVODE = %-6ld Solver = %-6ld\n", iopt[LENRW], iopt[DENSE_LRW]); 
00641   fprintf(res_file, "Int Workspace Size:  CVODE = %-6ld Solver = %-6ld\n\n", iopt[LENIW], iopt[DENSE_LIW]);
00642 }
00643 */

Generated on Sun Aug 5 17:33:59 2007 for PIHMgis by  doxygen 1.5.2