Everglades Landscape Model (ELM) Home Page
Main Page | Data Structures | Directories | File List | Data Fields | Globals

generic_driver.h File Reference

Header file for Generic Driver. More...

#include "globals.h"

Include dependency graph for generic_driver.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define numRunSets   150

Functions

void get_parmf ()
 Get user's run-time parameters from configuration file.
void setup ()
 Controller to call functions to set up & initialize the model.
void track_time (int istep)
 Keep track of simulation time.
ViewParmread_output_parms (void)
 Call the read_output_parms function.
void read_model_parameters (char *s_parm_name, int s_parm_relval)
 Call functions to read model parameters from datafiles.
void getInt (FILE *inFile, const char *lString, int *iValPtr)
 Get an integer following a specific string.
void getFloat (FILE *inFile, const char *lString, float *fValPtr)
 Get a float value following a specific string.
void getString (FILE *inFile, const char *lString, char *inString)
 Get a string following a specific string.
void calcdate (double jd, int *m, int *d, int *y, int *h, int *mi, double *sec)
 Determine the Gregorian date from a Julian calendar day.
void setup_platform ()
 Effectively unused in serial (non-parallel) implementation.
void set_env_vars (void)
 Acquire necessary environment variables.
void setup_grid ()
 Provide the 2D array size for the model domain.
int skip_white (FILE *infile)
 Skip white space(s) in a file.
int scan_forward (FILE *infile, const char *tstring)
 Scan forward until a particular string is found.
double julday (int mon, int day, int year, int h, int mi, double se)
 Determine the Julian calendar day from a Gregorian date.
float FMOD (float x, float y)
 Modulus of a pair of (double) arguments.
void local_setup (int argc, char **argv)
 Does very little in serial implementation (opens a low-level debug file).
void open_debug_outFile (int index)
 Open debug-related output files.
void broadcastInt (int *iValPtr)
 Parallel code: does nothing in serial implementation).
void sync_processors ()
 Parallel code: does nothing in serial implementation).
void send_point_lists2 (SeriesParm *pSeries, int nSeries)
 Point time series output: print time series data to file(s).
void open_point_lists (SeriesParm *pSeries, int nSeries)
 Point time series output: open files and print headers.
void init_static_data (void)
 Initialize static spatial data.
void init_dynam_data (void)
 Initialize dynamic spatial data.
void init_eqns (void)
 Initialization of the model equations.
void init_canals (int runNumb)
 Call to initialize the water managment canal network topology and data.
void init_succession (void)
 Call to initialize the habitat succession module.
void reinitBIR (void)
 Calls to re-initialize Basin/Indicator-Region data.
void reinitCanals (void)
 Call to re-initialize canal storages.
void alloc_memory ()
 Allocate memory.
void gen_output (int step, ViewParm *view)
 Generate output.
void get_map_dims (void)
 Get the map dimensions of the global model array.
int call_cell_dyn (int sector, int step)
 Calling function for the cell_dyn** dynamic ecological modules.

Variables

int NSector
int iSector [MAX_SECTOR]
int seed
int ESPmodeON = 0
int WatMgmtOn
int HabSwitchOn
int PositAnalOn = 0
char SimAlt [20]
char SimModif [20]
char outpath [120]
int gbl_size [2]
char initDateRead [15]
double Jdate_init
double Jdate_end
int yr_in
int mo_in
int da_in
int hr_in
int mi_in
int se_in
int yr_end
int mo_end
int da_end
int mo_R_in
int da_R_in
int PORnumday
int N_iter
int istep
float step_Cell
float avg_Intvl = 0
float budg_Intvl = 0
float BIRavg_Intvl = 0
float can_Intvl = 0
int budgCalendar
int avgCalendar = 0
int canalCalendar = 0
int avgPrint = 0
int canPrint = 0
ProgAttrProgExec
ProgAttr ** RunList
float gRTable []
ViewParmview
SeriesParm pSeries [MAX_PTSERIES]
Point2D dbgPt
nodenv env
int procnum
int Lprocnum
int nprocs [2]
int recpnum [2]
int tramType
int tramNum [2]
int lcl_size [2]
int lcl_start [2]
char * ModelPath
char * ProjName
char * OS_TYPE
char * OutputPath
char modelName [20]
char modelVers [10]


Detailed Description

Header file for Generic Driver.

This defines or declares variables & functions that are global to Generic_Driver.c.

Note: documented with Doxygen, which expects specific syntax within special comments.

The Everglades Landscape Model (ELM).
last updated: Jan 2005

Definition in file generic_driver.h.


Define Documentation

#define numRunSets   150
 

Definition at line 75 of file generic_driver.h.


Function Documentation

void get_parmf  ) 
 

Get user's run-time parameters from configuration file.

This is where the application is set up by the user's edits to the Driver.parm text configuration file, providing the simulation start and end dates, grid cell size, debug level, model scenario name, etc.

Variables local to function

stop boolean flag to stop reading sector (celldyn module) numbers
ch character used in delineating the reading of sector (celldyn module) numbers/syntax
infile an input file pointer representing the Driver.parm file
filename the filename, including path, of the Driver.parm file
ss a string being parsed to read model configuration information from the Driver.parm file
Re_initDateRead data of simulation re-initialization (Position Analysis mode)
endDateRead date of end of simulation

Definition at line 265 of file Generic_Driver.c.

References alloc_mem_runs(), avg_Intvl, avgCalendar, broadcastInt(), budg_Intvl, budgCalendar, can_Intvl, canalCalendar, canstep, CELL_SIZE, celWid, da_end, da_in, da_R_in, seriesParm::data, dbgPt, debug, dt, ESPmodeON, getFloat(), getInt(), getString(), gwstep, HabSwitchOn, hr_in, hyd_iter, initDateRead, iSector, Jdate_end, Jdate_init, julday(), mi_in, mo_end, mo_in, mo_R_in, modelName, ModelPath, modelVers, msgStr, N_iter, NSector, open_debug_outFile(), outpath, OutputPath, PORnumday, PositAnalOn, procnum, ProgExec, ProjName, pSeries, RunList, prog_attr::S_ParmName, prog_attr::S_ParmRelVal, scan_forward(), se_in, seed, SensiOn, sfstep, SimAlt, SimModif, skip_white(), sq_celWid, step_Cell, usrErr(), WatMgmtOn, WriteMsg(), point2D::x, point2D::y, yr_end, and yr_in.

Referenced by setup().

00266 {
00277     int i=0, stop=0;
00278     unsigned char ch;
00279     FILE *infile;
00280     char filename[120], ss[120]; 
00281         char Re_initDateRead[15], endDateRead[15]; 
00282         int SParmNum_TEMP = 150; /* TODO: will get this from reading the senitivity-parameter list */
00283         
00284     sprintf(filename,"%s/%s/RunParms/Driver.parm",ModelPath,ProjName);
00285     infile = fopen(filename,"r");
00286     if(infile==NULL) { fprintf(stderr,"Error, can't open file %s",filename); exit(0); }
00287 
00288      
00289     fgets(ss,120,infile);
00290     sscanf(ss,"%s",outpath);    
00291     OutputPath = (char*)&outpath; /* path for all output */
00292     open_debug_outFile(0); /* opens the Driver0.out debug file */
00293 
00294     /* start date  */
00295     fgets(ss,120,infile);
00296     sscanf(ss,"%s",initDateRead); /* read in as yyyy/mm/dd format */
00297 
00298     sprintf(msgStr,"initDateRead=%s\n",initDateRead); WriteMsg(msgStr,1); 
00299     sscanf(initDateRead, "%4d/%2d/%2d,",&yr_in,&mo_in,&da_in); /* starting date of sim */
00300 
00301     /* julian day, returns a double (args = month, day, year, hour, minute, second) */
00302     Jdate_init = julday(mo_in, da_in, yr_in, hr_in, mi_in, se_in); 
00303 
00304 
00305      /* end date  */
00306     fgets(ss,120,infile);
00307     sscanf(ss,"%s",endDateRead); /* read in as yyyy/mm/dd format */
00308 
00309     sprintf(msgStr,"endDateRead=%s\n",endDateRead); WriteMsg(msgStr,1); 
00310     sscanf(endDateRead, "%4d/%2d/%2d,",&yr_end,&mo_end,&da_end); /* ending date of sim */
00311  
00312         /* julian day, returns a double (args = month, day, year, hour, minute, second) */
00313     Jdate_end = julday(mo_end, da_end, yr_end, hr_in, mi_in, se_in); 
00314 
00315     /* re-initialization date  */
00316     fgets(ss,120,infile);
00317     sscanf(ss,"%s",Re_initDateRead); /* read in as mm/dd format */
00318 
00319     sprintf(msgStr,"Re_initDateRead=%s\n",Re_initDateRead); WriteMsg(msgStr,1); 
00320     sscanf(Re_initDateRead, "%2d/%2d,",&mo_R_in,&da_R_in); /* re-initialize month/day */
00321 
00322     if (mo_R_in>0) {
00323         PositAnalOn=True;   /* in position analysis mode, we re-initialize every year on same month/day */
00324         sprintf(msgStr,"\n *** WARNING: Position Analysis capabilities are NOT VERIFIED FOR accuracy/consistency in ELMv2.3 - the Avg's, Basin/Indicator-Region output may not be reliable ***\n"); 
00325         WriteMsg(msgStr,1); 
00326         usrErr(msgStr); 
00327         }       /* TODO: fix the budget/stats re-inits for Position Analysis mode */ 
00328 
00329     fgets(ss,120,infile);
00330     sscanf(ss,"%s",modelName);    
00331     sprintf(msgStr, "Model Name= %s", modelName); usrErr(msgStr); WriteMsg(msgStr,1);
00332     getString(infile,"Model version=",modelVers); /* model version number (eg., v.2.1) */
00333     sprintf(msgStr,"Model version=%s\n",modelVers); WriteMsg(msgStr,1);  
00334 
00335     getFloat(infile,"CellArea=",&CELL_SIZE);
00336     sprintf(msgStr,"CellArea=%f\n",CELL_SIZE); WriteMsg(msgStr,1); 
00337     celWid = sqrt(CELL_SIZE); /* cell width, used in number of hydro calcs */
00338     sq_celWid = sqrt(celWid); /* square root of cell width, used in number of hydro calcs */
00339     
00340 
00341     getFloat(infile,"budg_Intvl=",&budg_Intvl);
00342     sprintf(msgStr,"budg_Intvl=%f\n",budg_Intvl); WriteMsg(msgStr,1); 
00343     budgCalendar = ( budg_Intvl == 0.0 ) ? (True) : (False); /* true/false flag signifying use of gregorian calendar for budget calcs
00344                                                                                 a budg_Intvl of 0 days defaults to gregorian calendar-month
00345                                                                                 intervals ( = #days/month, diff among months/years) 
00346                                                                                 In this case, the true/false budgCalendar flag is set to True */
00347 
00348     getFloat(infile,"avg_Intvl=",&avg_Intvl);
00349     sprintf(msgStr,"avg_Intvl=%f\n",avg_Intvl); WriteMsg(msgStr,1); 
00350     if ( avg_Intvl == 0 ) avgCalendar = True; /* true/false flag signifying use of gregorian calendar for recurring averaging calcs
00351                                                                                 an avg_Intvl of 0 days defaults to gregorian calendar-month
00352                                                                                 intervals ( = #days/month, diff among months/years) 
00353                                                                                 In this case, the true/false avgCalendar flag is set to True */
00354 
00355     getFloat(infile,"can_Intvl=",&can_Intvl);
00356     sprintf(msgStr,"can_Intvl=%f\n",can_Intvl); WriteMsg(msgStr,1); 
00357     if ( can_Intvl == 0 ) canalCalendar = True; /* true/false flag signifying use of gregorian calendar for recurring canal (watmanage) calcs
00358                                                                                 a can_Intvl of 0 days defaults to gregorian calendar-month
00359                                                                                 intervals ( = #days/month, diff among months/years) 
00360                                                                                 In this case, the true/false can_Intvl flag is set to True */
00361 
00362     getInt(infile,"seed=",&seed);
00363     sprintf(msgStr,"seed=%d\n",seed); WriteMsg(msgStr,1);  
00364     getFloat(infile,"dt=",&dt);
00365     sprintf(msgStr,"dt=%f\n",(double)dt); WriteMsg(msgStr,1);  
00366     getInt(infile,"hyd_iter=",&hyd_iter); 
00367     sprintf(msgStr,"hyd_iter=%d\n",hyd_iter); WriteMsg(msgStr,1); 
00368 
00369     sfstep = dt/hyd_iter;     /* time step for cell-cell overland flows */
00370     gwstep = dt/(hyd_iter/2); /* time step for cell-cell ground water flows (twice as long as surface water)*/
00371     canstep = dt/hyd_iter;             /* time step for canal flows */
00372     step_Cell = sq_celWid * sfstep/CELL_SIZE * sec_per_day; /* constant used in horizontal surface water raster flux equations */
00373 
00374     N_iter= (Jdate_end - Jdate_init + 1)/dt;
00375         sprintf(msgStr,"N_iter=%d\n",N_iter); WriteMsg(msgStr,1); 
00376     PORnumday = (int)(Jdate_end - Jdate_init + 1);   /* number of days of simulation Period Of Record */
00377 
00378     getInt(infile,"debug=",&debug);
00379     sprintf(msgStr,"debug=%d\n",debug); WriteMsg(msgStr,1);  
00380     getInt(infile,"debug_point=",&dbgPt.x);
00381     getInt(infile,NULL,&dbgPt.y);
00382     sprintf(msgStr,"debug point= (%d,%d)\n",dbgPt.x,dbgPt.y); WriteMsg(msgStr,1);  
00383         
00384         alloc_mem_runs(SParmNum_TEMP);
00385         RunList[0] = ProgExec; /* nominal parameter set */
00386         
00387     getString(infile,"S_ParmName=",ProgExec->S_ParmName); /* value can be: 
00388                                         1) "NONE", for no sensitivity analysis (nominal parameter set);
00389                                         2) the name of a global or habitat-specific parameter for a single-parm sensitivity analysis; 
00390                                         3) "ALL", leading to multi-parameter sensitivity analyses on 
00391                                            all parameters, to be read from an input list */
00392     sprintf(msgStr,"S_ParmName=%s\n",ProgExec->S_ParmName); WriteMsg(msgStr,1); 
00393 
00394     SensiOn = (strcmp(ProgExec->S_ParmName,"NONE")!=0) ? (True) : (False);
00395     ProgExec->S_ParmRelVal = 0; /* first run of program is ALWAYS the nominal (no parameter-changes) run */
00396 
00397         getInt(infile,"HabSwitchOn=",&HabSwitchOn); /* flag to turn on habitat switching */
00398     sprintf(msgStr,"HabSwitchOn=%d\n",HabSwitchOn); WriteMsg(msgStr,1); 
00399     getInt(infile,"WatMgmtOn=",&WatMgmtOn); /* flag to turn on canal/water management */
00400     sprintf(msgStr,"WatMgmtOn=%d\n",WatMgmtOn); WriteMsg(msgStr,1); 
00401 
00402     getString(infile,"Scenario=",SimAlt); /* simulation's scenario/alternative */
00403     sprintf(msgStr,"SimAlt=%s\n",SimAlt); WriteMsg(msgStr,1);  
00404     getString(infile,"Scenario modifier=",SimModif); /* simulation's scenario/alternative & modifier */
00405     sprintf(msgStr,"SimModif=%s\n",SimModif); WriteMsg(msgStr,1); 
00406 
00407         scan_forward(infile,"Sectors="); i=0; stop=0;
00408         while(1) {
00409             skip_white(infile);
00410             ch=fgetc(infile);
00411             if( isdigit(ch) ) ungetc(ch,infile);
00412             else {
00413                 switch (ch) {
00414                     case ';':  NSector = i; stop=1; break;
00415                     case ',':  skip_white(infile); break;
00416                 }
00417             }
00418             if(stop) break;
00419             else fscanf(infile,"%d",&iSector[i++]);
00420                 /* sector 13 is the ESP (Everglades Settling-of Phosphorus, i.e., EWQModel emulation) mode - this sets the ESPmodeON flag*/
00421             if (iSector[i-1] == 13) ESPmodeON=1;
00422             
00423         }
00424         fclose(infile);  
00425     broadcastInt(&NSector);
00426     sprintf(msgStr,"\n(%d) NSector = %d: Sectors=",procnum,NSector); WriteMsg(msgStr,1); 
00427     for(i=0; i<NSector; i++) {
00428         broadcastInt(&iSector[i]);
00429         sprintf(msgStr,"(%d:%d)",i,iSector[i]); WriteMsg(msgStr,1);  
00430     }
00431 
00432     for(i=0; i<MAX_PTSERIES; i++) if(pSeries[i].data) { free((char*)pSeries[i].data);  pSeries[i].data = NULL; }
00433 }

Here is the call graph for this function:

void setup  ) 
 

Controller to call functions to set up & initialize the model.

Several function calls here effectively do nothing in serial (i.e., non-parallel) implementations.

Definition at line 246 of file Generic_Driver.c.

References seriesParm::data, get_map_dims(), get_parmf(), pSeries, set_env_vars(), setup_grid(), and setup_platform().

Referenced by main().

00247 {
00248   int i;
00249   for(i=0; i<MAX_PTSERIES; i++)  pSeries[i].data = NULL; /* initialize Point Time Series arrays */
00250   setup_platform(); /* effectively unused in serial (non-parallel) implementation */
00251   set_env_vars();   /* get necessary enviroment variables */ 
00252   get_parmf();      /* get the run-time parameters  */ 
00253   get_map_dims();   /* get the row-column dimensions of the global model array size */
00254   setup_grid();     /* set up a grid size used in memory allocations (other stuff for parallel) */
00255 }

Here is the call graph for this function:

void track_time int  istep  ) 
 

Keep track of simulation time.

The elapsed days, the gregorian and julian calendars, and several end-of calendar- month, year etc flags are updated with each iteration.

Parameters:
istep counter for number of model time iterations

Definition at line 443 of file Generic_Driver.c.

References avg_Intvl, avgPrint, BIRavg_Intvl, budg_Intvl, calcdate(), can_Intvl, canPrint, simTime::da, simTime::hr, simTime::IsBIRavgEnd, simTime::IsBudgEnd, simTime::IsBudgFirst, simTime::IsDay0, simTime::IsDrySeasEnd, simTime::IsMonthEnd, simTime::IsSimulationEnd, istep, simTime::IsWetSeasEnd, simTime::IsYearEnd, simTime::Jdate, Jdate_init, simTime::mi, simTime::mo, N_iter, PORnumday, simTime::se, SimTime, simTime::TIME, and simTime::yr.

Referenced by main().

00444 {
00445     int yr_tom[2];                      /* calendar year of tomorrow's model time */
00446     int mo_tom[2];                              /* calendar month of tomorrow's  model time */
00447     int da_tom[2];                              /* calendar day of tomorrow's  model time */
00448     int hr_tom[2];                              /* calendar hour of tomorrow's  model time (unused in model calcs) */
00449     int mi_tom[2];                              /* calendar minute of tomorrow's  model time (unused in model calcs) */
00450     double se_tom[2];                   /* calendar second of tomorrow's  model time (unused in model calcs) */
00451      
00452     SimTime.TIME = istep*dt;
00453     SimTime.Jdate = Jdate_init+SimTime.TIME; /*  increment the julian day counter */
00454         
00455         /* use calendar functions to determine the end-of status of today's date */
00456         calcdate( (SimTime.Jdate+1), mo_tom, da_tom, yr_tom, hr_tom, mi_tom, se_tom); /* for TOMORROW, get the calendar date info from the julian date */
00457         calcdate( SimTime.Jdate, SimTime.mo, SimTime.da, SimTime.yr, SimTime.hr, SimTime.mi, SimTime.se); /* for TODAY, get the calendar date info from the julian date */
00458 
00459                 SimTime.IsMonthEnd = ( SimTime.mo[0] != mo_tom[0] ) ? (True) : (False); /* true/false flag signifying end of a gregorian calendar month */
00460                 SimTime.IsYearEnd =  ( SimTime.yr[0] != yr_tom[0] ) ? (True)  : (False); /* true/false flag signifying end of a gregorian calendar year */
00461                 SimTime.IsWetSeasEnd = (( SimTime.mo[0] == wetEndMon ) && (SimTime.da[0] == wetEndDay))  ? (True) : (False); /* true/false flag signifying end of a gregorian calendar-based wet season */
00462                 SimTime.IsDrySeasEnd = (( SimTime.mo[0] == dryEndMon ) && (SimTime.da[0] == dryEndDay))  ? (True) : (False); /* true/false flag signifying end of a gregorian calendar-based dry season */
00463                 SimTime.IsSimulationEnd = ((PORnumday-1)==istep) ? (True) : (False);
00464 
00465         /* determine status of budget calc/printing flag (interval based on gregorian calendar or constant julian-day) */
00466         if (!budgCalendar) { 
00467                 if ( fmod(SimTime.TIME, budg_Intvl) ==0) {
00468                 /* not using gregorian calendar: at end of (constant) number of days, model time is end of budget interval */
00469                         SimTime.IsBudgEnd = True; 
00470                 } 
00471                 else { SimTime.IsBudgEnd = False; }
00472         }
00473         else {
00474                 if ( SimTime.IsMonthEnd ) {
00475                 /* using gregorian calendar: at calendar-month's end, model time is end of budget interval */
00476                         SimTime.IsBudgEnd = True; 
00477                         budg_Intvl= (float)SimTime.da[0]; /* dynamic interval becomes number of days in current gregorian-calendar month */
00478                 } 
00479                 else { SimTime.IsBudgEnd = False; }
00480         }
00481 
00482         /* determine status of cell-specific averages calc/printing flag (interval based on gregorian calendar or constant julian-day) */
00483         if (!avgCalendar) {
00484                 if ( fmod(SimTime.TIME, avg_Intvl) ==0) {
00485                 /* not using gregorian calendar: check for time (day) to finalize and print budgets for current interval */
00486                         avgPrint = True; }
00487                 else { avgPrint = False; }
00488         }
00489         else { 
00490                 if ( SimTime.IsMonthEnd ) {
00491                 /* using gregorian calendar: at month's end, it is time (day) to finalize and print budgets for current interval */
00492                         avgPrint = True;
00493                         avg_Intvl= (float)SimTime.da[0]; /* interval becomes number of days in current gregorian-calendar month */
00494                 }
00495                 else { avgPrint = False; }
00496         }
00497 
00498         /* determine status of canal data calc/printing flag (interval based on gregorian calendar or constant julian-day) */
00499         if (!canalCalendar) {
00500                 if ( fmod(SimTime.TIME, can_Intvl) ==0) {
00501                 /* not using gregorian calendar: check for time (day) to finalize and print canal data for current interval */
00502                         canPrint = True; }
00503                 else { canPrint = False; }
00504         }
00505         else { 
00506                 if ( SimTime.IsMonthEnd ) {
00507                 /* using gregorian calendar: at month's end, it is time (day) to finalize and print canal data for current interval */
00508                         canPrint = True;
00509                         can_Intvl= (float)SimTime.da[0]; /* interval becomes number of days in current gregorian-calendar month */
00510                 }
00511                 else { canPrint = False; }
00512         }
00513         
00514         SimTime.IsBudgFirst = ( (SimTime.TIME/budg_Intvl) > 1 ) ? (False) : (True);
00515         SimTime.IsDay0 = (SimTime.TIME==0) ? (True) : (False);
00516         
00517         /* TODO: this is to be generalized in MultiRun.c */
00518         if (SensiOn) {
00519            BIRavg_Intvl = N_iter - 1;
00520            SimTime.IsBIRavgEnd = ( fmod(SimTime.TIME, BIRavg_Intvl) ==0) ? (True) : (False);
00521            
00522            budg_Intvl = N_iter - 1;
00523            SimTime.IsBudgEnd = ( fmod(SimTime.TIME, budg_Intvl) ==0) ? (True) : (False);
00524         }
00525         else {
00526            BIRavg_Intvl = budg_Intvl;
00527            SimTime.IsBIRavgEnd = SimTime.IsBudgEnd;
00528         }
00529 
00530 }

Here is the call graph for this function:

ViewParm* read_output_parms  ) 
 

Call the read_output_parms function.

Returns:
pointer to struct of ViewParm

Definition at line 59 of file Driver_Utilities.c.

Referenced by main().

00059                               {
00060 /* need to change the Outlist_size (#defined in header) if adding outlist variables to the data struct in gen_output of UnitMod.c */
00061     ViewParm* v = readOutlist(Outlist_size);
00062     return v;
00063 } 

void read_model_parameters char *  s_parm_name,
int  s_parm_relval
 

Call functions to read model parameters from datafiles.

Parameters:
s_parm_name Name of the sensitivity parameter being varied for this run
s_parm_relval Indicator of current value of relative range in sensitivity parm values: nominal (0), low (1), or high (2)

Definition at line 35 of file Driver_Utilities.c.

00035                                                                   {
00036 
00037     sprintf(msgStr,"Reading global parameters..."); 
00038     WriteMsg(msgStr,1); 
00039     usrErr0(msgStr);
00040 
00041         ReadGlobalParms(s_parm_name, s_parm_relval);
00042     sprintf(msgStr,"done."); 
00043     WriteMsg(msgStr,1); 
00044     usrErr(msgStr);
00045         
00046     sprintf(msgStr,"Reading habitat-specific parameters..."); 
00047     WriteMsg(msgStr,1); 
00048     usrErr0(msgStr);
00049 
00050         ReadHabParms(s_parm_name, s_parm_relval);
00051     sprintf(msgStr,"done."); 
00052     WriteMsg(msgStr,1); 
00053     usrErr(msgStr);
00054   
00055 }

void getInt FILE *  inFile,
const char *  lString,
int *  iValPtr
 

Get an integer following a specific string.

Parameters:
inFile File that is open
lString The string being read
iValPtr The char value found

Definition at line 1657 of file Driver_Utilities.c.

01658 {
01659   int test;
01660   UCHAR iEx=0;
01661   if(lString)  
01662     scan_forward(inFile,lString);
01663   test = fscanf(inFile,"%d",iValPtr);
01664   if(test != 1) {
01665     fprintf(stderr,"Read Error (%d):",test);
01666     if(lString) fprintf(stderr,"%s\n",lString);
01667     *iValPtr = 0;
01668     iEx = 1;
01669   }
01670   if (iEx) exit(0);
01671 }

void getFloat FILE *  inFile,
const char *  lString,
float *  fValPtr
 

Get a float value following a specific string.

Parameters:
inFile File that is open
lString The string being read
fValPtr The float number found

Definition at line 1600 of file Driver_Utilities.c.

01601 {
01602   int test, fSize;
01603   UCHAR iEx=0;
01604   if(lString)  scan_forward(inFile,lString);
01605   test = fscanf(inFile,"%f",fValPtr);
01606   if(test != 1) {
01607     fprintf(stderr,"Read Error (%d):",test);
01608     if(lString) fprintf(stderr,"%s\n",lString);
01609     *fValPtr = 0.0;
01610     iEx = 1;
01611   }
01612   if (iEx) exit(0);
01613 }

void getString FILE *  inFile,
const char *  lString,
char *  inString
 

Get a string following a specific string.

Parameters:
inFile File that is open
lString The string being read
inString The string found

Definition at line 1639 of file Driver_Utilities.c.

01640 {
01641   int test;
01642   UCHAR iEx=0;
01643   if(lString)  scan_forward(inFile,lString);
01644   test = fscanf(inFile,"%s",inString);
01645   if(test != 1) {
01646     fprintf(stderr,"Read Error (%d):",test);
01647     if(lString) fprintf(stderr,"%s\n",lString);
01648     iEx = 1;
01649   }
01650   if (iEx) exit(0);
01651 }

void calcdate double  jd,
int *  m,
int *  d,
int *  y,
int *  h,
int *  mi,
double *  sec
 

Determine the Gregorian date from a Julian calendar day.

Julian date converter. Takes a julian date (the number of days since some distant epoch or other), and returns an int pointer to static space. ip[0] = month; ip[1] = day of month; ip[2] = year (actual year, like 1977, not 77 unless it was 77 a.d.); ip[3] = day of week (0->Sunday to 6->Saturday) These are Gregorian. Copied from Algorithm 199 in Collected algorithms of the CACM Author: Robert G. Tantzen, Translator: Nat Howard. All taken (unmodified) from SFWMD HSM's /vol/hsm/src/libs/xmgr_julday/ directory.

Parameters:
jd Julian day
m Month
d Day
y Year
h Hour
mi Minute
sec Second

Definition at line 1547 of file Driver_Utilities.c.

01548 {
01549   static int ret[4];
01550 
01551   long j = (long)jd;
01552   double tmp, frac = jd - j;
01553 
01554   if (frac >= 0.5) {
01555     frac = frac - 0.5;
01556     j++;
01557   } 
01558   else {
01559     frac = frac + 0.5;
01560   }
01561 
01562   ret[3] = (j + 1L) % 7L;
01563   j -= 1721119L;
01564   *y  = (4L * j - 1L) / 146097L;
01565   j = 4L * j - 1L - 146097L * *y;
01566   *d  = j / 4L;
01567   j = (4L * *d + 3L) / 1461L;
01568   *d = 4L * *d + 3L - 1461L * j;
01569   *d = (*d + 4L) / 4L;
01570   *m = (5L * *d - 3L) / 153L;
01571   *d = 5L * *d - 3 - 153L * *m;
01572   *d = (*d + 5L) / 5L;
01573   *y = 100L * *y + j;
01574   if (*m < 10)
01575     *m += 3;
01576   else {
01577     *m -= 9;
01578     *y += 1;
01579   }
01580   tmp = 3600.0 * (frac * 24.0);
01581   *h = (int) (tmp / 3600.0);
01582   tmp = tmp - *h * 3600.0;
01583 
01584   *mi = (int) (tmp / 60.0);
01585   *sec = tmp - *mi * 60.0;
01586 }

void setup_platform  ) 
 

Effectively unused in serial (non-parallel) implementation.

Definition at line 1854 of file Driver_Utilities.c.

Referenced by setup().

01854                       {
01855  
01856   exparam(&env);
01857   procnum = env.procnum;
01858   exgridsplit(env.nprocs, 2, nprocs);
01859   if( exgridinit(2, nprocs) < 0) { usrErr("Failed to Setup Grid"); exit(0); }
01860   exgridcoord(procnum, recpnum);
01861 }

void set_env_vars void   ) 
 

Acquire necessary environment variables.

Definition at line 817 of file Driver_Utilities.c.

Referenced by setup().

00817                         {
00818   
00819   FILE *infile;
00820   char filename[100], ch;
00821   static long start;
00822   int i, maxLen =200;
00823   
00824     ModelPath = getenv("ModelPath"); 
00825     ProjName = getenv("ProjName");
00826     DriverPath = getenv("DriverPath");
00827     OS_TYPE = getenv("OSTYPE"); /* OSTYPE not used in code, only here for informational output */
00828 
00829         sprintf(msgStr,"OS type = %s ",OS_TYPE); 
00830     usrErr(msgStr);
00831     
00832         sprintf(msgStr,"Project Name = %s ",ProjName); 
00833     usrErr(msgStr);
00834  
00835 }

void setup_grid  ) 
 

Provide the 2D array size for the model domain.

Definition at line 376 of file Driver_Utilities.c.

Referenced by setup().

00376                   {
00377   
00378   exgridsize(procnum,gbl_size,lcl_size,lcl_start); /* effectively unused in serial (non-parallel) implementation */
00379 
00380   /*  s0 and s1 remain unchanged in serial (non-parallel) implementation */
00381   s0 = lcl_size[0];
00382   s1 = lcl_size[1];
00383   
00384   gridSize = (s0+2)*(s1+2); /* the gridSize is increased by 2 in each dimension for buffer strips around processor domain(s) (functional mainly to parallel implementation) */
00385   
00386   sprintf(msgStr,"\nGRID DATA::[ gsize: (%d, %d), lstart: (%d, %d), lend: (%d, %d), lsize: (%d, %d) ]\n",
00387           gbl_size[0], gbl_size[1], lcl_start[0], 
00388           lcl_start[1], lcl_start[0]+lcl_size[0]-1, 
00389           lcl_start[1]+lcl_size[1]-1, lcl_size[0], lcl_size[1] );
00390   WriteMsg(msgStr,1);  
00391   sprintf(msgStr,"\nVP DATA:: size: (%d), Variable sizes: float: %d, int: %d, long: %d,  double: %d\n", 
00392             sizeof(ViewParm), sizeof(float),sizeof(int) ,sizeof(long) ,sizeof(double)   );
00393   WriteMsg(msgStr,1);
00394 
00395   gTempSize = gridSize*8;
00396   gTemp = (UCHAR*) nalloc(gTempSize,"gTemp");  
00397 }

int skip_white FILE *  infile  ) 
 

Skip white space(s) in a file.

Parameters:
infile 
Returns:
success/failure

Definition at line 1717 of file Driver_Utilities.c.

01718 {
01719   int ch;
01720   
01721   while( isspace(ch=fgetc(infile)) ) {;}
01722   if(ch==EOF) return 0;
01723   ungetc(ch,infile);
01724   return 1;             
01725 }  

int scan_forward FILE *  infile,
const char *  tstring
 

Scan forward until a particular string is found.

Parameters:
infile The file being read
tstring The sought-after string
Returns:
Success/failure

Definition at line 1731 of file Driver_Utilities.c.

01732 {
01733   int sLen, i, cnt=0;
01734   char Input_string[100], test;
01735   
01736   sLen = strlen(tstring);
01737   while( ( test = fgetc(infile) ) != EOF ) {
01738     for(i=0; i<(sLen-1); i++) 
01739         Input_string[i] = Input_string[i+1];
01740     Input_string[sLen-1] = test;
01741     Input_string[sLen] = '\0';
01742     if(++cnt >= sLen) {
01743       test =  strcmp(Input_string,tstring);
01744       if( test == 0 ) return 1;
01745     }
01746   }
01747   return(-1);
01748 }

double julday int  mon,
int  day,
int  year,
int  h,
int  mi,
double  se
 

Determine the Julian calendar day from a Gregorian date.

Returns:
julian day + hms as a real number
Takes a date, and returns a Julian day. A Julian day is the number of days since some base date (in the very distant past). Handy for getting date of x number of days after a given Julian date (use jdate to get that from the Gregorian date). Author: Robert G. Tantzen, translator: Nat Howard Translated from the algol original in Collected Algorithms of CACM (This and jdate are algorithm 199). All taken (unmodified) from SFWMD HSM's /vol/hsm/src/libs/xmgr_julday/ directory.

Parameters:
mon Month
day Day
year Year
h Hour
mi Minute
se Second
Returns:
Julian day

Definition at line 1500 of file Driver_Utilities.c.

01501 {
01502   long m = mon, d = day, y = year;
01503   long c, ya, j;
01504   double seconds = h * 3600.0 + mi * 60 + se;
01505 
01506   if (m > 2)
01507     m -= 3;
01508   else {
01509     m += 9;
01510     --y;
01511   }
01512   c = y / 100L;
01513   ya = y - (100L * c);
01514   j = (146097L * c) / 4L + (1461L * ya) / 4L + (153L * m + 2L) / 5L + d + 1721119L;
01515   if (seconds < 12 * 3600.0) {
01516     j--;
01517     seconds += 12.0 * 3600.0;
01518   } 
01519   else {
01520     seconds = seconds - 12.0 * 3600.0;
01521   }
01522   return (j + (seconds / 3600.0) / 24.0);
01523 }

float FMOD float  x,
float  y
 

Modulus of a pair of (double) arguments.

Parameters:
x Numerator
y Denominator
Returns:
modulus (float) result

Definition at line 1592 of file Driver_Utilities.c.

Referenced by cell_dyn1(), Flows_in_Structures(), and init_eqns().

01592                              { 
01593 return (float)fmod((double)x, (double)y); 
01594 } 

void local_setup int  argc,
char **  argv
 

Does very little in serial implementation (opens a low-level debug file).

Primarily intended for parallel apps:
establish processor attributes, open a low-level debug file (in the user's current directory, set by the model execution script ("go"), and seed the pseudo-random number.

Parameters:
argc number of command line arguments
argv command line argument
Returns:
void

Definition at line 950 of file Serial.c.

00951 {
00952   int i;
00953   char debugfileName[300];
00954   nprocs[0] = 1;
00955   nprocs[1] = 1;
00956   tramType =  0;
00957   procnum = 1;
00958   recpnum[0] = 0;
00959   recpnum[1] = 0;
00960   Lprocnum = 1;
00961   /* the combo_table (ctable) used in Combine operation for spatial array summaries (debug-related) */ 
00962   max_combos_open = 0;  
00963   for(i = 0; i < MAXCOMBOS; i++) {
00964     ctable[i].ocnt = 0; 
00965     ctable[i].free = 1;
00966   }
00967 
00968   /* this debug output file is not used extensively in current code - it is opened before we get
00969      environment vars, thus is written to user's current directory ($ModelPath/$ProjName/Load if
00970      ELM is executed from the "go" script) */ 
00971  dFile = fopen("ELM.debug","w");
00972   if(dFile == NULL) { 
00973     usrErr("Can't open ELM.debug file."); 
00974     exit(0); 
00975   } 
00976   /* there are no random processes in current ELM (v2.4) w/o fire */ 
00977   srand(seed);
00978   fprintf(dFile," RAND_MAX = %d\n",(int)RAND_MAX);
00979 }

void open_debug_outFile int  index  ) 
 

Open debug-related output files.

The Driver0.out and Driver1.out are two output files with debug and/or standard error-warning information. They are always produced, but have varying levels of detail (esp. Driver1.out) depending on the user-selected (at run-time) level of the "debug" variable. Driver0.out basically provides initial, static information on data and setup of the model. Driver1.out provides dynamic information on the simulation. In sensitivity analysis mode, subsequent Driver2.out, Driver3.out, etc provide dynamic information on each new simulation.

Parameters:
index Index to indicate file name w/ "0", "1", and subsequent runs under a sensitivity analysis

Definition at line 720 of file Serial.c.

00721 {
00722   char filename[120];
00723   
00724   sprintf(filename,"%s/%s/Output/Debug/Driver%d.out",OutputPath,ProjName,index);
00725 
00726   Driver_outfile = fopen(filename,"w");
00727   if(Driver_outfile == NULL) { 
00728         fprintf(stderr,"Error, unable to open %s file.\n",filename);
00729         fprintf(stderr,"OutputPath: %s\n",OutputPath);  
00730         fprintf(stderr,"Project: %s\n",ProjName);  
00731         exit(0); 
00732   }
00733 
00734 }

void broadcastInt int *  iValPtr  ) 
 

Parallel code: does nothing in serial implementation).

Definition at line 1059 of file Serial.c.

01060 {}

void sync_processors  ) 
 

Parallel code: does nothing in serial implementation).

Definition at line 1071 of file Serial.c.

Referenced by main().

01072 {return;}

void send_point_lists2 SeriesParm pSeries,
int  nSeries
 

Point time series output: print time series data to file(s).

open_point_lists Has documentation relevant to this function

Parameters:
pSeries A struct of the variables to have point time series output
nSeries Number of point time series occurances

Definition at line 474 of file Serial.c.

00475 {
00476   FILE *oFile;
00477   int i=0, ii, j, ix, iy, k= 0, last_pt;
00478   int yr_pt[2],mo_pt[2],da_pt[2],hr_pt[2],mi_pt[2];    
00479   double se_pt[2];           
00480   double Jdate_pt;
00481   
00482   if (numPtFiles==0) return;
00483   /* k = file/variable counter; i = indiv cellLoc time series counter */
00484   for (k = 0; k <= numPtFiles; k++) { /* loop over the number of point ts files */
00485       sprintf(msgStr,"%s%s/Output/PtSer/%s.pts",OutputPath,ProjName,pSeries[i].name);
00486       if( (oFile = fopen(msgStr,"a") ) == NULL) { 
00487           fprintf(stderr,"\nERROR, unable to open %s point time series output file.",msgStr); 
00488           exit(-1); 
00489       }
00490 
00491       for(j=pSeries[i].laststep; j<pSeries[i].Length; j++ ) { /*temporal loop */
00492           Jdate_pt = Jdate_init+j*pSeries[i].outstep;
00493           calcdate( Jdate_pt, mo_pt, da_pt, yr_pt, hr_pt, mi_pt, se_pt); /* get the calendar date info from the julian date */
00494           fprintf(oFile,"\n%d/%d/%d\t",yr_pt[0],mo_pt[0],da_pt[0] ); /* calendar date in col 1 */
00495 
00496           last_pt = i+cell_pts[k]; /* # of last cellLoc point of the current variable's file */
00497           for (ii=i; ii<last_pt; ii++) {/* loop over number of point locations per file */
00498               fprintf(oFile,"%f\t",pSeries[ii].data[j]);
00499           }
00500       }
00501       fclose (oFile); 
00502       pSeries[i].laststep = j; /* remember the last temporal outstep for this file */
00503       i += cell_pts[k];     /* increment the indiv cellLoc time series counter */ 
00504   }
00505   return;
00506 }

void open_point_lists SeriesParm pSeries,
int  nSeries
 

Point time series output: open files and print headers.

Provides for multi-column (locations), multi-file (model variables)format of point time series. The user can define (via Model.outList commands), for any variable in the model, one or more cell (point) locations for which point time series data are written. There can be multiple point TS each for different variables. Thus, we make a separate file for each variable (unknown until user chooses) that has multiple columns for multiple points (unknown until user chooses).

Parameters:
pSeries An array of SeriesParm structs for point time series output
nSeries Number of point time series occurances
Remarks:
A structure should/could be set up for this, but to maintain minimal changes between the parallel and serial versions of the code (ELMv1.0), for now we just maintain the original data structure and use some counters below to keep track of diff files and numbers of columns (also allowing different output steps as chosen by the user). (Note: The original SME code printed all variables in one column in one file).
Note:
TODO: this whole point-time-series output functionality needs improvement (not high priority, Jan 2005). One of the more important capabilities is to have ability to have irregular, calendar-month/year etc output intervals.

Definition at line 431 of file Serial.c.

00432 {
00433   FILE *oFile;
00434   int i, j, ix, iy, k= 0 ;
00435 
00436   for (i=0; i<nSeries; i++) {
00437      if( pSeries[i].data == NULL ) {
00438         if ( numPtFiles>0 ) fclose(oFile); /* in (rare?) case where user asks for no point output, no files stream to close */
00439         return;
00440       }
00441       if (strcmp(pSeries[i].name,pSeries[i-1].name) != 0) {
00442               /* this is new variable, thus new file.  numPtFiles== increment counter of number of variables (one file per variable) used for output */
00443           if (i>0) { 
00444             numPtFiles++; 
00445             fclose (oFile); 
00446           }
00447           
00448           sprintf(msgStr,"%s%s/Output/PtSer/%s.pts",OutputPath,ProjName,pSeries[i].name);
00449           if( (oFile = fopen(msgStr,"w") ) == NULL) { 
00450               fprintf(stderr,"\nERROR, unable to open %s point time series output file.",msgStr); 
00451               exit(-1); 
00452           }
00453           fprintf (oFile, "%s %s %s %s scenario: \nDate\t", &modelName, &modelVers, &SimAlt, &SimModif);
00454           
00455       }
00456 /* populate the grid cell locations in the header for this variable/file */
00457       ix = pSeries[i].Loc.x;
00458       iy = pSeries[i].Loc.y;
00459       fprintf(oFile,"%s:(%d,%d)\t",pSeries[i].name,ix,iy);
00460       cell_pts[numPtFiles]++; /* count the number of cell point locs per variable (1 var per file) */
00461       
00462   }
00463 }

void init_static_data void   ) 
 

Initialize static spatial data.

Definition at line 1626 of file UnitMod.c.

Referenced by main().

01627 {
01628   usrErr0("Acquiring static spatial data..."); /* console message */
01629   
01630   read_map_file("ModArea",ON_MAP,'c',4.0,0.0);            /* defines model area, dimless unsigned char attributes, value 1 set to 4, 0=0 */
01631   read_map_file("BoundCond",BCondFlow,'d',1.0,0.0);       /* boundary condition flow restrictions, dimless integer attributes */
01632             /* ONLY when running the EWQM settling rate version of ELM */
01633   if (ESPmodeON) read_map_file("basinSetVel",WQMsettlVel,'f',0.0001,0.0);       /* basin-based settling rates (data in tenths mm/d, converted to m/d) */
01634   read_map_file("basins",basn,'d',1.0,0.0);               /* Basins/Indicator-Region map, dimless integer attributes  */
01635 
01636   alloc_mem_stats (); /* allocate memory for budget & stats arrays (need to have read the Basin/Indicator-Region map first) */
01637   BIRinit(); /* Set up the Basin/Indicator-Region (BIR) linkages/inheritances */
01638   BIRoutfiles(); /* Basin/Indicator-Region output files */
01639   
01640   usrErr("Done.");
01641 } 

void init_dynam_data void   ) 
 

Initialize dynamic spatial data.

Definition at line 1645 of file UnitMod.c.

Referenced by main().

01646 {
01647   usrErr0("Acquiring dynamic spatial data..."); /* console message */
01648   
01649   read_map_file("Elevation",ELEVATION,'f',0.01,0.0);      /*  positive elevation relative to NGVD 1929 datum (positive above NGVD29; all data in cm NGVD29, converted to m NGVD29) */
01650   read_map_file("HAB",HAB,'c',1.0,0.0);                   /* habitat (veg classifications, dimless unsigned char attributes) */
01651   read_map_file("icMacBio",MAC_TOT_BIOM,'f',0.015,0.0);      /* initial total biomass of macrophytes (data in xyz, converted to kg C/m2) */
01652   read_map_file("icSfWt",SURFACE_WAT,'f',0.01,0.0);       /* initial ponded surface water (data in cm, converted to m) */
01653   read_map_file("icUnsat",UNSAT_DEPTH,'f',0.01,0.0);      /* initial depth of unsaturated zone (data in cm, converted to m) */
01654   read_map_file("soilTP",TPtoSOIL,'f',0.000001,0.0);  /* soil TP map (data in mgP/kgSoil, converted to kgP/kgSoil) */
01655   read_map_file("soilBD",BulkD,'f',1.0,0.0);         /* soil bulk dens map (data in mgSoil/cm3 == kgSoil/m3)  */
01656   read_map_file("soil_orgBD",DOM_BD,'f',1.0,0.0);    /* organic soil bulk dens map (data in mgOM/cm3 == kgOM/m3)  */
01657 
01658   /* 2 static mapps need to be here for re-initialing w/ a multiplier (sensitivity analysis) */ 
01659   read_map_file("HydrCond",HYD_RCCONDUCT,'f',1.0,0.0);   /* hydraulic conductivity (no conversion, data in m/d)  */
01660   read_map_file("Bathymetry",Bathymetry,'f',0.01,0.0);      /* v2.3+, positive estuarine bathymetry (depth) relative to NGVD 1929 datum (positive depth below NGVD29; all positive depth data in cm, converted to m) */
01661 
01662   usrErr("Done."); /* console message */
01663 } 

void init_eqns void   ) 
 

Initialization of the model equations.

This calculates initial values of state variables, and which also provides constant values of pertinent flux equations if their corresponding cell_dyn module is not executed.

Definition at line 1671 of file UnitMod.c.

Referenced by main().

01672  {
01673 int ix,iy, cellLoc;
01674 float tmp; /* used in checking nutrient availability for MichMent kinetics */
01675 float min_litTemp; /* used to determine min of temper, light cf's for alg and macs */
01676 float I_ISat, Z_extinct, PO4Pconc, PO4P;
01677 float MAC_PHtoNPH, MAC_PHtoNPH_Init;
01678 float soil_propOrg; 
01679 #define satDensity 0.9 /* assign the relative proportion (0 - 1) of a population maximum to be the saturation density for a population */
01680 
01681   usrErr0("Initializing unit model equations..."); /* console message */
01682   
01683   SimTime.TIME = 0;
01684   DAYJUL = ( FMOD(SimTime.TIME,365.0) >0.0 ) ? ( FMOD(SimTime.TIME,365.0) ) : ( 365.0);
01685   LATRAD = ((int)(GP_LATDEG)+(GP_LATDEG-(int)(GP_LATDEG))*5.0/3.0)*PI/180.0;
01686   /* AMPL = Exp(7.42+0.045*LATRAD*180.0/PI)/3600.0; */
01687   /* DAYLENGTH = AMPL*Sin((DAYJUL-79.0)*0.01721)+12.0; */
01688   SOLALPHA = 32.9835-64.884*(1.0-1.3614*Cos(LATRAD));
01689   SOLDEC1 = 0.39785*Sin(4.868961+0.017203*DAYJUL   +0.033446*Sin(6.224111+0.017202*DAYJUL));
01690   SOLCOSDEC = sqrt(1.0-pow(SOLDEC1,2.0));
01691   SOLELEV_SINE = Sin(LATRAD)*SOLDEC1+Cos(LATRAD)*SOLCOSDEC;
01692   SOLALTCORR = (1.0-Exp(-0.014*(GP_ALTIT-274.0)/(SOLELEV_SINE*274.0)));
01693   SOLBETA = 0.715-0.3183*(1.0-1.3614*Cos(LATRAD));
01694   SOLDEC = Arctan(SOLDEC1/sqrt(1.0-pow(SOLDEC1,2.0)));
01695   SOLRISSET_HA1 = -Tan(LATRAD)*Tan(SOLDEC);
01696   SOLRISSET_HA = ( (SOLRISSET_HA1==0.0) ) ? ( PI*0.5 ) : (   ( (SOLRISSET_HA1<0.0) ) ? ( PI+Arctan(sqrt(1.0-pow(SOLRISSET_HA1,2.0))/SOLRISSET_HA1)  ) : (      Arctan(sqrt(1.0-pow(SOLRISSET_HA1,2.0))/SOLRISSET_HA1)));
01697   SOLRADATMOS = 458.37*2.0*(1.0+0.033*Cos(360.0/365.0*PI/180.0*DAYJUL))* (Cos(LATRAD)*Cos(SOLDEC)*Sin(SOLRISSET_HA) + SOLRISSET_HA*180.0/(57.296*PI)*Sin(LATRAD)*Sin(SOLDEC));
01698         
01699         for(ix=0; ix<=s0+1; ix++) {
01700             for(iy=0; iy<=s1+1; iy++) { 
01701                   cellLoc = T(ix,iy);
01702                   
01703                   AIR_TEMP[cellLoc] = 25.0;  /* spatial time series unavailable after 1995; globally constant in v2.2+ */
01704 /* rainfall read from sfwmm data, remapped to ELM resolution */
01705                   boundcond_rain[cellLoc] =  SF_WT_FROM_RAIN[cellLoc] = boundcond_ETp[cellLoc] = boundcond_depth[cellLoc] = 0.0;
01706        
01707                                 /* used to have cloudiness influence on GP_SOLOMEGA, now 0 */
01708                  SOLRAD274[cellLoc] = SOLRADATMOS*(SOLBETA-GP_SOLOMEGA*0.0 )-SOLALPHA;
01709                  SOLRADGRD[cellLoc] = SOLRAD274[cellLoc]+((SOLRADATMOS+1.0)-SOLRAD274[cellLoc])*SOLALTCORR;
01710                  H2O_TEMP[cellLoc] = AIR_TEMP[cellLoc];
01711          
01712                  ALG_REFUGE[cellLoc] = HP_ALG_MAX[HAB[cellLoc]]*GP_ALG_REF_MULT;
01713                  ALG_SAT[cellLoc] = HP_ALG_MAX[HAB[cellLoc]]*0.9;
01714 
01715               /* v2.3: with southern everglades topo, put bathymetry back into the model */
01716                  ELEVATION[cellLoc] = ELEVATION[cellLoc] * GP_IC_ELEV_MULT;
01717                  Bathymetry[cellLoc] = Bathymetry[cellLoc] * GP_IC_BATHY_MULT;
01718                  SED_ELEV[cellLoc] =  ELEVATION[cellLoc] - Bathymetry[cellLoc] + GP_DATUM_DISTANCE; 
01719                  SED_INACT_Z[cellLoc] = SED_ELEV[cellLoc]-HP_DOM_MAXDEPTH[HAB[cellLoc]]; 
01720 
01721                  MAC_MAX_BIO[cellLoc] = HP_NPHBIO_MAX[HAB[cellLoc]]+HP_PHBIO_MAX[HAB[cellLoc]];
01722                  NPHBIO_REFUGE[cellLoc] = HP_NPHBIO_MAX[HAB[cellLoc]]*GP_MAC_REFUG_MULT;
01723                  NPHBIO_SAT[cellLoc] = HP_NPHBIO_MAX[HAB[cellLoc]] * satDensity;
01724                  PHBIO_REFUGE[cellLoc] = HP_PHBIO_MAX[HAB[cellLoc]]*GP_MAC_REFUG_MULT;
01725                  PHBIO_SAT[cellLoc] = HP_PHBIO_MAX[HAB[cellLoc]] * satDensity;
01726             }
01727         }
01728         for(ix=1; ix<s0+1; ix++) {
01729             for(iy=1; iy<s1+1; iy++) { cellLoc = T(ix,iy);
01730 /*initialization of major state variables */
01731 
01732               /* hydro */
01733                  HYD_RCCONDUCT[cellLoc] = HYD_RCCONDUCT[cellLoc] * GP_calibGWat;
01734 
01735 /* map */        UNSAT_DEPTH[cellLoc] = Max(UNSAT_DEPTH[cellLoc] + GP_HYD_IC_UNSAT_ADD,0.0); /* m */
01736                  SAT_WT_HEAD[cellLoc] = SED_ELEV[cellLoc]- UNSAT_DEPTH[cellLoc]; /* m */
01737                  SAT_WATER[cellLoc] = SAT_WT_HEAD[cellLoc] * HP_HYD_POROSITY[HAB[cellLoc]]; /* m */
01738 
01739                  UNSAT_WATER[cellLoc] = HP_HYD_POROSITY[HAB[cellLoc]]*UNSAT_DEPTH[cellLoc] *GP_HYD_ICUNSATMOIST; /* m */
01740                  UNSAT_CAP[cellLoc] = UNSAT_DEPTH[cellLoc]*HP_HYD_POROSITY[HAB[cellLoc]]; /* m */
01741                  UNSAT_MOIST_PRP[cellLoc]  =  /* dimless proportion, 0-1 */
01742                      ( UNSAT_CAP[cellLoc]>0.0 ) ? 
01743                      ( Min(UNSAT_WATER[cellLoc]/UNSAT_CAP[cellLoc],1.0) ) : 
01744                      ( 1.0); 
01745 
01746 /* map */        SURFACE_WAT[cellLoc] =  Max(SURFACE_WAT[cellLoc] + GP_HYD_IC_SFWAT_ADD, 0.0); /* m */
01747                  SFWT_VOL[cellLoc] = SURFACE_WAT[cellLoc]*CELL_SIZE;
01748 
01749                  HYD_DOM_ACTWAT_VOL[cellLoc] = Max(HP_DOM_MAXDEPTH[HAB[cellLoc]]-UNSAT_DEPTH[cellLoc]*
01750                                                    (1.0-UNSAT_MOIST_PRP[cellLoc]),0.0)*HP_HYD_POROSITY[HAB[cellLoc]]*CELL_SIZE;
01751                  HYD_SED_WAT_VOL[cellLoc] = (SAT_WATER[cellLoc]+UNSAT_WATER[cellLoc])*CELL_SIZE;
01752                  
01753               /* soil */
01754 /* map */        DOM_BD[cellLoc] = DOM_BD[cellLoc] * GP_IC_DOM_BD_MULT;
01755 /* map */        BulkD[cellLoc] = BulkD[cellLoc] * GP_IC_BulkD_MULT;
01756                  soil_propOrg = DOM_BD[cellLoc] / BulkD[cellLoc];
01757                  DIM[cellLoc] = (1.0 - soil_propOrg) * BulkD[cellLoc] * HP_DOM_MAXDEPTH[HAB[cellLoc]] * CELL_SIZE; /* kg inorganic matter */
01758                  Inorg_Z[cellLoc] = (1.0 - soil_propOrg) * HP_DOM_MAXDEPTH[HAB[cellLoc]]; /*  fixed inorganic depth (m) */
01759                  DOM_Z[cellLoc] = HP_DOM_MAXDEPTH[HAB[cellLoc]] - Inorg_Z[cellLoc]; /* m */
01760 
01761                  DEPOS_ORG_MAT[cellLoc] = DOM_BD[cellLoc]*DOM_Z[cellLoc]; /* (mgOM/cm3 ==> kgOM/m3) * m = kgOM/m2 */
01762 
01763                  DOM_SED_AEROB_Z[cellLoc] = Min(UNSAT_DEPTH[cellLoc]+HP_DOM_AEROBTHIN[HAB[cellLoc]],HP_DOM_MAXDEPTH[HAB[cellLoc]]); /* m */
01764                  DOM_SED_ANAEROB_Z[cellLoc] = HP_DOM_MAXDEPTH[HAB[cellLoc]]-DOM_SED_AEROB_Z[cellLoc]; /* m */
01765 
01766 /* map */        TPtoSOIL[cellLoc] = TPtoSOIL[cellLoc] * GP_IC_TPtoSOIL_MULT; /* kgP/kgSoil */
01767                  DOP[cellLoc] =  (1.0-GP_sorbToTP)*TPtoSOIL[cellLoc] * BulkD[cellLoc] * HP_DOM_MAXDEPTH[HAB[cellLoc]] ; /* kgP/kg_soil * kg_soil/m3 * m == kgP/m2 */
01768 
01769               /* floc layer of soil */
01770                  FLOC[cellLoc] = HP_FLOC_IC[HAB[cellLoc]]; /* kg OM/m2  */
01771                  FlocP[cellLoc] = FLOC[cellLoc]*HP_FLOC_IC_PC[HAB[cellLoc]]*HP_FLOC_IC_CTOOM[HAB[cellLoc]]; /* kg P /m2 */
01772                  FLOC_Z[cellLoc] = (double) FLOC[cellLoc] / GP_Floc_BD ; /* m */
01773 
01774               /* phosphorus */
01775 /* v2.4.4 */       TP_SFWT_CONC[cellLoc]  = GP_TP_ICSFWAT * conv_mgTOg; /* mg/L * g/mg  => g/L */
01776                  TP_SF_WT[cellLoc] =TP_SFWT_CONC[cellLoc] * SFWT_VOL[cellLoc]; /* kg P */
01777                  TP_SFWT_CONC_MG[cellLoc] = TP_SFWT_CONC[cellLoc] * conv_gTOmg; /* mg/L */
01778                       /* using regression for predicting PO4 from TP */
01779                  PO4Pconc = Max(TP_SFWT_CONC_MG[cellLoc]*GP_PO4toTP + GP_PO4toTPint, 0.10 * TP_SFWT_CONC_MG[cellLoc]); /* mg/L */
01780                  PO4P = PO4Pconc * SFWT_VOL[cellLoc] /conv_kgTOg; /*kg P available (from conc. in mg/l) */
01781 
01782 /* v2.4.4 */       TP_SED_CONC[cellLoc] = GP_TP_ICSEDWAT * conv_mgTOg; /* mg/L * g/mg => g/L */
01783                  TP_SED_WT[cellLoc] = TP_SED_CONC[cellLoc] * HYD_SED_WAT_VOL[cellLoc]; /* kg P */
01784                      /* this is the active zone, where uptake, sorption, and mineralization take place */
01785                  TP_Act_to_Tot[cellLoc] = 1.0 / HP_TP_CONC_GRAD[HAB[cellLoc]]; /* ratio of TP conc in active zone relative to total */
01786                  TP_SED_WT_AZ[cellLoc] = TP_SED_CONC[cellLoc] * TP_Act_to_Tot[cellLoc] * HYD_DOM_ACTWAT_VOL[cellLoc]; /* kg P */
01787                  TP_SEDWT_CONCACT[cellLoc] =(HYD_DOM_ACTWAT_VOL[cellLoc] > 0.0) ?
01788                      ( TP_SED_WT_AZ[cellLoc]/HYD_DOM_ACTWAT_VOL[cellLoc] ) :
01789                      ( TP_SED_CONC[cellLoc]); /* g/L */
01790                  TP_SEDWT_CONCACTMG[cellLoc] = TP_SEDWT_CONCACT[cellLoc]*conv_gTOmg; /* mg/L */
01791 
01792                  TP_SORB[cellLoc] = GP_sorbToTP*TPtoSOIL[cellLoc]
01793                      * BulkD[cellLoc] * HP_DOM_MAXDEPTH[HAB[cellLoc]] * CELL_SIZE; /* dimless * kgP/kg_soil * kg_soil/m3 * m * m^2 == kgP */
01794 
01795 
01796               /* salt */
01797                  SALT_SED_WT[cellLoc] = HYD_SED_WAT_VOL[cellLoc]*HP_SALT_ICSEDWAT[HAB[cellLoc]];
01798                  SAL_SED_WT[cellLoc] = ( HYD_SED_WAT_VOL[cellLoc]>0.0 ) ? ( SALT_SED_WT[cellLoc]/HYD_SED_WAT_VOL[cellLoc] ) : ( 0.0);
01799                  SALT_SURF_WT[cellLoc] = SFWT_VOL[cellLoc]*HP_SALT_ICSFWAT[HAB[cellLoc]];
01800                  SAL_SF_WT[cellLoc] = ( SURFACE_WAT[cellLoc] > GP_DetentZ ) ? ( SALT_SURF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : ( 0.0);
01801 
01802               /* periphyton */
01803 /* 2.4.4 */       NC_ALG[cellLoc] = HP_ALG_MAX[HAB[cellLoc]] * GP_ALG_IC_MULT * GP_ALG_REF_MULT ; /* start w/ low, refuge-level of non-calcareous (eutrophic) periphyton, g C/m2 */
01804 /* 2.4.4 */       C_ALG[cellLoc]  = HP_ALG_MAX[HAB[cellLoc]] * GP_ALG_IC_MULT * (1.0 - GP_ALG_REF_MULT); /* g C/m2 */
01805                  /* ic PC of periph in oligotrophic area is 3% of max P:C, varies across space via (0.1->1.0) map */
01806 /* 2.4.4 */       NC_ALG_PC[cellLoc] = GP_ALG_PC; /* gP/ gC */
01807 /* 2.4.4 */       C_ALG_PC[cellLoc]  = GP_ALG_PC; /* gP/ gC */
01808 
01809                  NC_ALG_P[cellLoc] = NC_ALG[cellLoc]*NC_ALG_PC[cellLoc];   /* g P/m2 */
01810                  C_ALG_P[cellLoc] = C_ALG[cellLoc]*C_ALG_PC[cellLoc];  /* g P/m2 */  
01811 
01812               /* macrophytes */
01813 /* 2.4.4 */       MAC_PH_BIOMAS[cellLoc] = MAC_TOT_BIOM[cellLoc] * GP_MAC_IC_MULT * HP_PHBIO_MAX[HAB[cellLoc]]/MAC_MAX_BIO[cellLoc]; /* kg C/m2 */
01814                    /*  now calc the P and OM associated with that C */
01815 /* 2.4.4 */       mac_ph_PC[cellLoc] = HP_PHBIO_IC_PC[HAB[cellLoc]]; 
01816                  mac_ph_P[cellLoc] = MAC_PH_BIOMAS[cellLoc] * mac_ph_PC[cellLoc]; /* kg P/m2 */
01817                  mac_ph_OM[cellLoc] = MAC_PH_BIOMAS[cellLoc] / HP_PHBIO_IC_CTOOM[HAB[cellLoc]];
01818                  mac_ph_CtoOM[cellLoc] = HP_PHBIO_IC_CTOOM[HAB[cellLoc]];
01819                  PHBIO_AVAIL[cellLoc] = MAC_PH_BIOMAS[cellLoc]*Max(1.0-Max((PHBIO_SAT[cellLoc]-MAC_PH_BIOMAS[cellLoc]) /(PHBIO_SAT[cellLoc]-PHBIO_REFUGE[cellLoc]),0.0),0.0);
01820 
01821 /* 2.4.4 */       MAC_NOPH_BIOMAS[cellLoc] = MAC_TOT_BIOM[cellLoc] * GP_MAC_IC_MULT * HP_NPHBIO_MAX[HAB[cellLoc]]/MAC_MAX_BIO[cellLoc]; /* kg C/m2 */
01822                    /*  now calc the P and OM associated with that C */
01823 /* 2.4.4 */       mac_nph_PC[cellLoc] = HP_NPHBIO_IC_PC[HAB[cellLoc]]; 
01824                  mac_nph_P[cellLoc] = MAC_NOPH_BIOMAS[cellLoc] * mac_nph_PC[cellLoc];  /* kg P/m2 */
01825                  mac_nph_OM[cellLoc] = MAC_NOPH_BIOMAS[cellLoc] / HP_NPHBIO_IC_CTOOM[HAB[cellLoc]];
01826                  mac_nph_CtoOM[cellLoc] = HP_NPHBIO_IC_CTOOM[HAB[cellLoc]];
01827                  NPHBIO_AVAIL[cellLoc] = MAC_NOPH_BIOMAS[cellLoc]*Max(1.0-Max((NPHBIO_SAT[cellLoc]-MAC_NOPH_BIOMAS[cellLoc])/(NPHBIO_SAT[cellLoc]-NPHBIO_REFUGE[cellLoc]),0.0),0.0);
01828 
01829                  MAC_REL_BIOM[cellLoc] = ( MAC_TOT_BIOM[cellLoc] > 0 ) ? MAC_TOT_BIOM[cellLoc]/MAC_MAX_BIO[cellLoc] : 0.0;
01830                  MAC_LAI[cellLoc] = MAC_REL_BIOM[cellLoc]*HP_MAC_MAXLAI[HAB[cellLoc]];
01831                  MAC_HEIGHT[cellLoc] = MAC_REL_BIOM[cellLoc]*HP_MAC_MAXHT[HAB[cellLoc]];
01832                  LAI_eff[cellLoc] =  (MAC_HEIGHT[cellLoc]>0.0) ? (Max(1.0 - SURFACE_WAT[cellLoc]/MAC_HEIGHT[cellLoc], 0.0)*MAC_LAI[cellLoc]) : (0.0)  ;                 
01833 
01834 /* end of initialization of major state variables */
01835                  
01836 /* *************************** */
01837 /* These are the multiple calculations used if particular modules are turned off. \n
01838  NOTE: THIS section (of init_eqns() ) is not fully updated for properly
01839  turning off individual **interacting** *biological/chemical* modules.  
01840  If one *biological/chemical* module is turned off, 
01841  they all need to be turned off. (Note that cell_dyn's 3,5,6 should always be off). \n
01842 
01843  *** \n
01844  The following *biological/chemical* modules must be ON or OFF as a group:
01845  (cell_dyn2 + cell_dyn4 + cell_dyn8 + cell_dyn9  + cell_dyn12)
01846  cell_dyn13, the net settling rate module, can be turned on only when above module group is off
01847  *** \n
01848  
01849  In particular, the budget will
01850  not properly reflect actual dynamics if those 
01851  modules are not treated as a group.
01852 */
01853      NC_ALG_MORT_POT[cellLoc] = ( UNSAT_DEPTH[cellLoc]>0.05 ) ? ( NC_ALG[cellLoc]*GP_ALG_RC_MORT_DRY ) : ( NC_ALG[cellLoc]*GP_ALG_RC_MORT);
01854                      /* calcareous periphyton */
01855      C_ALG_MORT_POT[cellLoc] = ( UNSAT_DEPTH[cellLoc]>0.05 ) ? ( C_ALG[cellLoc]*GP_ALG_RC_MORT_DRY ) : ( C_ALG[cellLoc]*GP_ALG_RC_MORT);
01856                  ALG_TEMP_CF[cellLoc]  = tempCF(0, 0.20, GP_ALG_TEMP_OPT, 5.0, 40.0, H2O_TEMP[cellLoc]);
01857      NC_ALG_RESP_POT[cellLoc]  = 
01858          ( UNSAT_DEPTH[cellLoc]<0.05 ) ? 
01859          ( GP_ALG_RC_RESP*ALG_TEMP_CF[cellLoc]*NC_ALG[cellLoc] ) : 
01860          ( 0.0);
01861      NC_ALG_RESP[cellLoc]  =  
01862          ( NC_ALG_RESP_POT[cellLoc]*DT>NC_ALG[cellLoc] ) ? 
01863          ( NC_ALG[cellLoc]/DT ) : 
01864          ( NC_ALG_RESP_POT[cellLoc]);
01865                      /* calcareous periphyton */
01866      C_ALG_RESP_POT[cellLoc]  = 
01867          ( UNSAT_DEPTH[cellLoc]<0.05 ) ? 
01868          ( GP_ALG_RC_RESP*ALG_TEMP_CF[cellLoc]*C_ALG[cellLoc] ) : 
01869          ( 0.0);
01870      C_ALG_RESP[cellLoc]  =  
01871          ( C_ALG_RESP_POT[cellLoc]*DT>C_ALG[cellLoc] ) ? 
01872          ( C_ALG[cellLoc]/DT ) : 
01873          ( C_ALG_RESP_POT[cellLoc]);
01874 
01875      NC_ALG_AVAIL_MORT[cellLoc] = NC_ALG[cellLoc]-ALG_REFUGE[cellLoc];
01876      NC_ALG_MORT[cellLoc] = ( (NC_ALG_MORT_POT[cellLoc])*DT>NC_ALG_AVAIL_MORT[cellLoc] ) ? ( (NC_ALG_AVAIL_MORT[cellLoc])/DT ) : ( NC_ALG_MORT_POT[cellLoc]);
01877                      /* calcareous periphyton */
01878      C_ALG_AVAIL_MORT[cellLoc]  = C_ALG[cellLoc]-ALG_REFUGE[cellLoc];
01879      C_ALG_MORT[cellLoc]  = ( (C_ALG_MORT_POT[cellLoc])*DT>C_ALG_AVAIL_MORT[cellLoc] ) ? ( (C_ALG_AVAIL_MORT[cellLoc])/DT ) : ( C_ALG_MORT_POT[cellLoc]);
01880 
01881 /* light, water, temperature controls apply to calc and non-calc periphyton */
01882      ALG_LIGHT_EXTINCT[cellLoc]  =  0.01; /* light extinction coef */
01883                      /* algal self-shading implicit in density-dependent constraint function later */
01884      ALG_INCID_LIGHT[cellLoc]  = SOLRADGRD[cellLoc]*Exp(-MAC_LAI[cellLoc]*GP_ALG_SHADE_FACTOR);
01885                  Z_extinct = SURFACE_WAT[cellLoc]*ALG_LIGHT_EXTINCT[cellLoc];
01886      I_ISat = ALG_INCID_LIGHT[cellLoc]/GP_ALG_LIGHT_SAT;
01887                      /*  averaged over whole water column (based on Steele '65) */
01888      ALG_LIGHT_CF[cellLoc]  = ( Z_extinct > 0.0 ) ? 
01889          ( 2.718/Z_extinct * (Exp(-I_ISat * Exp(-Z_extinct)) - Exp(-I_ISat)) ) :
01890                 (I_ISat*Exp(1.0-I_ISat));
01891                      /*  low-water growth constraint ready for something better based on data */
01892      ALG_WAT_CF[cellLoc]  = ( SURFACE_WAT[cellLoc]>0.0 ) ? ( 1.0 ) : ( 0.0);
01893 /* the 2 communities have same growth response to avail phosphorus - avail P is roughly calc'd from TP */
01894      NC_ALG_NUT_CF[cellLoc]  =  PO4Pconc/(PO4Pconc+GP_NC_ALG_KS_P) ;
01895      C_ALG_NUT_CF[cellLoc]  = PO4Pconc/(PO4Pconc+GP_C_ALG_KS_P); 
01896       min_litTemp = Min(ALG_LIGHT_CF[cellLoc],ALG_TEMP_CF[cellLoc]);
01897       NC_ALG_PROD_CF[cellLoc]  = Min(min_litTemp,ALG_WAT_CF[cellLoc])*NC_ALG_NUT_CF[cellLoc];
01898       C_ALG_PROD_CF[cellLoc]   = Min(min_litTemp,ALG_WAT_CF[cellLoc])*C_ALG_NUT_CF[cellLoc];
01899 /* gross production of the 2 communities (gC/m2, NOT kgC/m2) */
01900                      /* density constraint contains both noncalc and calc, competition effect accentuated by calc algae */
01901                      /* used to increase calc growth by factor of 10 */
01902       NC_ALG_GPP[cellLoc]  =  NC_ALG_PROD_CF[cellLoc]*GP_ALG_RC_PROD*NC_ALG[cellLoc]       
01903              *Max( (1.0-(GP_AlgComp*C_ALG[cellLoc]+NC_ALG[cellLoc])/HP_ALG_MAX[HAB[cellLoc]]),0.0);
01904      C_ALG_GPP[cellLoc]  =  C_ALG_PROD_CF[cellLoc]*GP_ALG_RC_PROD*C_ALG[cellLoc] 
01905        *Max( (1.0-(    C_ALG[cellLoc]+NC_ALG[cellLoc])/HP_ALG_MAX[HAB[cellLoc]]),0.0);
01906 /* check for available P mass (the MichMent kinetics nutCF do not) */
01907      tmp = ( (NC_ALG_GPP[cellLoc]+C_ALG_GPP[cellLoc]) > 0) ? 
01908          PO4P / ( (NC_ALG_GPP[cellLoc]+C_ALG_GPP[cellLoc]) 
01909          * 0.001*GP_ALG_PC*CELL_SIZE*DT) :
01910          1.0;
01911      if (tmp < 1.0) {
01912          NC_ALG_GPP[cellLoc] *= tmp;   
01913          C_ALG_GPP[cellLoc] *= tmp; 
01914     /* can have high conc, but low mass of P avail, in presence of high peri biomass and high demand */
01915     /* reduce the production proportionally if excess demand is found */
01916        }
01917 /* total of calc and noncalc algae available and their total NPP */
01918      NC_ALG_NPP[cellLoc]  = NC_ALG_GPP[cellLoc]-NC_ALG_RESP[cellLoc]; 
01919      C_ALG_NPP[cellLoc]  = C_ALG_GPP[cellLoc]-C_ALG_RESP[cellLoc]; 
01920 
01921 
01922      DOM_QUALITY_CF[cellLoc]  = (Max(TP_SFWT_CONC_MG[cellLoc],TP_SEDWT_CONCACTMG[cellLoc]))
01923          /GP_DOM_DECOMP_POPT; /* mg/L */
01924      DOM_TEMP_CF[cellLoc] = Exp(0.20*(H2O_TEMP[cellLoc]-GP_DOM_DECOMP_TOPT))*pow(((40.0-H2O_TEMP[cellLoc])/(40.0-GP_DOM_DECOMP_TOPT)),(0.20*(40.0-GP_DOM_DECOMP_TOPT)));
01925      soil_MOIST_CF[cellLoc] = pow(Max(UNSAT_MOIST_PRP[cellLoc],0.0),0.75);
01926      DOM_DECOMP_POT[cellLoc] = GP_DOM_RCDECOMP*DOM_QUALITY_CF[cellLoc]*DOM_TEMP_CF[cellLoc]*DEPOS_ORG_MAT[cellLoc]*(Min(DOM_SED_AEROB_Z[cellLoc]/HP_DOM_MAXDEPTH[HAB[cellLoc]],1.0)*soil_MOIST_CF[cellLoc]+GP_DOM_DECOMPRED*Min(DOM_SED_ANAEROB_Z[cellLoc]/HP_DOM_MAXDEPTH[HAB[cellLoc]],1.0));
01927      DOM_DECOMP[cellLoc] =  ( (DOM_DECOMP_POT[cellLoc])*DT>DEPOS_ORG_MAT[cellLoc] ) ? ( (DEPOS_ORG_MAT[cellLoc])/DT ) : ( DOM_DECOMP_POT[cellLoc]);
01928 /* added for P DOM stoich */
01929      DOP_DECOMP[cellLoc] = DOM_DECOMP[cellLoc] * DOM_P_OM[cellLoc]; 
01930 
01931      SAT_VS_UNSAT[cellLoc] = 1/Exp(100.0*Max((SURFACE_WAT[cellLoc]-UNSAT_DEPTH[cellLoc]),0.0));
01932      UNSAT_WT_POT[cellLoc] = Max(UNSAT_CAP[cellLoc]-UNSAT_WATER[cellLoc],0.0);
01933          SF_WT_TO_SAT_DOWNFLOW[cellLoc]  = ( (1.0-SAT_VS_UNSAT[cellLoc])*UNSAT_WT_POT[cellLoc]*DT>SURFACE_WAT[cellLoc] ) ? ( SURFACE_WAT[cellLoc]/DT ) : ( (1.0-SAT_VS_UNSAT[cellLoc])*UNSAT_WT_POT[cellLoc]); 
01934      SAT_WT_RECHG[cellLoc] = ( GP_HYD_RCRECHG*DT>SAT_WATER[cellLoc] ) ? ( SAT_WATER[cellLoc]/DT ) : ( GP_HYD_RCRECHG);
01935      SF_WT_POT_INF[cellLoc] = ( (SURFACE_WAT[cellLoc]<HP_HYD_RCINFILT[HAB[cellLoc]]*DT) ) ? ( SURFACE_WAT[cellLoc]/DT ) : ( HP_HYD_RCINFILT[HAB[cellLoc]]);
01936      SF_WT_INFILTRATION[cellLoc] = ( SF_WT_POT_INF[cellLoc]*SAT_VS_UNSAT[cellLoc]*DT>UNSAT_WT_POT[cellLoc] ) ? ( (UNSAT_WT_POT[cellLoc])/DT ) : ( SF_WT_POT_INF[cellLoc]*SAT_VS_UNSAT[cellLoc]);
01937      HYD_DOM_ACTWAT_PRES[cellLoc] = ( HYD_DOM_ACTWAT_VOL[cellLoc] > 0.01 ) ? ( 1.0 ) : ( 0.0);
01938      HYD_WATER_AVAIL[cellLoc] = Min(1.0, UNSAT_MOIST_PRP[cellLoc]+Exp(-10.0*Max(UNSAT_DEPTH[cellLoc]-HP_NPHBIO_ROOTDEPTH[HAB[cellLoc]],0.0)));
01939 
01940      MAC_LIGHT_CF[cellLoc] = SOLRADGRD[cellLoc]/HP_MAC_LIGHTSAT[HAB[cellLoc]]*Exp(1.0-SOLRADGRD[cellLoc]/HP_MAC_LIGHTSAT[HAB[cellLoc]]);
01941      MAC_TEMP_CF[cellLoc] = Exp(0.20*(AIR_TEMP[cellLoc]-HP_MAC_TEMPOPT[HAB[cellLoc]])) *pow(((40.0-AIR_TEMP[cellLoc])/(40.0-HP_MAC_TEMPOPT[HAB[cellLoc]])),(0.20*(40.0-HP_MAC_TEMPOPT[HAB[cellLoc]])));
01942      MAC_WATER_AVAIL_CF[cellLoc] = graph8(0x0,HYD_WATER_AVAIL[cellLoc]);
01943      MAC_WATER_CF[cellLoc] = Min(MAC_WATER_AVAIL_CF[cellLoc], Max(1.0-Max((SURFACE_WAT[cellLoc]-HP_MAC_WAT_TOLER[HAB[cellLoc]])/HP_MAC_WAT_TOLER[HAB[cellLoc]],0.0),0.0));
01944      MAC_NUT_CF[cellLoc] =  TP_SEDWT_CONCACT[cellLoc]/(TP_SEDWT_CONCACT[cellLoc]+HP_MAC_KSP[HAB[cellLoc]]*0.001) ;
01945 
01946      MAC_SALT_CF[cellLoc] = ( HP_MAC_SALIN_THRESH[HAB[cellLoc]]>0.0 ) ? (  Max( 1.0-Max(SAL_SED_WT[cellLoc]-HP_MAC_SALIN_THRESH[HAB[cellLoc]],0.0)/HP_MAC_SALIN_THRESH[HAB[cellLoc]],0.0) ) : ( Max(1.0-SAL_SED_WT[cellLoc],0.0));
01947      min_litTemp = Min(MAC_LIGHT_CF[cellLoc], MAC_TEMP_CF[cellLoc]);
01948      MAC_PROD_CF[cellLoc]  = Min(min_litTemp,MAC_WATER_CF[cellLoc])
01949          *MAC_NUT_CF[cellLoc]*MAC_SALT_CF[cellLoc];
01950      PHBIO_NPP[cellLoc] = HP_PHBIO_RCNPP[HAB[cellLoc]]*MAC_PROD_CF[cellLoc]*MAC_PH_BIOMAS[cellLoc]* Max( (1.0-MAC_TOT_BIOM[cellLoc]/MAC_MAX_BIO[cellLoc]), 0.0);
01951 /* check for available P mass that will be taken up (MichMent kinetics in nutCF does not) */
01952      tmp = (PHBIO_NPP[cellLoc] > 0) ? 
01953          TP_SED_WT[cellLoc] / ( PHBIO_NPP[cellLoc] * HP_NPHBIO_IC_PC[HAB[cellLoc]]*CELL_SIZE*DT) :
01954          1.0;
01955      if (tmp < 1.0) PHBIO_NPP[cellLoc] *= tmp;   
01956     /* reduce the production proportionally if excess demand is found */
01957     /* can have high conc, but low mass of P avail, in presence of high plant biomass and high demand */
01958 /* now add the P and OM associated with that C */
01959      phbio_npp_P[cellLoc] = PHBIO_NPP[cellLoc] * HP_PHBIO_IC_PC[HAB[cellLoc]];     /* habitat-specfic stoichiometry */
01960      phbio_npp_OM[cellLoc] = PHBIO_NPP[cellLoc] / HP_PHBIO_IC_CTOOM[HAB[cellLoc]]; /* habitat-specfic stoichiometry */
01961 
01962 /* init ("target") ph/nph ratio and new transloc algorithm */
01963      MAC_PHtoNPH_Init = HP_PHBIO_MAX[HAB[cellLoc]] / HP_NPHBIO_MAX[HAB[cellLoc]] ;
01964      MAC_PHtoNPH = MAC_PH_BIOMAS[cellLoc] / MAC_NOPH_BIOMAS[cellLoc];
01965 
01966      PHBIO_TRANSLOC_POT[cellLoc]  = 0.0; /* (MAC_PHtoNPH<MAC_PHtoNPH_Init) ? (exp(HP_MAC_TRANSLOC_RC[HAB[cellLoc]] *(MAC_PHtoNPH_Init-MAC_PHtoNPH)) - 1.0) : (0.0) */ 
01967 
01968      PHBIO_TRANSLOC[cellLoc] =  ( (PHBIO_TRANSLOC_POT[cellLoc])*DT >NPHBIO_AVAIL[cellLoc] ) ? ( (NPHBIO_AVAIL[cellLoc])/DT ) : ( PHBIO_TRANSLOC_POT[cellLoc]);
01969 /*  now remove the P and OM associated with that C */
01970      phbio_transl_P[cellLoc] = PHBIO_TRANSLOC[cellLoc] * mac_nph_PC[cellLoc];
01971      phbio_transl_OM[cellLoc] = PHBIO_TRANSLOC[cellLoc] / mac_nph_CtoOM[cellLoc];
01972      NPHBIO_MORT_POT[cellLoc] = NPHBIO_AVAIL[cellLoc]*HP_PHBIO_RCMORT[HAB[cellLoc]]*(1.0-MAC_PH_BIOMAS[cellLoc]/HP_PHBIO_MAX[HAB[cellLoc]]);
01973      NPHBIO_MORT[cellLoc] =  ( (PHBIO_TRANSLOC[cellLoc]+NPHBIO_MORT_POT[cellLoc])*DT>NPHBIO_AVAIL[cellLoc] ) ? ( (NPHBIO_AVAIL[cellLoc]-PHBIO_TRANSLOC[cellLoc]*DT)/DT ) : ( NPHBIO_MORT_POT[cellLoc]);
01974      PHBIO_MORT_POT[cellLoc] = HP_PHBIO_RCMORT[HAB[cellLoc]] *PHBIO_AVAIL[cellLoc] *(1.0-MAC_WATER_AVAIL_CF[cellLoc]);
01975 /* now remove the P and OM associated with that C */
01976      nphbio_mort_P[cellLoc] = NPHBIO_MORT[cellLoc] * mac_nph_PC[cellLoc];
01977      nphbio_mort_OM[cellLoc] = NPHBIO_MORT[cellLoc] / mac_nph_CtoOM[cellLoc];
01978 
01979      NPHBIO_TRANSLOC_POT[cellLoc] = 0.0; /* (MAC_PHtoNPH>MAC_PHtoNPH_Init) ? (exp(HP_MAC_TRANSLOC_RC[HAB[cellLoc]] *(MAC_PHtoNPH-MAC_PHtoNPH_Init)) - 1.0) : (0.0) */ 
01980      NPHBIO_TRANSLOC[cellLoc] = ( (NPHBIO_TRANSLOC_POT[cellLoc])*DT >MAC_PH_BIOMAS[cellLoc] ) ? ( (MAC_PH_BIOMAS[cellLoc])/DT ) : ( NPHBIO_TRANSLOC_POT[cellLoc]);
01981 /*  now remove the P and OM associated with that C */
01982      nphbio_transl_P[cellLoc] = NPHBIO_TRANSLOC[cellLoc] * mac_ph_PC[cellLoc];
01983      nphbio_transl_OM[cellLoc] = NPHBIO_TRANSLOC[cellLoc] / mac_ph_CtoOM[cellLoc];
01984      PHBIO_MORT[cellLoc] = ( (PHBIO_MORT_POT[cellLoc]+NPHBIO_TRANSLOC[cellLoc])*DT>PHBIO_AVAIL[cellLoc] ) ? ( (PHBIO_AVAIL[cellLoc]-NPHBIO_TRANSLOC[cellLoc]*DT)/DT ) : ( PHBIO_MORT_POT[cellLoc]);
01985 /*  now remove the P associated with that C */
01986      phbio_mort_P[cellLoc] = PHBIO_MORT[cellLoc] * mac_ph_PC[cellLoc];
01987      phbio_mort_OM[cellLoc] = PHBIO_MORT[cellLoc] / mac_ph_CtoOM[cellLoc];
01988 
01989 
01990      FLOC_DECOMP_QUAL_CF[cellLoc] = Min(TP_SFWT_CONC_MG[cellLoc]/GP_DOM_DECOMP_POPT,1.0) ;
01991      FLOC_DECOMP_POT[cellLoc] = GP_DOM_RCDECOMP*FLOC[cellLoc]*DOM_TEMP_CF[cellLoc] *FLOC_DECOMP_QUAL_CF[cellLoc];
01992      FLOC_DECOMP[cellLoc] = ( (FLOC_DECOMP_POT[cellLoc])*DT>FLOC[cellLoc] ) ? ( (FLOC[cellLoc])/DT ) : ( FLOC_DECOMP_POT[cellLoc]);
01993      FLOC_DEPO_POT[cellLoc] = (  SURFACE_WAT[cellLoc] > GP_DetentZ ) ? ( FLOC[cellLoc]*0.05 ) : ( FLOC[cellLoc]/DT);
01994      FLOC_DEPO[cellLoc] = ( (FLOC_DEPO_POT[cellLoc]+FLOC_DECOMP[cellLoc])*DT>FLOC[cellLoc] ) ? ( (FLOC[cellLoc]-FLOC_DECOMP[cellLoc]*DT)/DT ) : ( FLOC_DEPO_POT[cellLoc]);
01995  
01996      HYD_MANNINGS_N[cellLoc]  = Max(-Abs((HP_MAC_MAXROUGH[HAB[cellLoc]]-HP_MAC_MINROUGH[HAB[cellLoc]])*  (pow(2.0,(1.0-SURFACE_WAT[cellLoc]/MAC_HEIGHT[cellLoc]))-1.0)) + HP_MAC_MAXROUGH[HAB[cellLoc]],HP_MAC_MINROUGH[HAB[cellLoc]]);
01997   } /* spatial loop end */
01998   } /* spatial loop end */
01999   usrErr("Done.");
02000 
02001 } /* end of init_eqns */

void init_canals int  irun  ) 
 

Call to initialize the water managment canal network topology and data.

Parameters:
irun a counter of number of times a new simulation run is executed

Definition at line 2007 of file UnitMod.c.

02008 {
02009    if (irun == 1) {
02010       usrErr("Initializing Water Management...");
02011       Canal_Network_Init(GP_DATUM_DISTANCE,SED_ELEV); /* WatMgmt.c - initialize the canal network topology and data */
02012       usrErr("Done Water Management.");
02013    }
02014    else {
02015       reinitCanals();
02016    }
02017 
02018 }

void init_succession void   ) 
 

Call to initialize the habitat succession module.

Definition at line 2021 of file UnitMod.c.

Referenced by main().

02022 {
02023    HabSwitch_Init( ); 
02024 
02025 }

void reinitBIR void   ) 
 

Calls to re-initialize Basin/Indicator-Region data.

Definition at line 2028 of file UnitMod.c.

Referenced by main().

02029 {
02030    usrErr0("Re-initializing Basin/Indicator-Region info...");
02031    BIRstats_reset(); 
02032    BIRbudg_reset(); 
02033    Cell_reset_avg(); 
02034    Cell_reset_hydper(); 
02035    usrErr("Done.");
02036 }

void reinitCanals void   ) 
 

Call to re-initialize canal storages.

Definition at line 2039 of file UnitMod.c.

Referenced by main().

02040 {
02041    usrErr0("Re-initializing Canal depths & constituent masses...");
02042    CanalReInit();  
02043    usrErr("Done.");
02044 }

void alloc_memory  ) 
 

Allocate memory.

Allocate memory for model variables, and initialize (not context-specific) values.

Definition at line 2514 of file UnitMod.c.

Referenced by main().

02515 {
02516   usrErr0("Allocating Memory...");  /* console message */
02517   
02518   ON_MAP = (unsigned char *) nalloc(sizeof(unsigned char)*(s0+2)*(s1+2),"ON_MAP");
02519   init_pvar(ON_MAP,NULL,'c',0.0);
02520 
02521   BCondFlow = (int *) nalloc(sizeof(int)*(s0+2)*(s1+2),"BCondFlow");
02522   init_pvar(BCondFlow,NULL,'d',0.0);
02523   HAB = (unsigned char *) nalloc(sizeof(unsigned char)*(s0+2)*(s1+2),"HAB");
02524   init_pvar(HAB,NULL,'c',0.0);
02525   basn = (int *) nalloc(sizeof(int)*(s0+2)*(s1+2),"basn"); /* Basin/Indicator-Region map */
02526   init_pvar(basn,NULL,'d',0.0);
02527 
02528   ALG_INCID_LIGHT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ALG_INCID_LIGHT");
02529   init_pvar(ALG_INCID_LIGHT,NULL,'f',0.0);
02530   ALG_LIGHT_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ALG_LIGHT_CF");
02531   init_pvar(ALG_LIGHT_CF,NULL,'f',0.0);
02532   ALG_LIGHT_EXTINCT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ALG_LIGHT_EXTINCT");
02533   init_pvar(ALG_LIGHT_EXTINCT,NULL,'f',0.0);
02534   ALG_WAT_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ALG_WAT_CF");
02535   init_pvar(ALG_WAT_CF,NULL,'f',0.0);
02536   ALG_TEMP_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ALG_TEMP_CF");
02537   init_pvar(ALG_TEMP_CF,NULL,'f',0.0);
02538   ALG_REFUGE = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ALG_REFUGE");
02539   init_pvar(ALG_REFUGE,NULL,'f',0.0);
02540   ALG_SAT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ALG_SAT");
02541   init_pvar(ALG_SAT,NULL,'f',0.0);
02542   ALG_TOT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ALG_TOT");
02543   init_pvar(ALG_TOT,NULL,'f',0.0);
02544 
02545   NC_ALG_AVAIL_MORT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_AVAIL_MORT");
02546   init_pvar(NC_ALG_AVAIL_MORT,NULL,'f',0.0);
02547   NC_ALG_GPP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_GPP");
02548   init_pvar(NC_ALG_GPP,NULL,'f',0.0);
02549   NC_ALG_MORT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_MORT");
02550   init_pvar(NC_ALG_MORT,NULL,'f',0.0);
02551   NC_ALG_MORT_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_MORT_POT");
02552   init_pvar(NC_ALG_MORT_POT,NULL,'f',0.0);
02553   NC_ALG_NPP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_NPP");
02554   init_pvar(NC_ALG_NPP,NULL,'f',0.0);
02555   NC_ALG_NUT_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_NUT_CF");
02556   init_pvar(NC_ALG_NUT_CF,NULL,'f',0.0);
02557   NC_ALG_PROD_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_PROD_CF");
02558   init_pvar(NC_ALG_PROD_CF,NULL,'f',0.0);
02559   NC_ALG_RESP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_RESP");
02560   init_pvar(NC_ALG_RESP,NULL,'f',0.0);
02561   NC_ALG_RESP_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_RESP_POT");
02562   init_pvar(NC_ALG_RESP_POT,NULL,'f',0.0);
02563   NC_ALG = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG");
02564   init_pvar(NC_ALG,NULL,'f',0.0);
02565   C_ALG_AVAIL_MORT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_AVAIL_MORT");
02566   init_pvar(C_ALG_AVAIL_MORT,NULL,'f',0.0);
02567   C_ALG_GPP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_GPP");
02568   init_pvar(C_ALG_GPP,NULL,'f',0.0);
02569   C_ALG_MORT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_MORT");
02570   init_pvar(C_ALG_MORT,NULL,'f',0.0);
02571   C_ALG_MORT_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_MORT_POT");
02572   init_pvar(C_ALG_MORT_POT,NULL,'f',0.0);
02573   C_ALG_NPP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_NPP");
02574   init_pvar(C_ALG_NPP,NULL,'f',0.0);
02575   C_ALG_NUT_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_NUT_CF");
02576   init_pvar(C_ALG_NUT_CF,NULL,'f',0.0);
02577   C_ALG_PROD_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_PROD_CF");
02578   init_pvar(C_ALG_PROD_CF,NULL,'f',0.0);
02579   C_ALG_RESP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_RESP");
02580   init_pvar(C_ALG_RESP,NULL,'f',0.0);
02581   C_ALG_RESP_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_RESP_POT");
02582   init_pvar(C_ALG_RESP_POT,NULL,'f',0.0);
02583   C_ALG = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG");
02584   init_pvar(C_ALG,NULL,'f',0.0);
02585   NC_ALG_P = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_P");
02586   init_pvar(NC_ALG_P,NULL,'f',0.0);
02587   C_ALG_P = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_P");
02588   init_pvar(C_ALG_P,NULL,'f',0.0);
02589   NC_ALG_GPP_P = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_GPP_P");
02590   init_pvar(NC_ALG_GPP_P,NULL,'f',0.0);
02591   C_ALG_GPP_P = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_GPP_P");
02592   init_pvar(C_ALG_GPP_P,NULL,'f',0.0);
02593   NC_ALG_MORT_P = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_MORT_P");
02594   init_pvar(NC_ALG_MORT_P,NULL,'f',0.0);
02595   C_ALG_MORT_P = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_ALG_MORT_P");
02596   init_pvar(C_ALG_MORT_P,NULL,'f',0.0);
02597   NC_ALG_PCrep = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_ALG_PCrep");
02598   init_pvar(NC_ALG_PCrep,NULL,'f',0.0);
02599   C_ALG_PCrep = (float *) nalloc(sizeof(double)*(s0+2)*(s1+2),"C_ALG_PCrep");
02600   init_pvar(C_ALG_PCrep,NULL,'f',0.0);
02601   NC_ALG_PC = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"NC_ALG_PC");
02602   init_pvar(NC_ALG_PC,NULL,'l',0.0);
02603   C_ALG_PC = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"C_ALG_PC");
02604   init_pvar(C_ALG_PC,NULL,'l',0.0);
02605 
02606   DEPOS_ORG_MAT = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"DEPOS_ORG_MAT");
02607   init_pvar(DEPOS_ORG_MAT,NULL,'l',0.0);
02608         
02609   DOM_Z = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOM_Z");
02610   init_pvar(DOM_Z,NULL,'f',0.0);
02611   DOM_DECOMP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOM_DECOMP");
02612   init_pvar(DOM_DECOMP,NULL,'f',0.0);
02613   DOM_DECOMP_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOM_DECOMP_POT");
02614   init_pvar(DOM_DECOMP_POT,NULL,'f',0.0);
02615   DOM_fr_nphBio = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOM_fr_nphBio");
02616   init_pvar(DOM_fr_nphBio,NULL,'f',0.0);
02617   
02618   Floc_fr_phBio = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Floc_fr_phBio");
02619   init_pvar(Floc_fr_phBio,NULL,'f',0.0);
02620   DOM_FR_FLOC = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOM_FR_FLOC");
02621   init_pvar(DOM_FR_FLOC,NULL,'f',0.0);
02622   soil_MOIST_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"soil_MOIST_CF");
02623   init_pvar(soil_MOIST_CF,NULL,'f',0.0);
02624   DOM_QUALITY_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOM_QUALITY_CF");
02625   init_pvar(DOM_QUALITY_CF,NULL,'f',0.0);
02626   DOM_SED_AEROB_Z = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOM_SED_AEROB_Z");
02627   init_pvar(DOM_SED_AEROB_Z,NULL,'f',0.0);
02628   DOM_SED_ANAEROB_Z = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOM_SED_ANAEROB_Z");
02629   init_pvar(DOM_SED_ANAEROB_Z,NULL,'f',0.0);
02630   DOM_TEMP_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOM_TEMP_CF");
02631   init_pvar(DOM_TEMP_CF,NULL,'f',0.0);
02632   ELEVATION = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ELEVATION");
02633   init_pvar(ELEVATION,NULL,'f',0.0);
02634   Bathymetry = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Bathymetry");
02635   init_pvar(Bathymetry,NULL,'f',0.0);
02636   SED_ELEV = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SED_ELEV");
02637   init_pvar(SED_ELEV,NULL,'f',0.0);
02638   SED_INACT_Z = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SED_INACT_Z");
02639   init_pvar(SED_INACT_Z,NULL,'f',0.0);
02640   DOP_FLOC = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOP_FLOC");
02641   init_pvar(DOP_FLOC,NULL,'f',0.0);
02642   DOP_nphBio = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOP_nphBio");
02643   init_pvar(DOP_nphBio,NULL,'f',0.0);
02644 
02645   DOM_P_OM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"DOM_P_OM");
02646   init_pvar(DOM_P_OM,NULL,'l',0.0);
02647 
02648   TPtoSOIL = (float *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TPtoSOIL");
02649   init_pvar(TPtoSOIL,NULL,'l',0.0);
02650   TPtoSOIL_rep = (float *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TPtoSOIL_rep");
02651   init_pvar(TPtoSOIL_rep,NULL,'l',0.0);
02652   TPtoVOL = (float *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TPtoVOL");
02653   init_pvar(TPtoVOL,NULL,'l',0.0);
02654   TPtoVOL_rep = (float *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TPtoVOL_rep");
02655   init_pvar(TPtoVOL_rep,NULL,'l',0.0);
02656   BulkD = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"BulkD");
02657   init_pvar(BulkD,NULL,'f',0.0);
02658   DOM_BD = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOM_BD");
02659   init_pvar(DOM_BD,NULL,'f',0.0);
02660   Inorg_Z = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Inorg_Z");
02661   init_pvar(Inorg_Z,NULL,'f',0.0);
02662   DIM = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DIM");
02663   init_pvar(DIM,NULL,'f',0.0);
02664   DOP_DECOMP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"DOP_DECOMP");
02665   init_pvar(DOP_DECOMP,NULL,'f',0.0);
02666 
02667   DOP = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"DOP");
02668   init_pvar(DOP,NULL,'l',0.0);
02669 
02670 /* placeholder for fire */
02671   FIREdummy = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FIREdummy");
02672   init_pvar(FIREdummy,NULL,'f',0.0);
02673         
02674   HYD_DOM_ACTWAT_PRES = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_DOM_ACTWAT_PRES");
02675   init_pvar(HYD_DOM_ACTWAT_PRES,NULL,'f',0.0);
02676   HYD_DOM_ACTWAT_VOL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_DOM_ACTWAT_VOL");
02677   init_pvar(HYD_DOM_ACTWAT_VOL,NULL,'f',0.0);
02678   HYD_EVAP_CALC = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_EVAP_CALC");
02679   init_pvar(HYD_EVAP_CALC,NULL,'f',0.0);
02680   HYD_MANNINGS_N = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_MANNINGS_N");
02681   init_pvar(HYD_MANNINGS_N,NULL,'f',0.0);
02682   HYD_RCCONDUCT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_RCCONDUCT");
02683   init_pvar(HYD_RCCONDUCT,NULL,'f',0.0);
02684   HYD_SAT_POT_TRANS = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_SAT_POT_TRANS");
02685   init_pvar(HYD_SAT_POT_TRANS,NULL,'f',0.0);
02686   HYD_SED_WAT_VOL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_SED_WAT_VOL");
02687   init_pvar(HYD_SED_WAT_VOL,NULL,'f',0.0);
02688   HYD_TOT_POT_TRANSP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_TOT_POT_TRANSP");
02689   init_pvar(HYD_TOT_POT_TRANSP,NULL,'f',0.0);
02690   HydTotHd = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HydTotHd");
02691   init_pvar(HydTotHd,NULL,'f',0.0);
02692   HYD_TRANSP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_TRANSP");
02693   init_pvar(HYD_TRANSP,NULL,'f',0.0);
02694   HYD_ET = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_ET");
02695   init_pvar(HYD_ET,NULL,'f',0.0);
02696   HYD_UNSAT_POT_TRANS = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_UNSAT_POT_TRANS");
02697   init_pvar(HYD_UNSAT_POT_TRANS,NULL,'f',0.0);
02698   HYD_WATER_AVAIL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HYD_WATER_AVAIL");
02699   init_pvar(HYD_WATER_AVAIL,NULL,'f',0.0);
02700 
02701 /* sfwmm rainfall, stage, and pET mapped to elm grid */
02702   boundcond_rain = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"boundcond_rain");
02703   init_pvar(boundcond_rain,NULL,'f',0.0);
02704   boundcond_depth = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"boundcond_depth");
02705   init_pvar(boundcond_depth,NULL,'f',0.0);
02706   boundcond_ETp = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"boundcond_ETp");
02707   init_pvar(boundcond_ETp,NULL,'f',0.0);
02708 
02709   SAT_TO_UNSAT_FL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SAT_TO_UNSAT_FL");
02710   init_pvar(SAT_TO_UNSAT_FL,NULL,'f',0.0);
02711   SAT_VS_UNSAT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SAT_VS_UNSAT");
02712   init_pvar(SAT_VS_UNSAT,NULL,'f',0.0);
02713   SAT_WATER = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SAT_WATER");
02714   init_pvar(SAT_WATER,NULL,'f',0.0);
02715   SAT_WT_HEAD = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SAT_WT_HEAD");
02716   init_pvar(SAT_WT_HEAD,NULL,'f',0.0);
02717   SAT_WT_RECHG = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SAT_WT_RECHG");
02718   init_pvar(SAT_WT_RECHG,NULL,'f',0.0);
02719   SAT_WT_TRANSP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SAT_WT_TRANSP");
02720   init_pvar(SAT_WT_TRANSP,NULL,'f',0.0);
02721   SF_WT_EVAP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SF_WT_EVAP");
02722   init_pvar(SF_WT_EVAP,NULL,'f',0.0);
02723   SF_WT_FROM_RAIN = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SF_WT_FROM_RAIN");
02724   init_pvar(SF_WT_FROM_RAIN,NULL,'f',0.0);
02725   SF_WT_INFILTRATION = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SF_WT_INFILTRATION");
02726   init_pvar(SF_WT_INFILTRATION,NULL,'f',0.0);
02727   SF_WT_POT_INF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SF_WT_POT_INF");
02728   init_pvar(SF_WT_POT_INF,NULL,'f',0.0);
02729   SF_WT_TO_SAT_DOWNFLOW = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SF_WT_TO_SAT_DOWNFLOW");
02730   init_pvar(SF_WT_TO_SAT_DOWNFLOW,NULL,'f',0.0);
02731   SFWT_VOL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SFWT_VOL");
02732   init_pvar(SFWT_VOL,NULL,'f',0.0);
02733   SURFACE_WAT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SURFACE_WAT");
02734   init_pvar(SURFACE_WAT,NULL,'f',0.0);
02735   UNSAT_AVAIL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UNSAT_AVAIL");
02736   init_pvar(UNSAT_AVAIL,NULL,'f',0.0);
02737   UNSAT_CAP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UNSAT_CAP");
02738   init_pvar(UNSAT_CAP,NULL,'f',0.0);
02739   UNSAT_DEPTH = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UNSAT_DEPTH");
02740   init_pvar(UNSAT_DEPTH,NULL,'f',0.0);
02741   UNSAT_HYD_COND_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UNSAT_HYD_COND_CF");
02742   init_pvar(UNSAT_HYD_COND_CF,NULL,'f',0.0);
02743   UNSAT_MOIST_PRP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UNSAT_MOIST_PRP");
02744   init_pvar(UNSAT_MOIST_PRP,NULL,'f',0.0);
02745   UNSAT_PERC = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UNSAT_PERC");
02746   init_pvar(UNSAT_PERC,NULL,'f',0.0);
02747   UNSAT_TO_SAT_FL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UNSAT_TO_SAT_FL");
02748   init_pvar(UNSAT_TO_SAT_FL,NULL,'f',0.0);
02749   UNSAT_TRANSP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UNSAT_TRANSP");
02750   init_pvar(UNSAT_TRANSP,NULL,'f',0.0);
02751   UNSAT_WATER = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UNSAT_WATER");
02752   init_pvar(UNSAT_WATER,NULL,'f',0.0);
02753   UNSAT_WT_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UNSAT_WT_POT");
02754   init_pvar(UNSAT_WT_POT,NULL,'f',0.0);
02755 
02756   MAC_HEIGHT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_HEIGHT");
02757   init_pvar(MAC_HEIGHT,NULL,'f',0.0);
02758   MAC_LAI = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_LAI");
02759   init_pvar(MAC_LAI,NULL,'f',0.0);
02760   LAI_eff = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"LAI_eff");
02761   init_pvar(LAI_eff,NULL,'f',0.0);
02762   MAC_LIGHT_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_LIGHT_CF");
02763   init_pvar(MAC_LIGHT_CF,NULL,'f',0.0);
02764   MAC_MAX_BIO = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_MAX_BIO");
02765   init_pvar(MAC_MAX_BIO,NULL,'f',0.0);
02766   MAC_NOPH_BIOMAS = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_NOPH_BIOMAS");
02767   init_pvar(MAC_NOPH_BIOMAS,NULL,'f',0.0);
02768   MAC_NUT_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_NUT_CF");
02769   init_pvar(MAC_NUT_CF,NULL,'f',0.0);
02770   MAC_PH_BIOMAS = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_PH_BIOMAS");
02771   init_pvar(MAC_PH_BIOMAS,NULL,'f',0.0);
02772   MAC_PROD_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_PROD_CF");
02773   init_pvar(MAC_PROD_CF,NULL,'f',0.0);
02774   MAC_REL_BIOM = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_REL_BIOM");
02775   init_pvar(MAC_REL_BIOM,NULL,'f',0.0);
02776   MAC_SALT_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_SALT_CF");
02777   init_pvar(MAC_SALT_CF,NULL,'f',0.0);
02778   MAC_TEMP_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_TEMP_CF");
02779   init_pvar(MAC_TEMP_CF,NULL,'f',0.0);
02780   MAC_TOT_BIOM = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_TOT_BIOM");
02781   init_pvar(MAC_TOT_BIOM,NULL,'f',0.0);
02782   MAC_WATER_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_WATER_CF");
02783   init_pvar(MAC_WATER_CF,NULL,'f',0.0);
02784   MAC_WATER_AVAIL_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MAC_WATER_AVAIL_CF");
02785   init_pvar(MAC_WATER_AVAIL_CF,NULL,'f',0.0);
02786   NPHBIO_AVAIL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NPHBIO_AVAIL");
02787   init_pvar(NPHBIO_AVAIL,NULL,'f',0.0);
02788   NPHBIO_MORT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NPHBIO_MORT");
02789   init_pvar(NPHBIO_MORT,NULL,'f',0.0);
02790   NPHBIO_MORT_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NPHBIO_MORT_POT");
02791   init_pvar(NPHBIO_MORT_POT,NULL,'f',0.0);
02792   NPHBIO_REFUGE = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NPHBIO_REFUGE");
02793   init_pvar(NPHBIO_REFUGE,NULL,'f',0.0);
02794   NPHBIO_SAT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NPHBIO_SAT");
02795   init_pvar(NPHBIO_SAT,NULL,'f',0.0);
02796   NPHBIO_TRANSLOC = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NPHBIO_TRANSLOC");
02797   init_pvar(NPHBIO_TRANSLOC,NULL,'f',0.0);
02798   NPHBIO_TRANSLOC_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NPHBIO_TRANSLOC_POT");
02799   init_pvar(NPHBIO_TRANSLOC_POT,NULL,'f',0.0);
02800   PHBIO_AVAIL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PHBIO_AVAIL");
02801   init_pvar(PHBIO_AVAIL,NULL,'f',0.0);
02802   PHBIO_MORT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PHBIO_MORT");
02803   init_pvar(PHBIO_MORT,NULL,'f',0.0);
02804   PHBIO_MORT_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PHBIO_MORT_POT");
02805   init_pvar(PHBIO_MORT_POT,NULL,'f',0.0);
02806   PHBIO_NPP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PHBIO_NPP");
02807   init_pvar(PHBIO_NPP,NULL,'f',0.0);
02808   PHBIO_REFUGE = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PHBIO_REFUGE");
02809   init_pvar(PHBIO_REFUGE,NULL,'f',0.0);
02810   PHBIO_SAT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PHBIO_SAT");
02811   init_pvar(PHBIO_SAT,NULL,'f',0.0); 
02812   PHBIO_TRANSLOC = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PHBIO_TRANSLOC");
02813   init_pvar(PHBIO_TRANSLOC,NULL,'f',0.0);
02814   PHBIO_TRANSLOC_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PHBIO_TRANSLOC_POT");
02815   init_pvar(PHBIO_TRANSLOC_POT,NULL,'f',0.0);
02816 
02817   phbio_npp_P = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"phbio_npp_P");
02818   init_pvar(phbio_npp_P,NULL,'l',0.0);
02819   phbio_npp_OM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"phbio_npp_OM");
02820   init_pvar(phbio_npp_OM,NULL,'l',0.0);
02821   phbio_mort_P = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"phbio_mort_P");
02822   init_pvar(phbio_mort_P,NULL,'l',0.0);
02823   phbio_mort_OM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"phbio_mort_OM");
02824   init_pvar(phbio_mort_OM,NULL,'l',0.0);
02825   phbio_transl_P = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"phbio_transl_P");
02826   init_pvar(phbio_transl_P,NULL,'l',0.0);
02827   phbio_transl_OM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"phbio_transl_OM");
02828   init_pvar(phbio_transl_OM,NULL,'l',0.0);
02829   nphbio_transl_P = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"nphbio_transl_P");
02830   init_pvar(nphbio_transl_P,NULL,'l',0.0);
02831   nphbio_transl_OM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"nphbio_transl_OM");
02832   init_pvar(nphbio_transl_OM,NULL,'l',0.0);
02833   nphbio_mort_P = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"nphbio_mort_P");
02834   init_pvar(nphbio_mort_P,NULL,'l',0.0);
02835   nphbio_mort_OM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"nphbio_mort_OM");
02836   init_pvar(nphbio_mort_OM,NULL,'l',0.0);
02837   mac_nph_P = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"mac_nph_P");
02838   init_pvar(mac_nph_P,NULL,'l',0.0);
02839   mac_nph_PC = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"mac_nph_PC");
02840   init_pvar(mac_nph_PC,NULL,'l',0.0);
02841   mac_nph_OM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"mac_nph_OM");
02842   init_pvar(mac_nph_OM,NULL,'l',0.0);
02843   mac_nph_CtoOM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"mac_nph_CtoOM");
02844   init_pvar(mac_nph_CtoOM,NULL,'l',0.0);
02845   mac_ph_P = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"mac_ph_P");
02846   init_pvar(mac_ph_P,NULL,'l',0.0);
02847   mac_ph_PC = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"mac_ph_PC");
02848   init_pvar(mac_ph_PC,NULL,'l',0.0);
02849   mac_ph_OM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"mac_ph_OM");
02850   init_pvar(mac_ph_OM,NULL,'l',0.0);
02851   mac_ph_CtoOM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"mac_ph_CtoOM");
02852   init_pvar(mac_ph_CtoOM,NULL,'l',0.0);
02853 
02854   mac_nph_PC_rep = (float *) nalloc(sizeof(double)*(s0+2)*(s1+2),"mac_nph_PC_rep");
02855   init_pvar(mac_nph_PC_rep,NULL,'l',0.0);
02856   mac_ph_PC_rep = (float *) nalloc(sizeof(double)*(s0+2)*(s1+2),"mac_ph_PC_rep");
02857   init_pvar(mac_ph_PC_rep,NULL,'l',0.0);
02858 
02859   TP_SED_WT = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TP_SED_WT");
02860   init_pvar(TP_SED_WT,NULL,'l',0.0);
02861   TP_SED_CONC = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TP_SED_CONC");
02862   init_pvar(TP_SED_CONC,NULL,'l',0.0);
02863   TP_SEDWT_CONCACT = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TP_SEDWT_CONCACT");
02864   init_pvar(TP_SEDWT_CONCACT,NULL,'l',0.0);
02865   TP_SF_WT = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TP_SF_WT");
02866   init_pvar(TP_SF_WT,NULL,'l',0.0);
02867   TP_SFWT_CONC = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TP_SFWT_CONC");
02868   init_pvar(TP_SFWT_CONC,NULL,'l',0.0);
02869   TP_SORB = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TP_SORB");
02870   init_pvar(TP_SORB,NULL,'l',0.0);
02871   TP_SORBCONC = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TP_SORBCONC");
02872   init_pvar(TP_SORBCONC,NULL,'l',0.0);
02873   TP_SED_WT_AZ = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TP_SED_WT_AZ");
02874   init_pvar(TP_SED_WT_AZ,NULL,'l',0.0);
02875   TP_Act_to_Tot = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"TP_Act_to_Tot");
02876   init_pvar(TP_Act_to_Tot,NULL,'l',0.0);
02877 
02878   TP_Act_to_TotRep = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_Act_to_TotRep");
02879   init_pvar(TP_Act_to_TotRep,NULL,'f',0.0);
02880   TP_SORBCONC_rep = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_SORBCONC_rep");
02881   init_pvar(TP_SORBCONC_rep,NULL,'f',0.0);
02882 
02883   TP_DNFLOW = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_DNFLOW");
02884   init_pvar(TP_DNFLOW,NULL,'f',0.0);
02885   TP_DNFLOW_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_DNFLOW_POT");
02886   init_pvar(TP_DNFLOW_POT,NULL,'f',0.0);
02887   TP_FR_RAIN = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_FR_RAIN");
02888   init_pvar(TP_FR_RAIN,NULL,'f',0.0);
02889   TP_K = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_K");
02890   init_pvar(TP_K,NULL,'f',0.0);
02891   TP_SED_MINER = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_SED_MINER");
02892   init_pvar(TP_SED_MINER,NULL,'f',0.0);
02893   TP_SEDWT_CONCACTMG = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_SEDWT_CONCACTMG");
02894   init_pvar(TP_SEDWT_CONCACTMG,NULL,'f',0.0);
02895   TP_SEDWT_UPTAKE = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_SEDWT_UPTAKE");
02896   init_pvar(TP_SEDWT_UPTAKE,NULL,'f',0.0);
02897   TP_SFWT_CONC_MG = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_SFWT_CONC_MG");
02898   init_pvar(TP_SFWT_CONC_MG,NULL,'f',0.0);
02899   TP_SFWT_MINER = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_SFWT_MINER");
02900   init_pvar(TP_SFWT_MINER,NULL,'f',0.0);
02901   TP_SFWT_UPTAK = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_SFWT_UPTAK");
02902   init_pvar(TP_SFWT_UPTAK,NULL,'f',0.0);
02903   TP_settl = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_settl");
02904   init_pvar(TP_settl,NULL,'f',0.0);
02905   TP_SORB_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_SORB_POT");
02906   init_pvar(TP_SORB_POT,NULL,'f',0.0);
02907   TP_SORBTION = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_SORBTION");
02908   init_pvar(TP_SORBTION,NULL,'f',0.0);
02909   TP_UPFLOW = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_UPFLOW");
02910   init_pvar(TP_UPFLOW,NULL,'f',0.0);
02911   TP_UPFLOW_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_UPFLOW_POT");
02912   init_pvar(TP_UPFLOW_POT,NULL,'f',0.0);
02913   P_SUM_CELL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"P_SUM_CELL");
02914   init_pvar(P_SUM_CELL,NULL,'f',0.0);
02915 
02916   DINdummy = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"DINdummy");
02917   init_pvar(DINdummy,NULL,'l',0.0);
02918 
02919   WQMsettlVel = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"WQMsettlVel");
02920   init_pvar(WQMsettlVel,NULL,'f',0.0);
02921   TP_settlDays = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_settlDays");
02922   init_pvar(TP_settlDays,NULL,'f',0.0);
02923 
02924   SAL_SED_WT = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"SAL_SED_WT");
02925   init_pvar(SAL_SED_WT,NULL,'l',0.0);
02926   SAL_SF_WT_mb = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"SAL_SF_WT_mb");
02927   init_pvar(SAL_SF_WT_mb,NULL,'l',0.0);
02928   SALT_SED_WT = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"SALT_SED_WT");
02929   init_pvar(SALT_SED_WT,NULL,'l',0.0);
02930   SALT_SURF_WT = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"SALT_SURF_WT");
02931   init_pvar(SALT_SURF_WT,NULL,'l',0.0);
02932         
02933   SAL_SF_WT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SAL_SF_WT");
02934   init_pvar(SAL_SF_WT,NULL,'f',0.0);
02935   SALT_SED_TO_SF_FLOW = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SALT_SED_TO_SF_FLOW");
02936   init_pvar(SALT_SED_TO_SF_FLOW,NULL,'f',0.0);
02937   SALT_SFWAT_DOWNFL = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SALT_SFWAT_DOWNFL");
02938   init_pvar(SALT_SFWAT_DOWNFL,NULL,'f',0.0);
02939   SALT_SFWAT_DOWNFL_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SALT_SFWAT_DOWNFL_POT");
02940   init_pvar(SALT_SFWAT_DOWNFL_POT,NULL,'f',0.0);
02941 
02942   FLOC_DECOMP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FLOC_DECOMP");
02943   init_pvar(FLOC_DECOMP,NULL,'f',0.0);
02944   FLOC_DECOMP_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FLOC_DECOMP_POT");
02945   init_pvar(FLOC_DECOMP_POT,NULL,'f',0.0);
02946   FLOC_DECOMP_QUAL_CF = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FLOC_DECOMP_QUAL_CF");
02947   init_pvar(FLOC_DECOMP_QUAL_CF,NULL,'f',0.0);
02948   FLOC_Z = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FLOC_Z");
02949   init_pvar(FLOC_Z,NULL,'f',0.0);
02950   FLOC_DEPO = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FLOC_DEPO");
02951   init_pvar(FLOC_DEPO,NULL,'f',0.0);
02952   FLOC_DEPO_POT = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FLOC_DEPO_POT");
02953   init_pvar(FLOC_DEPO_POT,NULL,'f',0.0);
02954   FLOC_FR_ALGAE = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FLOC_FR_ALGAE");
02955   init_pvar(FLOC_FR_ALGAE,NULL,'f',0.0);
02956   FLOC = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FLOC");
02957   init_pvar(FLOC,NULL,'f',0.0);
02958   FlocP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FlocP");
02959   init_pvar(FlocP,NULL,'f',0.0);
02960   FlocP_DECOMP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FlocP_DECOMP");
02961   init_pvar(FlocP_DECOMP,NULL,'f',0.0);
02962   FlocP_FR_ALGAE = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FlocP_FR_ALGAE");
02963   init_pvar(FlocP_FR_ALGAE,NULL,'f',0.0);
02964   FlocP_PhBio = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FlocP_PhBio");
02965   init_pvar(FlocP_PhBio,NULL,'f',0.0);
02966   FlocP_DEPO = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FlocP_DEPO");
02967   init_pvar(FlocP_DEPO,NULL,'f',0.0);
02968   FlocP_OMrep = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"FlocP_OMrep");
02969   init_pvar(FlocP_OMrep,NULL,'f',0.0);
02970   FlocP_OM = (double *) nalloc(sizeof(double)*(s0+2)*(s1+2),"FlocP_OM");
02971   init_pvar(FlocP_OM,NULL,'l',0.0);
02972 
02973   SOLRADGRD = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SOLRADGRD");
02974   init_pvar(SOLRADGRD,NULL,'f',0.0);
02975   SOLRAD274 = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SOLRAD274");
02976   init_pvar(SOLRAD274,NULL,'f',0.0);
02977   AIR_TEMP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"AIR_TEMP");
02978   init_pvar(AIR_TEMP,NULL,'f',0.0);
02979   H2O_TEMP = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"H2O_TEMP");
02980   init_pvar(H2O_TEMP,NULL,'f',0.0);
02981 
02982 /* habitat-specific parameter arrays */
02983   HP_ALG_MAX = NULL;
02984 
02985   HP_DOM_MAXDEPTH = NULL;
02986   HP_DOM_AEROBTHIN = NULL;
02987 
02988   HP_TP_CONC_GRAD = NULL;
02989 
02990   HP_SALT_ICSEDWAT = NULL;
02991   HP_SALT_ICSFWAT = NULL;
02992 
02993   HP_PHBIO_MAX = NULL;
02994   HP_NPHBIO_MAX = NULL;
02995   HP_MAC_MAXHT = NULL;
02996   HP_NPHBIO_ROOTDEPTH = NULL;
02997   HP_MAC_MAXROUGH = NULL;
02998   HP_MAC_MINROUGH = NULL;
02999   HP_MAC_MAXLAI = NULL;
03000   HP_MAC_MAXCANOPCOND = NULL;
03001   HP_MAC_CANOPDECOUP = NULL;
03002   HP_MAC_TEMPOPT = NULL;
03003   HP_MAC_LIGHTSAT = NULL;
03004   HP_MAC_KSP = NULL;
03005   HP_PHBIO_RCNPP = NULL;
03006   HP_PHBIO_RCMORT = NULL;
03007   HP_MAC_WAT_TOLER = NULL;
03008   HP_MAC_SALIN_THRESH = NULL;
03009   HP_PHBIO_IC_CTOOM = NULL;
03010   HP_NPHBIO_IC_CTOOM = NULL;
03011   HP_PHBIO_IC_PC = NULL;
03012   HP_NPHBIO_IC_PC = NULL;
03013   HP_MAC_TRANSLOC_RC = NULL;
03014 
03015   HP_HYD_RCINFILT = NULL;
03016   HP_HYD_SPEC_YIELD = NULL;
03017   HP_HYD_POROSITY = NULL;
03018 
03019   HP_FLOC_IC = NULL;
03020   HP_FLOC_IC_CTOOM = NULL;
03021   HP_FLOC_IC_PC = NULL;
03022 
03023   HP_SfDepthLo = NULL;
03024   HP_SfDepthHi = NULL;
03025   HP_SfDepthInt = NULL;
03026   HP_PhosLo = NULL;
03027   HP_PhosHi = NULL;
03028   HP_PhosInt = NULL;
03029   HP_FireInt = NULL;
03030   
03031   usrErr("Done."); /* console message */
03032 
03033 }

void gen_output int  step,
ViewParm view
 

Generate output.

Create output of spatial maps, point locations and debug data (if any)

Parameters:
step The current iteration number
view The struct containing output configuration data
Remarks:
You need to ensure that the Outlist_size (#define in driver_utilities.h) is greater than (at least equal to) the number of output variables here (important if adding variables to this output list).

Remarks:
This UnitMod.c code "fragment" (gen_output function, populating tgen[] array) is generated from the "ModelOutlist_creator_v?.xls" OpenOffice workbook. Editing this source directly is not recommended w/o changing ModelOutlist_creator.
The order of the variables in the Model.outList configuration (model input) file MUST EXACTLY match their order in the tgen[] array of the struct.
The ModelOutlist_creator automatically generates both the Model.outList and the tgen[] code.
It is recommended that you utilize the ModelOutlist_creator to generate both the config file and the source code.

Definition at line 2059 of file UnitMod.c.

02060 {
02061     #define numOutputs 50000
02062     static int iw[numOutputs];
02063     int oIndex;
02064     ViewParm   *vp;
02065 
02072 /* TODO: the ModelOutlistCreator does not provide the correct argument for non-floats in tgen[] code generator - hand corrected doubles and unsigned chars here */
02073 
02074     static outVar_struct tgen[] = {
02075       { (float**)&TP_settlDays, "TP_settlDays", 'f' },
02076       { (float**)&FLOC, "FLOC", 'f' },
02077       { (float**)&FLOC_DECOMP, "FLOC_DECOMP", 'f' },
02078       { (float**)&FLOC_DECOMP_POT, "FLOC_DECOMP_POT", 'f' },
02079       { (float**)&FLOC_DECOMP_QUAL_CF, "FLOC_DECOMP_QUAL_CF", 'f' },
02080       { (float**)&FLOC_DEPO, "FLOC_DEPO", 'f' },
02081       { (float**)&FLOC_DEPO_POT, "FLOC_DEPO_POT", 'f' },
02082       { (float**)&FLOC_FR_ALGAE, "FLOC_FR_ALGAE", 'f' },
02083       { (float**)&FLOC_Z, "FLOC_Z", 'f' },
02084       { (float**)&FlocP_OMrep, "FlocP_OMrep", 'f' },
02085       { (float**)&soil_MOIST_CF, "soil_MOIST_CF", 'f' },
02086       { (float**)&TP_SED_MINER, "TP_SED_MINER", 'f' },
02087       { (float**)&TP_SFWT_MINER, "TP_SFWT_MINER", 'f' },
02088       { (float**)&AIR_TEMP, "AIR_TEMP", 'f' },
02089       { (unsigned char**)&HAB, "HAB", 'c' },
02090       { (float**)&SOLRAD274, "SOLRAD274", 'f' },
02091       { (float**)&SOLRADGRD, "SOLRADGRD", 'f' },
02092       { (float**)&H2O_TEMP, "H2O_TEMP", 'f' },
02093       { (float**)&HYD_DOM_ACTWAT_PRES, "HYD_DOM_ACTWAT_PRES", 'f' },
02094       { (float**)&HYD_DOM_ACTWAT_VOL, "HYD_DOM_ACTWAT_VOL", 'f' },
02095       { (float**)&HYD_ET, "HYD_ET", 'f' },
02096       { (float**)&HYD_EVAP_CALC, "HYD_EVAP_CALC", 'f' },
02097       { (float**)&HYD_MANNINGS_N, "HYD_MANNINGS_N", 'f' },
02098       { (float**)&HYD_SAT_POT_TRANS, "HYD_SAT_POT_TRANS", 'f' },
02099       { (float**)&HYD_SED_WAT_VOL, "HYD_SED_WAT_VOL", 'f' },
02100       { (float**)&HYD_TOT_POT_TRANSP, "HYD_TOT_POT_TRANSP", 'f' },
02101       { (float**)&HYD_TRANSP, "HYD_TRANSP", 'f' },
02102       { (float**)&HYD_UNSAT_POT_TRANS, "HYD_UNSAT_POT_TRANS", 'f' },
02103       { (float**)&HYD_WATER_AVAIL, "HYD_WATER_AVAIL", 'f' },
02104       { (float**)&HydTotHd, "HydTotHd", 'f' },
02105       { (float**)&LAI_eff, "LAI_eff", 'f' },
02106       { (float**)&MAC_WATER_AVAIL_CF, "MAC_WATER_AVAIL_CF", 'f' },
02107       { (float**)&SAT_TO_UNSAT_FL, "SAT_TO_UNSAT_FL", 'f' },
02108       { (float**)&SAT_VS_UNSAT, "SAT_VS_UNSAT", 'f' },
02109       { (float**)&SAT_WATER, "SAT_WATER", 'f' },
02110       { (float**)&SAT_WT_HEAD, "SAT_WT_HEAD", 'f' },
02111       { (float**)&SAT_WT_RECHG, "SAT_WT_RECHG", 'f' },
02112       { (float**)&SAT_WT_TRANSP, "SAT_WT_TRANSP", 'f' },
02113       { (float**)&SF_WT_EVAP, "SF_WT_EVAP", 'f' },
02114       { (float**)&SF_WT_FROM_RAIN, "SF_WT_FROM_RAIN", 'f' },
02115       { (float**)&SF_WT_INFILTRATION, "SF_WT_INFILTRATION", 'f' },
02116       { (float**)&SF_WT_POT_INF, "SF_WT_POT_INF", 'f' },
02117       { (float**)&SF_WT_TO_SAT_DOWNFLOW, "SF_WT_TO_SAT_DOWNFLOW", 'f' },
02118       { (float**)&SFWT_VOL, "SFWT_VOL", 'f' },
02119       { (float**)&SURFACE_WAT, "SURFACE_WAT", 'f' },
02120       { (float**)&UNSAT_AVAIL, "UNSAT_AVAIL", 'f' },
02121       { (float**)&UNSAT_CAP, "UNSAT_CAP", 'f' },
02122       { (float**)&UNSAT_DEPTH, "UNSAT_DEPTH", 'f' },
02123       { (float**)&UNSAT_HYD_COND_CF, "UNSAT_HYD_COND_CF", 'f' },
02124       { (float**)&UNSAT_MOIST_PRP, "UNSAT_MOIST_PRP", 'f' },
02125       { (float**)&UNSAT_PERC, "UNSAT_PERC", 'f' },
02126       { (float**)&UNSAT_TO_SAT_FL, "UNSAT_TO_SAT_FL", 'f' },
02127       { (float**)&UNSAT_TRANSP, "UNSAT_TRANSP", 'f' },
02128       { (float**)&UNSAT_WATER, "UNSAT_WATER", 'f' },
02129       { (float**)&UNSAT_WT_POT, "UNSAT_WT_POT", 'f' },
02130       { (float**)&ELEVATION, "ELEVATION", 'f' },
02131       { (float**)&HYD_RCCONDUCT, "HYD_RCCONDUCT", 'f' },
02132       { (unsigned char**)&ON_MAP, "ON_MAP", 'c' },
02133       { (float**)&SED_INACT_Z, "SED_INACT_Z", 'f' },
02134       { (float**)&MAC_HEIGHT, "MAC_HEIGHT", 'f' },
02135       { (float**)&MAC_LAI, "MAC_LAI", 'f' },
02136       { (float**)&MAC_LIGHT_CF, "MAC_LIGHT_CF", 'f' },
02137       { (float**)&MAC_MAX_BIO, "MAC_MAX_BIO", 'f' },
02138       { (float**)&MAC_NOPH_BIOMAS, "MAC_NOPH_BIOMAS", 'f' },
02139       { (float**)&mac_nph_PC_rep, "mac_nph_PC_rep", 'f' },
02140       { (float**)&MAC_NUT_CF, "MAC_NUT_CF", 'f' },
02141       { (float**)&MAC_PH_BIOMAS, "MAC_PH_BIOMAS", 'f' },
02142       { (float**)&mac_ph_PC_rep, "mac_ph_PC_rep", 'f' },
02143       { (float**)&MAC_PROD_CF, "MAC_PROD_CF", 'f' },
02144       { (float**)&MAC_REL_BIOM, "MAC_REL_BIOM", 'f' },
02145       { (float**)&MAC_SALT_CF, "MAC_SALT_CF", 'f' },
02146       { (float**)&MAC_TEMP_CF, "MAC_TEMP_CF", 'f' },
02147       { (float**)&MAC_TOT_BIOM, "MAC_TOT_BIOM", 'f' },
02148       { (float**)&MAC_WATER_CF, "MAC_WATER_CF", 'f' },
02149       { (float**)&NPHBIO_AVAIL, "NPHBIO_AVAIL", 'f' },
02150       { (float**)&NPHBIO_MORT, "NPHBIO_MORT", 'f' },
02151       { (float**)&NPHBIO_MORT_POT, "NPHBIO_MORT_POT", 'f' },
02152       { (float**)&NPHBIO_REFUGE, "NPHBIO_REFUGE", 'f' },
02153       { (float**)&NPHBIO_SAT, "NPHBIO_SAT", 'f' },
02154       { (float**)&NPHBIO_TRANSLOC, "NPHBIO_TRANSLOC", 'f' },
02155       { (float**)&NPHBIO_TRANSLOC_POT, "NPHBIO_TRANSLOC_POT", 'f' },
02156       { (float**)&PHBIO_AVAIL, "PHBIO_AVAIL", 'f' },
02157       { (float**)&PHBIO_MORT, "PHBIO_MORT", 'f' },
02158       { (float**)&PHBIO_MORT_POT, "PHBIO_MORT_POT", 'f' },
02159       { (float**)&PHBIO_NPP, "PHBIO_NPP", 'f' },
02160       { (float**)&PHBIO_REFUGE, "PHBIO_REFUGE", 'f' },
02161       { (float**)&PHBIO_SAT, "PHBIO_SAT", 'f' },
02162       { (float**)&PHBIO_TRANSLOC, "PHBIO_TRANSLOC", 'f' },
02163       { (float**)&PHBIO_TRANSLOC_POT, "PHBIO_TRANSLOC_POT", 'f' },
02164       { (float**)&TP_SEDWT_UPTAKE, "TP_SEDWT_UPTAKE", 'f' },
02165       { (float**)&ALG_INCID_LIGHT, "ALG_INCID_LIGHT", 'f' },
02166       { (float**)&ALG_LIGHT_CF, "ALG_LIGHT_CF", 'f' },
02167       { (float**)&ALG_LIGHT_EXTINCT, "ALG_LIGHT_EXTINCT", 'f' },
02168       { (float**)&ALG_REFUGE, "ALG_REFUGE", 'f' },
02169       { (float**)&ALG_SAT, "ALG_SAT", 'f' },
02170       { (float**)&ALG_TEMP_CF, "ALG_TEMP_CF", 'f' },
02171       { (float**)&ALG_TOT, "ALG_TOT", 'f' },
02172       { (float**)&ALG_WAT_CF, "ALG_WAT_CF", 'f' },
02173       { (float**)&C_ALG, "C_ALG", 'f' },
02174       { (float**)&C_ALG_AVAIL_MORT, "C_ALG_AVAIL_MORT", 'f' },
02175       { (float**)&C_ALG_GPP, "C_ALG_GPP", 'f' },
02176       { (float**)&C_ALG_MORT, "C_ALG_MORT", 'f' },
02177       { (float**)&C_ALG_MORT_POT, "C_ALG_MORT_POT", 'f' },
02178       { (float**)&C_ALG_NPP, "C_ALG_NPP", 'f' },
02179       { (float**)&C_ALG_NUT_CF, "C_ALG_NUT_CF", 'f' },
02180       { (float**)&C_ALG_PROD_CF, "C_ALG_PROD_CF", 'f' },
02181       { (float**)&C_ALG_RESP, "C_ALG_RESP", 'f' },
02182       { (float**)&C_ALG_RESP_POT, "C_ALG_RESP_POT", 'f' },
02183       { (float**)&NC_ALG, "NC_ALG", 'f' },
02184       { (float**)&NC_ALG_AVAIL_MORT, "NC_ALG_AVAIL_MORT", 'f' },
02185       { (float**)&NC_ALG_GPP, "NC_ALG_GPP", 'f' },
02186       { (float**)&NC_ALG_MORT, "NC_ALG_MORT", 'f' },
02187       { (float**)&NC_ALG_MORT_POT, "NC_ALG_MORT_POT", 'f' },
02188       { (float**)&NC_ALG_NPP, "NC_ALG_NPP", 'f' },
02189       { (float**)&NC_ALG_NUT_CF, "NC_ALG_NUT_CF", 'f' },
02190       { (float**)&NC_ALG_PROD_CF, "NC_ALG_PROD_CF", 'f' },
02191       { (float**)&NC_ALG_RESP, "NC_ALG_RESP", 'f' },
02192       { (float**)&NC_ALG_RESP_POT, "NC_ALG_RESP_POT", 'f' },
02193       { (float**)&TP_SFWT_UPTAK, "TP_SFWT_UPTAK", 'f' },
02194       { (float**)&TP_Act_to_TotRep, "TP_Act_to_TotRep", 'f' },
02195       { (float**)&TP_DNFLOW, "TP_DNFLOW", 'f' },
02196       { (float**)&TP_DNFLOW_POT, "TP_DNFLOW_POT", 'f' },
02197       { (float**)&TP_FR_RAIN, "TP_FR_RAIN", 'f' },
02198       { (float**)&TP_K, "TP_K", 'f' },
02199       { (double**)&TP_SED_CONC, "TP_SED_CONC", 'l' },
02200       { (double**)&TP_SED_WT, "TP_SED_WT", 'l' },
02201       { (double**)&TP_SED_WT_AZ, "TP_SED_WT_AZ", 'l' },
02202       { (double**)&TP_SEDWT_CONCACT, "TP_SEDWT_CONCACT", 'l' },
02203       { (float**)&TP_SEDWT_CONCACTMG, "TP_SEDWT_CONCACTMG", 'f' },
02204       { (float**)&TP_settl, "TP_settl", 'f' },
02205       { (double**)&TP_SF_WT, "TP_SF_WT", 'l' },
02206       { (double**)&TP_SFWT_CONC, "TP_SFWT_CONC", 'l' },
02207       { (float**)&TP_SFWT_CONC_MG, "TP_SFWT_CONC_MG", 'f' },
02208       { (double**)&TP_SORB, "TP_SORB", 'l' },
02209       { (float**)&TP_SORB_POT, "TP_SORB_POT", 'f' },
02210       { (double**)&TP_SORBCONC, "TP_SORBCONC", 'l' },
02211       { (float**)&TP_SORBCONC_rep, "TP_SORBCONC_rep", 'f' },
02212       { (float**)&TP_SORBTION, "TP_SORBTION", 'f' },
02213       { (float**)&TP_UPFLOW, "TP_UPFLOW", 'f' },
02214       { (float**)&TP_UPFLOW_POT, "TP_UPFLOW_POT", 'f' },
02215       { (double**)&SAL_SED_WT, "SAL_SED_WT", 'l' },
02216       { (float**)&SAL_SF_WT, "SAL_SF_WT", 'f' },
02217       { (float**)&SALT_SED_TO_SF_FLOW, "SALT_SED_TO_SF_FLOW", 'f' },
02218       { (double**)&SALT_SED_WT, "SALT_SED_WT", 'l' },
02219       { (float**)&SALT_SFWAT_DOWNFL, "SALT_SFWAT_DOWNFL", 'f' },
02220       { (float**)&SALT_SFWAT_DOWNFL_POT, "SALT_SFWAT_DOWNFL_POT", 'f' },
02221       { (double**)&SALT_SURF_WT, "SALT_SURF_WT", 'l' },
02222       { (double**)&DEPOS_ORG_MAT, "DEPOS_ORG_MAT", 'l' },
02223       { (float**)&DOM_DECOMP, "DOM_DECOMP", 'f' },
02224       { (float**)&DOM_DECOMP_POT, "DOM_DECOMP_POT", 'f' },
02225       { (float**)&DOM_FR_FLOC, "DOM_FR_FLOC", 'f' },
02226       { (double**)&DOM_P_OM, "DOM_P_OM", 'l' },
02227       { (float**)&DOM_QUALITY_CF, "DOM_QUALITY_CF", 'f' },
02228       { (float**)&DOM_SED_AEROB_Z, "DOM_SED_AEROB_Z", 'f' },
02229       { (float**)&DOM_SED_ANAEROB_Z, "DOM_SED_ANAEROB_Z", 'f' },
02230       { (float**)&DOM_TEMP_CF, "DOM_TEMP_CF", 'f' },
02231       { (float**)&DOM_Z, "DOM_Z", 'f' },
02232       { (double**)&DOP, "DOP", 'l' },
02233       { (float**)&DOP_DECOMP, "DOP_DECOMP", 'f' },
02234       { (float**)&P_SUM_CELL, "P_SUM_CELL", 'f' },
02235       { (float**)&SED_ELEV, "SED_ELEV", 'f' },
02236       { (float**)&TPtoSOIL_rep, "TPtoSOIL_rep", 'f' },
02237       { (float**)&Floc_fr_phBioAvg, "Floc_fr_phBioAvg", 'f' },
02238       { (float**)&TPSfMinAvg, "TPSfMinAvg", 'f' },
02239       { (float**)&ETAvg, "ETAvg", 'f' },
02240       { (float**)&EvapAvg, "EvapAvg", 'f' },
02241       { (float**)&HydPerAnn, "HydPerAnn", 'f' },
02242       { (float**)&LAI_effAvg, "LAI_effAvg", 'f' },
02243       { (float**)&Manning_nAvg, "Manning_nAvg", 'f' },
02244       { (float**)&RainAvg, "RainAvg", 'f' },
02245       { (float**)&SfWatAvg, "SfWatAvg", 'f' },
02246       { (float**)&TotHeadAvg, "TotHeadAvg", 'f' },
02247       { (float**)&TranspAvg, "TranspAvg", 'f' },
02248       { (float**)&UnsatMoistAvg, "UnsatMoistAvg", 'f' },
02249       { (float**)&UnsatZavg, "UnsatZavg", 'f' },
02250       { (float**)&mac_nph_PCAvg, "mac_nph_PCAvg", 'f' },
02251       { (float**)&Mac_nphBioAvg, "Mac_nphBioAvg", 'f' },
02252       { (float**)&Mac_nphMortAvg, "Mac_nphMortAvg", 'f' },
02253       { (float**)&Mac_nppAvg, "Mac_nppAvg", 'f' },
02254       { (float**)&mac_ph_PCAvg, "mac_ph_PCAvg", 'f' },
02255       { (float**)&Mac_phBioAvg, "Mac_phBioAvg", 'f' },
02256       { (float**)&Mac_phMortAvg, "Mac_phMortAvg", 'f' },
02257       { (float**)&Mac_totBioAvg, "Mac_totBioAvg", 'f' },
02258       { (float**)&MacNutCfAvg, "MacNutCfAvg", 'f' },
02259       { (float**)&MacWatCfAvg, "MacWatCfAvg", 'f' },
02260       { (float**)&TPSedUptAvg, "TPSedUptAvg", 'f' },
02261       { (float**)&C_Peri_mortAvg, "C_Peri_mortAvg", 'f' },
02262       { (float**)&C_Peri_nppAvg, "C_Peri_nppAvg", 'f' },
02263       { (float**)&C_Peri_PCAvg, "C_Peri_PCAvg", 'f' },
02264       { (float**)&C_PeriAvg, "C_PeriAvg", 'f' },
02265       { (float**)&C_PeriNutCFAvg, "C_PeriNutCFAvg", 'f' },
02266       { (float**)&C_PeriRespAvg, "C_PeriRespAvg", 'f' },
02267       { (float**)&NC_Peri_mortAvg, "NC_Peri_mortAvg", 'f' },
02268       { (float**)&NC_Peri_nppAvg, "NC_Peri_nppAvg", 'f' },
02269       { (float**)&NC_Peri_PCAvg, "NC_Peri_PCAvg", 'f' },
02270       { (float**)&NC_PeriAvg, "NC_PeriAvg", 'f' },
02271       { (float**)&NC_PeriNutCFAvg, "NC_PeriNutCFAvg", 'f' },
02272       { (float**)&NC_PeriRespAvg, "NC_PeriRespAvg", 'f' },
02273       { (float**)&PeriAvg, "PeriAvg", 'f' },
02274       { (float**)&PeriLiteCFAvg, "PeriLiteCFAvg", 'f' },
02275       { (float**)&TPSfUptAvg, "TPSfUptAvg", 'f' },
02276       { (float**)&TP_settlAvg, "TP_settlAvg", 'f' },
02277       { (float**)&TPSedWatAvg, "TPSedWatAvg", 'f' },
02278       { (float**)&TPSfWatAvg, "TPSfWatAvg", 'f' },
02279       { (float**)&SaltSedAvg, "SaltSedAvg", 'f' },
02280       { (float**)&SaltSfAvg, "SaltSfAvg", 'f' },
02281       { (float**)&SedElevAvg, "SedElevAvg", 'f' },
02282       { (float**)&TPSedMinAvg, "TPSedMinAvg", 'f' },
02283       { (float**)&TPSorbAvg, "TPSorbAvg", 'f' },
02284       { (float**)&TPtoSOILAvg, "TPtoSOILAvg", 'f' },
02285       { (float**)&TPtoVOLAvg, "TPtoVOLAvg", 'f' },
02286 
02287 
02288       { NULL, NULL, '\0' },
02289   };
02290 
02291     outVar_struct *ptable;
02292     int  i;
02293 
02294     for (i = 0, ptable = tgen; ptable->pfvar != NULL; ptable++, i++)
02295     {
02296   vp = view + i;
02297 
02298 /* TODO: develop flexible output of calendar-based and julian-based outsteps (jan 11, 2005) */
02299 if (vp->step > 0)
02300                 
02301             if (strcmp(ptable->pname,"HydPerAnn")!=0) { /* i.e., not the HydPerAnn variable */
02302                 
02303                 if  (step % vp->step == 0 && (vp->step != CalMonOut) ) {   /* standard julian-day outstep interval variables (note: the != CalMonOut needed for step=0) */ 
02304                     oIndex = iw[i]++;
02305                     write_output(oIndex, vp, *(ptable->pfvar), ptable->pname, ptable->ctype, step);
02306                 }
02307                 else if ( (avgPrint) && (vp->step == CalMonOut) ) { /* variables output at the special 1-calendar-month outstep interval */  
02308                     oIndex = iw[i]++;
02309                     write_output(oIndex, vp, *(ptable->pfvar), ptable->pname, ptable->ctype, step);
02310                 }
02311             }
02312         
02313             else
02314                 if (FMOD(DAYJUL, 273.0) ==0) { /* hydroperiod is printed at a special-case time (approximately Oct 1 every year) */
02315                     oIndex = iw[i]++;
02316                     write_output(oIndex, vp, *(ptable->pfvar), ptable->pname, ptable->ctype, step);
02317                 }
02318         
02319      
02320     }
02321 
02322         /* after printing, zero the arrays holding averages or hydroperiods (v2.2.1note using avgPrint var)*/
02323     if (avgPrint) {
02324         Cell_reset_avg();
02325     }
02326 
02327     if (FMOD(DAYJUL, 273.0) ==0) {
02328         Cell_reset_hydper();
02329     }
02330 
02331 
02332 } /* end of gen_output routine */

void get_map_dims  ) 
 

Get the map dimensions of the global model array.

This mererly calls the "read_map_dims" function

Definition at line 2504 of file UnitMod.c.

Referenced by setup().

02505 {
02506   read_map_dims("Elevation");
02507 }

int call_cell_dyn int  sector,
int  step
 

Calling function for the cell_dyn** dynamic ecological modules.

This function calls the cell_dyn dynamic modules as defined in the Driver.parm data file. Normal order for calling ELM modules(Sectors): 1 0 7 10 9 2 8 4 12 99.

S#0 hydro: cell-cell horiz (&canals if WaterManagement is on)
S#1 global forcings
S#2 algae/periphyton
S#4 DOM/DOP
S#7 hydro: vertical
S#8 macrophytes
S#9 phosphorus
S#10 salt
S#12 FLOC
S#13 TP net settling
S#99 mass balance, budget, avg, hydroperiod, etc calculations

Returns:
rv (=1)
Parameters:
sector The number of the cell_dyn** module being called
step The current iteration number

Definition at line 119 of file UnitMod.c.

00120  {
00121   int rv=0;
00122 
00123   switch(sector) {
00124 
00125     case 99: { stats(step); rv=1; } break;
00126     case 0: { horizFlow(step); rv=1; } break;
00127     case 1: { cell_dyn1(step); rv=1; } break;
00128     case 2: { cell_dyn2(step); rv=1; } break;
00129     case 4: { cell_dyn4(step); rv=1; } break;
00130     case 7: { cell_dyn7(step); rv=1; } break;
00131     case 8: { cell_dyn8(step); rv=1; } break;
00132     case 9: { cell_dyn9(step); rv=1; } break;
00133     case 10: { cell_dyn10(step); rv=1; } break;
00134     case 12: { cell_dyn12(step); rv=1; } break;
00135     case 13: { cell_dyn13(step); rv=1; } break;
00136             default:  printf("Warning, undefined sector number:%d\n",sector);
00137   }
00138   return rv;
00139 }


Variable Documentation

int NSector
 

number of Sectors (dynamic cell_dyn modules)

Definition at line 25 of file generic_driver.h.

Referenced by get_parmf(), and main().

int iSector[MAX_SECTOR]
 

sector (dynamic cell_dyn module) number

Definition at line 26 of file generic_driver.h.

Referenced by get_parmf(), and main().

int seed
 

the seed value for (pseudo-) random number generator (unused)

Definition at line 27 of file generic_driver.h.

Referenced by get_parmf(), and local_setup().

int ESPmodeON = 0
 

boolean flag indicating Everglades Settling-of Phosphorus mode. A mode with all biol/chem (non-hydro) modules turned off, running only a net settling rate module that reproduces equations and data from the SFWMD's old Everglades Water Quality Model (EWQM). Done only for comparision to full ecological ELM - ESP doesn't work very well!!

Definition at line 28 of file generic_driver.h.

Referenced by get_parmf().

int WatMgmtOn
 

boolean flag indicating water management mode

Definition at line 31 of file generic_driver.h.

Referenced by get_parmf().

int HabSwitchOn
 

boolean flag indicating habitat succession mode

Definition at line 32 of file generic_driver.h.

Referenced by cell_dyn1(), and get_parmf().

int PositAnalOn = 0
 

flag for Position Analysis mode: for probability analysis of near-term water management options, Position Analysis mode involves re-inititialization of model on particular month/day at recurring yearly interval

Definition at line 33 of file generic_driver.h.

Referenced by get_parmf().

char SimAlt[20]
 

simulation scenario/alterative name

Definition at line 35 of file generic_driver.h.

Referenced by BIRoutfiles(), Canal_Network_Init(), get_parmf(), open_point_lists(), Read_schedule(), ReadChanStruct(), and ReadStructures().

char SimModif[20]
 

simulation scenario/alterative modifier name/note

Definition at line 36 of file generic_driver.h.

Referenced by BIRoutfiles(), Canal_Network_Init(), get_parmf(), open_point_lists(), and ReadStructures().

char outpath[120]
 

base pathname for all output

Definition at line 37 of file generic_driver.h.

Referenced by get_parmf().

int gbl_size[2]
 

row [0] and column [1] dimensions of model grid domain, serial implementation

Definition at line 39 of file generic_driver.h.

Referenced by read_header(), read_map_dims(), readMap(), setup_grid(), write_header(), and writeMap().

char initDateRead[15]
 

calendar date of simulation initialization

Definition at line 41 of file generic_driver.h.

Referenced by formatDate(), and get_parmf().

double Jdate_init
 

julian day (since epochs ago) of the initialization of model

Definition at line 42 of file generic_driver.h.

Referenced by get_parmf(), send_point_lists2(), and track_time().

double Jdate_end
 

julian day (since epochs ago) of the ending of model

Definition at line 43 of file generic_driver.h.

Referenced by get_parmf().

int yr_in
 

Variables associated with the gregorian calendar

yr_in calendar year of initialization of model
mo_in calendar month of initialization of model
da_in calendar day of initialization of model
yr_end calendar year of ending of model
mo_end calendar month of ending of model
da_end calendar day of ending of model
hr_in hour of initialization of model (unused)
mi_in min of initialization of model (unused)
se_in seconds of initialization of model (unused)

Definition at line 55 of file generic_driver.h.

Referenced by get_parmf(), and main().

int mo_in
 

Variables associated with the gregorian calendar

yr_in calendar year of initialization of model
mo_in calendar month of initialization of model
da_in calendar day of initialization of model
yr_end calendar year of ending of model
mo_end calendar month of ending of model
da_end calendar day of ending of model
hr_in hour of initialization of model (unused)
mi_in min of initialization of model (unused)
se_in seconds of initialization of model (unused)

Definition at line 55 of file generic_driver.h.

Referenced by get_parmf(), and main().

int da_in
 

Variables associated with the gregorian calendar

yr_in calendar year of initialization of model
mo_in calendar month of initialization of model
da_in calendar day of initialization of model
yr_end calendar year of ending of model
mo_end calendar month of ending of model
da_end calendar day of ending of model
hr_in hour of initialization of model (unused)
mi_in min of initialization of model (unused)
se_in seconds of initialization of model (unused)

Definition at line 55 of file generic_driver.h.

Referenced by get_parmf(), and main().

int hr_in
 

Variables associated with the gregorian calendar

yr_in calendar year of initialization of model
mo_in calendar month of initialization of model
da_in calendar day of initialization of model
yr_end calendar year of ending of model
mo_end calendar month of ending of model
da_end calendar day of ending of model
hr_in hour of initialization of model (unused)
mi_in min of initialization of model (unused)
se_in seconds of initialization of model (unused)

Definition at line 55 of file generic_driver.h.

Referenced by get_parmf().

int mi_in
 

Variables associated with the gregorian calendar

yr_in calendar year of initialization of model
mo_in calendar month of initialization of model
da_in calendar day of initialization of model
yr_end calendar year of ending of model
mo_end calendar month of ending of model
da_end calendar day of ending of model
hr_in hour of initialization of model (unused)
mi_in min of initialization of model (unused)
se_in seconds of initialization of model (unused)

Definition at line 55 of file generic_driver.h.

Referenced by get_parmf().

int se_in
 

Variables associated with the gregorian calendar

yr_in calendar year of initialization of model
mo_in calendar month of initialization of model
da_in calendar day of initialization of model
yr_end calendar year of ending of model
mo_end calendar month of ending of model
da_end calendar day of ending of model
hr_in hour of initialization of model (unused)
mi_in min of initialization of model (unused)
se_in seconds of initialization of model (unused)

Definition at line 55 of file generic_driver.h.

Referenced by get_parmf().

int yr_end
 

Variables associated with the gregorian calendar

yr_in calendar year of initialization of model
mo_in calendar month of initialization of model
da_in calendar day of initialization of model
yr_end calendar year of ending of model
mo_end calendar month of ending of model
da_end calendar day of ending of model
hr_in hour of initialization of model (unused)
mi_in min of initialization of model (unused)
se_in seconds of initialization of model (unused)

Definition at line 55 of file generic_driver.h.

Referenced by get_parmf(), and main().

int mo_end
 

Variables associated with the gregorian calendar

yr_in calendar year of initialization of model
mo_in calendar month of initialization of model
da_in calendar day of initialization of model
yr_end calendar year of ending of model
mo_end calendar month of ending of model
da_end calendar day of ending of model
hr_in hour of initialization of model (unused)
mi_in min of initialization of model (unused)
se_in seconds of initialization of model (unused)

Definition at line 55 of file generic_driver.h.

Referenced by get_parmf(), and main().

int da_end
 

Variables associated with the gregorian calendar

yr_in calendar year of initialization of model
mo_in calendar month of initialization of model
da_in calendar day of initialization of model
yr_end calendar year of ending of model
mo_end calendar month of ending of model
da_end calendar day of ending of model
hr_in hour of initialization of model (unused)
mi_in min of initialization of model (unused)
se_in seconds of initialization of model (unused)

Definition at line 55 of file generic_driver.h.

Referenced by get_parmf(), and main().

int mo_R_in
 

month of Re-initialization in Position analysis mode

Definition at line 56 of file generic_driver.h.

Referenced by get_parmf(), and main().

int da_R_in
 

day of Re-initialization in Position analysis mode

Definition at line 57 of file generic_driver.h.

Referenced by get_parmf(), and main().

int PORnumday
 

number of days of simulation Period Of Record (incl. start day)

Definition at line 58 of file generic_driver.h.

Referenced by get_parmf(), processData(), ReadStructures(), and track_time().

int N_iter
 

count of maximum number of model time iterations

Definition at line 60 of file generic_driver.h.

Referenced by get_parmf(), print_point(), and track_time().

int istep
 

counter for number of model time iterations

Definition at line 61 of file generic_driver.h.

Referenced by main(), quick_look(), and track_time().

float step_Cell
 

constant used in horizontal surface water raster flux equations ( m^(-1.5) * sec )

Definition at line 62 of file generic_driver.h.

Referenced by get_parmf().

float avg_Intvl = 0
 

time (day) interval between recurring-average summaries

Definition at line 64 of file generic_driver.h.

Referenced by CellAvg(), get_parmf(), readViewParms(), and track_time().

float budg_Intvl = 0
 

time (day) interval between budget summaries

Definition at line 65 of file generic_driver.h.

Referenced by BIRbudg_print(), get_parmf(), and track_time().

float BIRavg_Intvl = 0
 

time (day) interval between Basin/Indicator-Region stat summaries

Definition at line 66 of file generic_driver.h.

Referenced by BIRstats_print(), and track_time().

float can_Intvl = 0
 

time (day) interval between canal (water management) summaries

Definition at line 67 of file generic_driver.h.

Referenced by get_parmf(), and track_time().

int budgCalendar
 

boolean flag signifying use of gregorian calendar for budget calcs

Definition at line 69 of file generic_driver.h.

Referenced by get_parmf().

int avgCalendar = 0
 

boolean flag signifying use of gregorian calendar for recurring-average calcs

Definition at line 70 of file generic_driver.h.

Referenced by get_parmf().

int canalCalendar = 0
 

boolean flag signifying use of gregorian calendar for canal data output

Definition at line 71 of file generic_driver.h.

Referenced by get_parmf().

int avgPrint = 0
 

boolean flag to indicate if recurring-averages is to be printed at current time

Definition at line 72 of file generic_driver.h.

Referenced by track_time().

int canPrint = 0
 

boolean flag to indicate if canal data is to be printed at current time

Definition at line 73 of file generic_driver.h.

Referenced by Run_Canal_Network(), and track_time().

ProgAttr* ProgExec
 

Definition at line 77 of file generic_driver.h.

Referenced by alloc_mem_runs(), BIRstats_date(), get_global_parm(), get_hab_parm(), get_parmf(), main(), and SensiParm_list().

ProgAttr** RunList
 

Definition at line 78 of file generic_driver.h.

Referenced by alloc_mem_runs(), get_parmf(), main(), and SensiParm_list().

float gRTable[]
 

Initial value:

        {.5000,.5398,.5793,.6179,.6554,.6915,.7257,.7580,.7881,.8159,
         .8413,.8643,.8849,.9032,.9192,.9332,.9452,.9554,.9641,.9713,
         .9773,.9821,.9861,.9893,.9918,.9938,.9953,.9965,.9974,.9981,
         .9987,.9990,.9993,.9995,.9997,.9998,.9998,.9999,.9999,1.00}
data used in function Normal, which is unused

Definition at line 80 of file generic_driver.h.

Referenced by Normal().

ViewParm* view
 

Definition at line 86 of file generic_driver.h.

Referenced by main(), and readViewParms().

SeriesParm pSeries[MAX_PTSERIES]
 

An array of SeriesParm structs for point time series output

Definition at line 87 of file generic_driver.h.

Referenced by get_parmf(), main(), open_point_lists(), print_point(), send_point_lists2(), and setup().

Point2D dbgPt
 

struct of type Point2D, the grid location of a point

Definition at line 88 of file generic_driver.h.

Referenced by get_parmf(), read_map_file(), and write_map_file().

struct nodenv env
 

struct of nodenv, with parallel code info

Definition at line 90 of file generic_driver.h.

Referenced by setup_platform().

int procnum
 

Data for parallel implementation, basically ignore

Lprocnum NA for serial implementation (=1)
procnum NA for serial implementation (also see nodenv struct)
nprocs NA for serial implementation (also see nodenv struct)
recpnum NA for serial implementation
tramType NA for serial implementation
tramNum NA for serial implementation
lcl_size used in serial code, but not really pertinent: in serial implementation, rows lcl_size[0]=s0 and columns lcl_size[1]=s1, dimensions of model grid domain local to one processor (for parallel implementation)
lcl_start used in serial code, but not really pertinent: in serial implementation, starting row lcl_start[0]=0 and starting column lcl_start[1]=0 in model grid domain local to one processor (for parallel implementation)

Definition at line 102 of file generic_driver.h.

Referenced by get_parmf(), local_setup(), main(), read_map_file(), setup_grid(), and setup_platform().

int Lprocnum
 

Data for parallel implementation, basically ignore

Lprocnum NA for serial implementation (=1)
procnum NA for serial implementation (also see nodenv struct)
nprocs NA for serial implementation (also see nodenv struct)
recpnum NA for serial implementation
tramType NA for serial implementation
tramNum NA for serial implementation
lcl_size used in serial code, but not really pertinent: in serial implementation, rows lcl_size[0]=s0 and columns lcl_size[1]=s1, dimensions of model grid domain local to one processor (for parallel implementation)
lcl_start used in serial code, but not really pertinent: in serial implementation, starting row lcl_start[0]=0 and starting column lcl_start[1]=0 in model grid domain local to one processor (for parallel implementation)

Definition at line 102 of file generic_driver.h.

Referenced by local_setup(), PTSL_ReadLists(), and read_map_dims().

int nprocs[2]
 

Data for parallel implementation, basically ignore

Lprocnum NA for serial implementation (=1)
procnum NA for serial implementation (also see nodenv struct)
nprocs NA for serial implementation (also see nodenv struct)
recpnum NA for serial implementation
tramType NA for serial implementation
tramNum NA for serial implementation
lcl_size used in serial code, but not really pertinent: in serial implementation, rows lcl_size[0]=s0 and columns lcl_size[1]=s1, dimensions of model grid domain local to one processor (for parallel implementation)
lcl_start used in serial code, but not really pertinent: in serial implementation, starting row lcl_start[0]=0 and starting column lcl_start[1]=0 in model grid domain local to one processor (for parallel implementation)

Definition at line 102 of file generic_driver.h.

Referenced by exgridsize(), local_setup(), and setup_platform().

int recpnum[2]
 

Data for parallel implementation, basically ignore

Lprocnum NA for serial implementation (=1)
procnum NA for serial implementation (also see nodenv struct)
nprocs NA for serial implementation (also see nodenv struct)
recpnum NA for serial implementation
tramType NA for serial implementation
tramNum NA for serial implementation
lcl_size used in serial code, but not really pertinent: in serial implementation, rows lcl_size[0]=s0 and columns lcl_size[1]=s1, dimensions of model grid domain local to one processor (for parallel implementation)
lcl_start used in serial code, but not really pertinent: in serial implementation, starting row lcl_start[0]=0 and starting column lcl_start[1]=0 in model grid domain local to one processor (for parallel implementation)

Definition at line 102 of file generic_driver.h.

Referenced by exgridsize(), local_setup(), quick_look(), and setup_platform().

int tramType
 

Data for parallel implementation, basically ignore

Lprocnum NA for serial implementation (=1)
procnum NA for serial implementation (also see nodenv struct)
nprocs NA for serial implementation (also see nodenv struct)
recpnum NA for serial implementation
tramType NA for serial implementation
tramNum NA for serial implementation
lcl_size used in serial code, but not really pertinent: in serial implementation, rows lcl_size[0]=s0 and columns lcl_size[1]=s1, dimensions of model grid domain local to one processor (for parallel implementation)
lcl_start used in serial code, but not really pertinent: in serial implementation, starting row lcl_start[0]=0 and starting column lcl_start[1]=0 in model grid domain local to one processor (for parallel implementation)

Definition at line 102 of file generic_driver.h.

Referenced by local_setup().

int tramNum[2]
 

Data for parallel implementation, basically ignore

Lprocnum NA for serial implementation (=1)
procnum NA for serial implementation (also see nodenv struct)
nprocs NA for serial implementation (also see nodenv struct)
recpnum NA for serial implementation
tramType NA for serial implementation
tramNum NA for serial implementation
lcl_size used in serial code, but not really pertinent: in serial implementation, rows lcl_size[0]=s0 and columns lcl_size[1]=s1, dimensions of model grid domain local to one processor (for parallel implementation)
lcl_start used in serial code, but not really pertinent: in serial implementation, starting row lcl_start[0]=0 and starting column lcl_start[1]=0 in model grid domain local to one processor (for parallel implementation)

Definition at line 102 of file generic_driver.h.

Referenced by exgridcoord().

int lcl_size[2]
 

Data for parallel implementation, basically ignore

Lprocnum NA for serial implementation (=1)
procnum NA for serial implementation (also see nodenv struct)
nprocs NA for serial implementation (also see nodenv struct)
recpnum NA for serial implementation
tramType NA for serial implementation
tramNum NA for serial implementation
lcl_size used in serial code, but not really pertinent: in serial implementation, rows lcl_size[0]=s0 and columns lcl_size[1]=s1, dimensions of model grid domain local to one processor (for parallel implementation)
lcl_start used in serial code, but not really pertinent: in serial implementation, starting row lcl_start[0]=0 and starting column lcl_start[1]=0 in model grid domain local to one processor (for parallel implementation)

Definition at line 102 of file generic_driver.h.

Referenced by read_map_file(), and setup_grid().

int lcl_start[2]
 

Data for parallel implementation, basically ignore

Lprocnum NA for serial implementation (=1)
procnum NA for serial implementation (also see nodenv struct)
nprocs NA for serial implementation (also see nodenv struct)
recpnum NA for serial implementation
tramType NA for serial implementation
tramNum NA for serial implementation
lcl_size used in serial code, but not really pertinent: in serial implementation, rows lcl_size[0]=s0 and columns lcl_size[1]=s1, dimensions of model grid domain local to one processor (for parallel implementation)
lcl_start used in serial code, but not really pertinent: in serial implementation, starting row lcl_start[0]=0 and starting column lcl_start[1]=0 in model grid domain local to one processor (for parallel implementation)

Definition at line 102 of file generic_driver.h.

Referenced by print_loc_ave(), print_point(), PTSL_GetInterpolatedValue0(), quick_look(), and setup_grid().

char* ModelPath
 

Environment variables used in model

ModelPath environment variable, base pathname for executable and input data
ProjName environment variable, the name of the model project
DriverPath environment variable, base pathname for source code
OS_TYPE environment variable, the type of operating system being used (informational purpose only, not used in code)

Definition at line 36 of file driver_utilities.h.

char * ProjName
 

Environment variables used in model

ModelPath environment variable, base pathname for executable and input data
ProjName environment variable, the name of the model project
DriverPath environment variable, base pathname for source code
OS_TYPE environment variable, the type of operating system being used (informational purpose only, not used in code)

Definition at line 36 of file driver_utilities.h.

char * OS_TYPE
 

Environment variables used in model

ModelPath environment variable, base pathname for executable and input data
ProjName environment variable, the name of the model project
DriverPath environment variable, base pathname for source code
OS_TYPE environment variable, the type of operating system being used (informational purpose only, not used in code)

Definition at line 36 of file driver_utilities.h.

Referenced by main(), and set_env_vars().

char* OutputPath
 

base pathname for all model output (user input)

Definition at line 38 of file driver_utilities.h.

Referenced by BIRoutfiles(), Canal_Network_Init(), cell_dyn1(), Channel_configure(), get_parmf(), main(), open_debug_outFile(), open_point_lists(), send_point_lists2(), write_map_file(), and writeSeries().

char modelName[20]
 

Model name/version (user input)

modelName Name given to model implementation (user input)
modelVers Version given to model implementation (e.g., v.2.1) (user input)

Definition at line 44 of file driver_utilities.h.

Referenced by BIRinit(), BIRoutfiles(), Canal_Network_Init(), get_parmf(), open_point_lists(), Read_schedule(), ReadChanStruct(), and ReadStructures().

char modelVers[10]
 

Model name/version (user input)

modelName Name given to model implementation (user input)
modelVers Version given to model implementation (e.g., v.2.1) (user input)

Definition at line 44 of file driver_utilities.h.

Referenced by BIRoutfiles(), Canal_Network_Init(), get_parmf(), and open_point_lists().


Generated on Thu Jul 6 11:19:07 2006 for ELM source code by  doxygen 1.3.9.1