Everglades Landscape Model (ELM) Home Page |
#include "globals.h"
Include dependency graph for unitmod.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
int | call_cell_dyn (int sector, int step) |
Calling function for the cell_dyn** dynamic ecological modules. | |
void | cell_dyn1 (int step) |
Global dynamics and forcings. | |
void | cell_dyn2 (int step) |
Algae/periphyton (vertical) dynamics. | |
void | cell_dyn4 (int step) |
Organic Soil (vertical) dynamics. | |
void | horizFlow (int step) |
Horizontal raster fluxes. | |
void | cell_dyn7 (int step) |
Hydrologic (vertical) dynamics. | |
void | cell_dyn8 (int step) |
Macrophyte (vertical) dynamics. | |
void | cell_dyn9 (int step) |
Phosphorus (vertical) dynamics. | |
void | cell_dyn10 (int step) |
Salt/tracer (vertical) dynamics. | |
void | cell_dyn12 (int step) |
FLOCculent organic matter (vertical) dynamics. | |
void | cell_dyn13 (int step) |
Net settling of TP loss (stand-alone). | |
float | tempCF (int form, float c1, float topt, float tmin, float tmax, float tempC) |
Temperature control function for biology. | |
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 irun) |
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 | gen_output (int step, ViewParm *view) |
Generate output. | |
void | ReadGlobalParms (char *s_parm_name, int s_parm_relval) |
Acquire the model parameters that are global to the domain. | |
void | ReadHabParms (char *s_parm_name, int s_parm_relval) |
Acquire the model parameters that are specific to different habitat types in the domain. | |
void | get_map_dims (void) |
Get the map dimensions of the global model array. | |
void | alloc_memory () |
Allocate memory. | |
float | graph7 (unsigned char y, float x) |
Time series interplator, data set 7. | |
float | graph8 (unsigned char y, float x) |
Time series interplator, data set 8. | |
void | HabSwitch_Init (void) |
Transfers habitat-specific parameters into data struct, allocate memory. | |
unsigned char | HabSwitch (int ix, int iy, float *Water, float *Nutrient, int *Fire, unsigned char *HAB) |
Switches habitats (the option that is currently used). | |
void | Run_Canal_Network (float *SWH, float *ElevMap, float *MC, float *GWV, float *poros, float *GWcond, double *NA, double *PA, double *SA, double *GNA, double *GPA, double *GSA, float *Unsat, float *sp_yield) |
Runs the water management network. | |
void | Canal_Network_Init (float baseDatum, float *elev) |
Initialize the water managment network topology. | |
void | CanalReInit () |
Re-initialize the depths and concentrations in canals under the Positional Analysis mode. | |
void | getInt (FILE *inFile, const char *lString, int *iValPtr) |
Get an integer following a specific string. | |
void | read_map_dims (const char *filename) |
Establish the number of rows and columns of the model. | |
void | write_output (int index, ViewParm *vp, void *Map, const char *filename, char Mtype, int step) |
Determine which functions to call for model output. | |
void | getChar (FILE *inFile, const char *lString, char *cValPtr) |
Get a character following a specific string. | |
void | init_pvar (VOIDP Map, UCHAR *mask, unsigned char Mtype, float iv) |
Initialize a variable to a value. | |
int | read_map_file (const char *filename, VOIDP Map, unsigned char Mtype, float scale_value, float offset_value) |
Get the file and read/convert the data of map (array). | |
int | scan_forward (FILE *infile, const char *tstring) |
Scan forward until a particular string is found. | |
VOIDP | nalloc (unsigned mem_size, const char var_name[]) |
Allocate memory for a variable. | |
float | FMOD (float x, float y) |
Modulus of a pair of (double) arguments. | |
void | stats (int step) |
Calling function for budget and summary stats. | |
void | alloc_mem_stats (void) |
Allocate memory for the BIR-based and cell-based stats variables. | |
void | BIRinit (void) |
Set up the Basin & Indicator Region (BIR) linkages/inheritances. | |
void | BIRoutfiles (void) |
Open files and create headers for BIR output. | |
void | BIRstats_reset (void) |
Reset BIR (non-budget) statistics summations to zero. | |
void | BIRbudg_reset (void) |
Reset BIR budget summations to zero. | |
void | Cell_reset_avg (void) |
Zero the arrays holding selected variable averages in cells (after printing)/. | |
void | Cell_reset_hydper (void) |
Zero the array holding hydroperiod data in cells (after printing). | |
void | Flux_SWater (int it, float *SURFACE_WAT, float *SED_ELEV, float *HYD_MANNINGS_N, double *STUF1, double *STUF2, double *STUF3) |
Surface water horizontal flux. | |
void | Flux_GWater (int it, float *SatWat, float *Unsat, float *SfWat, float *rate, float *poros, float *sp_yield, float *elev, double *gwSTUF1, double *gwSTUF2, double *gwSTUF3, double *swSTUF1, double *swSTUF2, double *swSTUF3) |
Groundwater fluxing routine. | |
float * | get_hab_parm (char *s_parm_name, int s_parm_relval, char *parmName) |
Read the input data file to get a habitat-specfic parameter array. | |
float | get_global_parm (char *s_parm_name, int s_parm_relval, char *parmName) |
Read the input data file to get a global parameter. | |
int | stage_data_wmm (float *) |
int | rain_data_wmm (float *) |
int | evap_data_wmm (float *) |
Variables | |
float | DAYJUL |
float | LATRAD |
float | SOLALPHA |
float | SOLALTCORR |
float | SOLBETA |
float | SOLCOSDEC |
float | SOLDEC |
float | SOLDEC1 |
float | SOLELEV_SINE |
float | SOLRADATMOS |
float | SOLRISSET_HA |
float | SOLRISSET_HA1 |
float | dispParm_scaled |
float | g7 [11][2] |
float | g8 [11][2] |
int | CalMonOut |
basnDef ** | basn_list |
basnDef * | basins |
int | WatMgmtOn |
int | ESPmodeON |
int | HabSwitchOn |
int | avgPrint |
char * | OutputPath |
char * | ProjName |
This defines or declares variables & functions that are global to Unit_Mod.c.
Note: documented with Doxygen, which expects specific syntax within special comments.
The Everglades Landscape Model (ELM).
last updated: May 2006
Definition in file unitmod.h.
|
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)
Definition at line 119 of file UnitMod.c. References cell_dyn1(), cell_dyn10(), cell_dyn12(), cell_dyn13(), cell_dyn2(), cell_dyn4(), cell_dyn7(), cell_dyn8(), cell_dyn9(), horizFlow(), and stats(). Referenced by main(). 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 }
|
Here is the call graph for this function:
|
Global dynamics and forcings. Includes interpolation-generators, grid-io spatial data input, and habitat switching. This module is reduced in scope from v2.1 & previous, now basically only used to read coarse-grid grid-io input data, and call the habitat succession function.
Definition at line 162 of file UnitMod.c. References Arctan, boundcond_depth, boundcond_ETp, boundcond_rain, Cos, DAYJUL, debug, DT, evap_data_wmm(), Exp, FIREdummy, FMOD(), GP_ALTIT, HAB, HabSwitch(), HabSwitchOn, LATRAD, msgStr, ON_MAP, OutputPath, PI, ProjName, rain_data_wmm(), s0, s1, SimTime, Sin, SOLALTCORR, SOLCOSDEC, SOLDEC, SOLDEC1, SOLELEV_SINE, SOLRADATMOS, SOLRISSET_HA, SOLRISSET_HA1, stage_data_wmm(), SURFACE_WAT, T, Tan, simTime::TIME, TPtoSOIL, and WriteMsg(). Referenced by call_cell_dyn(). 00163 { 00164 int fail = -1; 00165 int ix, iy, cellLoc, stat=1; 00166 00167 /* v2.5 may be temporary? */ 00168 FILE *boundaryFile; 00169 char filename[40]; 00170 00171 /* SimTime.TIME is a (float) julian day counter since initialization (calc'd in main function, Generic_Driver.c source). 00172 (SimTime.TIME includes fractions of days if the vertical DT<1.0, but it is 00173 unlikely that the vertical DT will deviate from 1 day). */ 00174 /* daily re-mapping of coarse-grid input data */ 00175 if (FMOD(SimTime.TIME,1.0) < 0.001) { 00176 00177 /* remap sfwmm (or other grid) rain data to ELM grid scale */ 00178 stat=rain_data_wmm(boundcond_rain); 00179 if(stat==fail) 00180 { 00181 sprintf(msgStr,"Problem with rainfall data, time = %f.\n",SimTime.TIME); 00182 WriteMsg(msgStr,1); 00183 exit(fail); 00184 } 00185 00186 /* remap sfwmm (or other grid) stage/water depth data to ELM grid scale */ 00187 stat=stage_data_wmm(boundcond_depth); 00188 if(stat==-1) 00189 { 00190 sprintf(msgStr,"Problem with stage data, time = %f.\n",SimTime.TIME); 00191 WriteMsg(msgStr,1); 00192 exit(fail); 00193 } 00194 00195 /* ***** */ 00196 /* v2.5 should below become permanent? Output the sfwmm boundary stage data */ 00197 if ( debug > 4 ) 00198 { 00199 sprintf( filename, "%s/%s/Output/Debug/wmm_depth_%d.txt", OutputPath, ProjName, (int)SimTime.TIME ); 00200 00201 00202 if ( ( boundaryFile = fopen( filename, "w" ) ) == NULL ) 00203 { 00204 printf( "Can't open the %s boundary condition depth debug file!\n", filename ); 00205 exit(-1) ; 00206 } 00207 /* fprintf ( boundaryFile, "ROWS=%d\nCOLUMNS=%d\nNotes\"Debug data: SFWMM output, ponded depths (pos/neg). \n", s0, s1 ); */ 00208 00209 for ( ix = 1; ix <= s0 ; ix++ ) 00210 { for ( iy = 1 ; iy <= s1 ; iy++ ) 00211 fprintf( boundaryFile, "%f\t", boundcond_depth[T(ix,iy)]) ; 00212 fprintf ( boundaryFile, "\n" ); 00213 } 00214 fclose( boundaryFile ) ; 00215 if (SimTime.TIME>60) { 00216 printf("\nDebug level is very high - you're probably getting too much output data in %s/%s/Output/Debug/! Decrease your simulation length.\n", OutputPath, ProjName); 00217 exit(-1); 00218 } 00219 } 00220 /* v2.5 should above become permanent? Output the sfwmm boundary stage data */ 00221 /* ***** */ 00222 00223 00224 /* remap sfwmm (or other grid) potential ET data to ELM grid scale */ 00225 stat=evap_data_wmm(boundcond_ETp); 00226 if(stat==-1) 00227 { 00228 sprintf(msgStr,"Problem with ETp data, time = %f.\n",SimTime.TIME); 00229 WriteMsg(msgStr,1); 00230 exit(fail); 00231 } 00232 00233 } /* end of mapping multi-grid data */ 00234 00235 00236 00237 /* the "julian" day counter within a 365 day "year" */ 00238 DAYJUL = ( FMOD(SimTime.TIME,365.0) >0.0 ) ? ( FMOD(SimTime.TIME,365.0) ) : ( 365.0); 00239 /* DAYLENGTH is not used */ 00240 /* DAYLENGTH = AMPL*Sin((DAYJUL-79.0)*0.01721)+12.0; */ /* length of daylight (hours) */ 00241 00242 00243 /* Nikolov & Zeller (1992) solar radiation algorithm 00244 the algorithm and all parameters are published in the (Ecol. Mod., 61:149-168) manuscript, 00245 and the only modifiable parameters (in ELM database system) are local latitude and altitude */ 00246 SOLDEC1 = 0.39785*Sin(4.868961+0.017203*DAYJUL 00247 +0.033446*Sin(6.224111+0.017202*DAYJUL)); 00248 SOLCOSDEC = sqrt(1.0-SOLDEC1*SOLDEC1); 00249 SOLELEV_SINE = Sin(LATRAD)*SOLDEC1+Cos(LATRAD)*SOLCOSDEC; 00250 SOLALTCORR = (1.0-Exp(-0.014*(GP_ALTIT-274.0)/(SOLELEV_SINE*274.0))); 00251 SOLDEC = Arctan(SOLDEC1/sqrt(1.0-SOLDEC1*SOLDEC1)); 00252 SOLRISSET_HA1 = -Tan(LATRAD)*Tan(SOLDEC); 00253 SOLRISSET_HA = ( (SOLRISSET_HA1==0.0) ) ? ( PI*0.5 ) : ( ( (SOLRISSET_HA1<0.0) ) ? 00254 ( PI+Arctan(sqrt(1.0-SOLRISSET_HA1*SOLRISSET_HA1)/SOLRISSET_HA1) ) : 00255 ( Arctan(sqrt(1.0-SOLRISSET_HA1*SOLRISSET_HA1)/SOLRISSET_HA1))); 00256 SOLRADATMOS = 458.37*2.0*(1.0+0.033*Cos(360.0/365.0*PI/180.0*DAYJUL)) 00257 * ( Cos(LATRAD)*Cos(SOLDEC)*Sin(SOLRISSET_HA) 00258 + SOLRISSET_HA*180.0/(57.296*PI)*Sin(LATRAD)*Sin(SOLDEC)); 00259 00260 00261 /* daily habitat switching */ 00262 if ( (SimTime.TIME - (int)SimTime.TIME) < DT/2 && HabSwitchOn ) /* HabSwitchOn flag to invoke switching */ 00263 for(ix=1; ix<=s0; ix++) 00264 for(iy=1; iy<=s1; iy++) 00265 if(ON_MAP[cellLoc= T(ix,iy)]) { /* TPtoSoil == kg/kg */ 00266 HAB [cellLoc] = HabSwitch (ix, iy, SURFACE_WAT, TPtoSOIL, (int*)FIREdummy, HAB); 00267 } 00268 }
|
Here is the call graph for this function:
|
Algae/periphyton (vertical) dynamics. Temporal dynamics of carbon and phosphorus of two communities of periphyton.
Definition at line 290 of file UnitMod.c. References SimTime, and WriteMsg(). Referenced by call_cell_dyn(). 00291 { 00292 int ix, iy, cellLoc; 00293 float reduc, min_litTemp,I_ISat, Z_extinct; 00294 double PO4Pconc, PO4P; 00295 float C_ALG_thresh_CF, mortPot; 00296 00297 for(ix=1; ix<=s0; ix++) { 00298 for(iy=1; iy<=s1; iy++) { 00299 00300 if(ON_MAP[cellLoc= T(ix,iy)]) { 00301 00302 /* these thresholds need updating when a habitat type of a grid cell changes */ 00303 ALG_REFUGE[cellLoc] = HP_ALG_MAX[HAB[cellLoc]]*GP_ALG_REF_MULT; 00304 ALG_SAT[cellLoc] = HP_ALG_MAX[HAB[cellLoc]]*0.9; 00305 00306 NC_ALG_AVAIL_MORT[cellLoc] = Max(NC_ALG[cellLoc]-ALG_REFUGE[cellLoc],0); 00307 C_ALG_AVAIL_MORT[cellLoc] = Max(C_ALG[cellLoc]-ALG_REFUGE[cellLoc],0); 00308 /* bio-avail P (PO4) is calc'd from TP, using pre-processed regression for predicting PO4 from TP */ 00309 /* assume that periphyton (microbial) alkaline phosphotase activity keeps PO4 at least 10% of TP conc */ 00310 PO4Pconc = Max(TP_SFWT_CONC_MG[cellLoc]*GP_PO4toTP + GP_PO4toTPint, 00311 0.10 * TP_SFWT_CONC_MG[cellLoc]); /* mg/L */ 00312 00313 /* light, water, temperature controls apply to both calc and non-calc */ 00314 ALG_LIGHT_EXTINCT[cellLoc] = GP_alg_light_ext_coef; 00315 /* algal self-shading implicit in density-dependent constraint function later */ 00316 ALG_INCID_LIGHT[cellLoc] = SOLRADGRD[cellLoc]*Exp(-MAC_LAI[cellLoc]*GP_ALG_SHADE_FACTOR); 00317 Z_extinct = SURFACE_WAT[cellLoc]*ALG_LIGHT_EXTINCT[cellLoc]; 00318 I_ISat = ALG_INCID_LIGHT[cellLoc]/GP_ALG_LIGHT_SAT; 00319 /* averaged over whole water column (based on Steele '65) */ 00320 ALG_LIGHT_CF[cellLoc] = ( Z_extinct > 0.0 ) ? 00321 ( 2.718/Z_extinct * (Exp(-I_ISat * Exp(-Z_extinct)) - Exp(-I_ISat)) ) : 00322 (I_ISat*Exp(1.0-I_ISat)); 00323 /* low-water growth constraint ready for something better based on data */ 00324 ALG_WAT_CF[cellLoc] = ( SURFACE_WAT[cellLoc]>0.0 ) ? ( 1.0 ) : ( 0.0); 00325 ALG_TEMP_CF[cellLoc] = tempCF(0, 0.20, GP_ALG_TEMP_OPT, 5.0, 40.0, H2O_TEMP[cellLoc]); 00326 00327 min_litTemp = Min(ALG_LIGHT_CF[cellLoc],ALG_TEMP_CF[cellLoc]); 00328 00329 /* the 2 communities have same form of growth response to avail phosphorus */ 00330 NC_ALG_NUT_CF[cellLoc] = 00331 Exp(-GP_alg_uptake_coef * Max(GP_NC_ALG_KS_P-PO4Pconc, 0.0)/GP_NC_ALG_KS_P) ; /* mg/L */ 00332 C_ALG_NUT_CF[cellLoc] = 00333 Exp(-GP_alg_uptake_coef * Max(GP_C_ALG_KS_P-PO4Pconc, 0.0)/GP_C_ALG_KS_P) ; /* mg/L */ 00334 00335 /* the form of the control function assumes that at very low 00336 P conc, the alkaline phosphotase activity of the microbial assemblage scavenges P, maintaining a minimum nutrient availability to community */ 00337 NC_ALG_PROD_CF[cellLoc] = Min(min_litTemp,ALG_WAT_CF[cellLoc])*Max(NC_ALG_NUT_CF[cellLoc], GP_alg_alkP_min); 00338 C_ALG_PROD_CF[cellLoc] = Min(min_litTemp,ALG_WAT_CF[cellLoc])*Max(C_ALG_NUT_CF[cellLoc], GP_alg_alkP_min); 00339 00340 NC_ALG_RESP_POT[cellLoc] = 00341 ( UNSAT_DEPTH[cellLoc]>GP_algMortDepth ) ? 00342 ( 0.0) : 00343 ( GP_ALG_RC_RESP*ALG_TEMP_CF[cellLoc]*NC_ALG_AVAIL_MORT[cellLoc] ); 00344 C_ALG_RESP_POT[cellLoc] = 00345 ( UNSAT_DEPTH[cellLoc]>GP_algMortDepth ) ? 00346 ( 0.0) : 00347 ( GP_ALG_RC_RESP*ALG_TEMP_CF[cellLoc] *C_ALG_AVAIL_MORT[cellLoc] ); 00348 00349 NC_ALG_RESP[cellLoc] = 00350 ( NC_ALG_RESP_POT[cellLoc]*DT>NC_ALG_AVAIL_MORT[cellLoc] ) ? 00351 ( NC_ALG_AVAIL_MORT[cellLoc]/DT ) : 00352 ( NC_ALG_RESP_POT[cellLoc]); 00353 C_ALG_RESP[cellLoc] = 00354 ( C_ALG_RESP_POT[cellLoc]*DT>C_ALG_AVAIL_MORT[cellLoc] ) ? 00355 ( C_ALG_AVAIL_MORT[cellLoc]/DT ) : 00356 ( C_ALG_RESP_POT[cellLoc]); 00357 00358 /* this is the threshold control function that increases 00359 calcareous/native periph mortality (likely due to loss of calcareous sheath) as P conc. increases */ 00360 C_ALG_thresh_CF = Min(exp(GP_alg_R_accel*Max( TP_SFWT_CONC_MG[cellLoc]-GP_C_ALG_threshTP,0.0)/GP_C_ALG_threshTP), 100.0); 00361 00362 NC_ALG_MORT_POT[cellLoc] = 00363 ( UNSAT_DEPTH[cellLoc]>GP_algMortDepth ) ? 00364 ( NC_ALG_AVAIL_MORT[cellLoc]*GP_ALG_RC_MORT_DRY ) : 00365 ( NC_ALG_AVAIL_MORT[cellLoc]*GP_ALG_RC_MORT); 00366 C_ALG_MORT_POT[cellLoc] = 00367 ( UNSAT_DEPTH[cellLoc]>GP_algMortDepth ) ? 00368 ( C_ALG_AVAIL_MORT[cellLoc]*GP_ALG_RC_MORT_DRY ) : 00369 ( C_ALG_thresh_CF * C_ALG_AVAIL_MORT[cellLoc]*GP_ALG_RC_MORT); 00370 00371 NC_ALG_MORT[cellLoc] = 00372 ( (NC_ALG_MORT_POT[cellLoc]+NC_ALG_RESP[cellLoc])*DT>NC_ALG_AVAIL_MORT[cellLoc] ) ? 00373 ( (NC_ALG_AVAIL_MORT[cellLoc]-NC_ALG_RESP[cellLoc]*DT)/DT ) : 00374 ( NC_ALG_MORT_POT[cellLoc]); 00375 C_ALG_MORT[cellLoc] = 00376 ( (C_ALG_MORT_POT[cellLoc]+C_ALG_RESP[cellLoc])*DT>C_ALG_AVAIL_MORT[cellLoc] ) ? 00377 ( (C_ALG_AVAIL_MORT[cellLoc]-C_ALG_RESP[cellLoc]*DT)/DT ) : 00378 ( C_ALG_MORT_POT[cellLoc]); 00379 00380 /* gross production of the 2 communities (gC/m2/d, NOT kgC/m2/d) */ 00381 /* density constraint on both noncalc and calc, competition effect accentuated by calc algae */ 00382 00383 NC_ALG_GPP[cellLoc] = NC_ALG_PROD_CF[cellLoc]*GP_ALG_RC_PROD*NC_ALG[cellLoc] 00384 *Max( (1.0-(GP_AlgComp*C_ALG[cellLoc]+NC_ALG[cellLoc])/HP_ALG_MAX[HAB[cellLoc]]),0.0); 00385 C_ALG_GPP[cellLoc] = C_ALG_PROD_CF[cellLoc]*GP_ALG_RC_PROD*C_ALG[cellLoc] 00386 *Max( (1.0-( C_ALG[cellLoc]+NC_ALG[cellLoc])/HP_ALG_MAX[HAB[cellLoc]]),0.0); 00387 00388 00389 /* P uptake is dependent on available P and is relative to a maximum P:C ratio for the tissue 00390 (g C/m^2/d * P:Cmax * dimless * dimless = gP/m2/d (NOT kg) )*/ 00391 NC_ALG_GPP_P[cellLoc] = NC_ALG_GPP[cellLoc] *GP_ALG_PC * NC_ALG_NUT_CF[cellLoc] 00392 * Max(1.0-NC_ALG_PC[cellLoc]/GP_ALG_PC, 0.0); 00393 C_ALG_GPP_P[cellLoc] = C_ALG_GPP[cellLoc] * GP_ALG_PC * C_ALG_NUT_CF[cellLoc] 00394 * Max(1.0-C_ALG_PC[cellLoc]/GP_ALG_PC, 0.0); 00395 00396 /* check for available P mass (the nutCF does not) */ 00397 PO4P = ramp(Min(PO4Pconc * SFWT_VOL[cellLoc], conv_kgTOg*TP_SF_WT[cellLoc]) ); /*g P available; v2.5 put in ramp (constrain non-neg) */ 00398 reduc = ( (NC_ALG_GPP_P[cellLoc]+C_ALG_GPP_P[cellLoc]) > 0) ? 00399 (PO4P / ( (NC_ALG_GPP_P[cellLoc]+C_ALG_GPP_P[cellLoc])*CELL_SIZE*DT) ) : 00400 (1.0); 00401 /* can have high conc, but low mass of P avail, in presence of high peri biomass and high demand */ 00402 /* reduce the production proportionally if excess demand is found */ 00403 if (reduc < 1.0) { 00404 NC_ALG_GPP[cellLoc] *= reduc; 00405 NC_ALG_GPP_P[cellLoc] *= reduc; 00406 C_ALG_GPP[cellLoc] *= reduc; 00407 C_ALG_GPP_P[cellLoc] *= reduc; 00408 } 00409 00410 /* state variables calc'd (gC/m2, NOT kgC/m2) */ 00411 NC_ALG[cellLoc] = NC_ALG[cellLoc] 00412 + (NC_ALG_GPP[cellLoc] 00413 - NC_ALG_RESP[cellLoc] - NC_ALG_MORT[cellLoc]) * DT; 00414 00415 C_ALG[cellLoc] = C_ALG[cellLoc] 00416 + (C_ALG_GPP[cellLoc] 00417 - C_ALG_RESP[cellLoc] - C_ALG_MORT[cellLoc]) * DT; 00418 00419 /* carbon NPP not currently used elsewhere, only for output */ 00420 NC_ALG_NPP[cellLoc] = NC_ALG_GPP[cellLoc]-NC_ALG_RESP[cellLoc]; 00421 C_ALG_NPP[cellLoc] = C_ALG_GPP[cellLoc]-C_ALG_RESP[cellLoc]; 00422 /* carbon total biomass of both communities, not currently used elsewhere, only for output */ 00423 ALG_TOT[cellLoc] = NC_ALG[cellLoc] + C_ALG[cellLoc]; 00424 00425 00426 /* now calc the P associated with the C fluxes (GPP_P already calc'd) */ 00427 mortPot = (double) NC_ALG_MORT[cellLoc] * NC_ALG_PC[cellLoc]; 00428 NC_ALG_MORT_P[cellLoc] = (mortPot*DT>NC_ALG_P[cellLoc]) ? 00429 (NC_ALG_P[cellLoc]/DT) : 00430 (mortPot); 00431 mortPot = (double) C_ALG_MORT[cellLoc] * C_ALG_PC[cellLoc]; 00432 C_ALG_MORT_P[cellLoc] = (mortPot*DT>C_ALG_P[cellLoc]) ? 00433 (C_ALG_P[cellLoc]/DT) : 00434 (mortPot); 00435 00436 00437 /* state variables calc'd (gP/m2, NOT kgP/m2) */ 00438 NC_ALG_P[cellLoc] = NC_ALG_P[cellLoc] 00439 + (NC_ALG_GPP_P[cellLoc] - NC_ALG_MORT_P[cellLoc]) * DT; 00440 00441 C_ALG_P[cellLoc] = C_ALG_P[cellLoc] 00442 + (C_ALG_GPP_P[cellLoc] - C_ALG_MORT_P[cellLoc]) * DT; 00443 00444 NC_ALG_PC[cellLoc] = (NC_ALG[cellLoc]>0.0) ? 00445 (NC_ALG_P[cellLoc]/ NC_ALG[cellLoc]) : 00446 ( GP_ALG_PC * 0.03); /* default to 3% of max P:C */ 00447 C_ALG_PC[cellLoc] = (C_ALG[cellLoc]>0.0) ? 00448 (C_ALG_P[cellLoc]/ C_ALG[cellLoc]) : 00449 ( GP_ALG_PC * 0.03 ); /* default to 3% of max P:C */ 00450 NC_ALG_PCrep[cellLoc] = (float)NC_ALG_PC[cellLoc] * conv_kgTOmg; /* variable for output _rep-orting only */ 00451 C_ALG_PCrep[cellLoc] = (float)C_ALG_PC[cellLoc] * conv_kgTOmg; /* variable for output _rep-orting only */ 00452 00453 if (debug > 0 && NC_ALG[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg NC_ALG C biomass (%f m) in cell (%d,%d)!", 00454 SimTime.TIME, NC_ALG[cellLoc], ix,iy ); WriteMsg( msgStr,True ); dynERRORnum++;} 00455 if (debug > 0 && C_ALG[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg C_ALG C biomass (%f m) in cell (%d,%d)!", 00456 SimTime.TIME, C_ALG[cellLoc], ix,iy ); WriteMsg( msgStr,True ); dynERRORnum++;} 00457 if (debug > 0 && NC_ALG_P[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg NC_ALG_P P biomass (%f m) in cell (%d,%d)!", 00458 SimTime.TIME, NC_ALG_P[cellLoc], ix,iy ); WriteMsg( msgStr,True ); dynERRORnum++;} 00459 if (debug > 0 && C_ALG_P[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg C_ALG_P P biomass (%f m) in cell (%d,%d)!", 00460 SimTime.TIME, C_ALG_P[cellLoc], ix,iy ); WriteMsg( msgStr,True ); dynERRORnum++;} 00461 00462 00463 TP_SFWT_UPTAK[cellLoc] = (NC_ALG_GPP_P[cellLoc]+C_ALG_GPP_P[cellLoc]) 00464 *0.001*CELL_SIZE; /* gP/m2 => kg P */ 00465 /* recalc P in surface water state variable (kg P) */ 00466 TP_SF_WT[cellLoc] = TP_SF_WT[cellLoc] - TP_SFWT_UPTAK[cellLoc] * DT; 00467 TP_SFWT_CONC[cellLoc] = 00468 ( SFWT_VOL[cellLoc] > 0.0 ) ? 00469 ( TP_SF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : 00470 ( 0.0); /* used in P fluxes for mass balance */ 00471 TP_SFWT_CONC_MG[cellLoc] = 00472 ( SURFACE_WAT[cellLoc] > GP_DetentZ ) ? 00473 (TP_SFWT_CONC[cellLoc]*conv_kgTOg) : 00474 (0.0); /* (g/m3==mg/L) used for reporting and other modules to evaluate P conc when water is present */ 00475 00476 } 00477 } 00478 } 00479 }
|
Here is the call graph for this function:
|
Organic Soil (vertical) dynamics. Temporal dynamics of Deposited Organic Matter and Deposited Organic Phosphorus.
Definition at line 499 of file UnitMod.c. Referenced by call_cell_dyn(). 00500 { 00501 int ix, iy, cellLoc; 00502 float TPsoil, TP_sedMin, TP_sfMin; 00503 00504 00505 00506 for(ix=1; ix<=s0; ix++) { 00507 for(iy=1; iy<=s1; iy++) { 00508 00509 if(ON_MAP[cellLoc= T(ix,iy)]) { 00510 00511 00512 /* inputs of organic matter (kg OM/m2)*/ 00513 DOM_fr_nphBio[cellLoc] = nphbio_mort_OM[cellLoc]; 00514 DOM_FR_FLOC[cellLoc] = FLOC_DEPO[cellLoc] ; 00515 00516 /* losses of organic matter (kg OM/m2) */ 00517 00518 DOM_QUALITY_CF[cellLoc] = 00519 Min(Exp(-GP_DOM_decomp_coef * Max(GP_DOM_DECOMP_POPT-TP_SEDWT_CONCACTMG[cellLoc], 0.0) 00520 /GP_DOM_DECOMP_POPT),1.0) ; /* mg/L */ 00521 DOM_TEMP_CF[cellLoc] = tempCF(0, 0.20, GP_DOM_DECOMP_TOPT, 5.0, 40.0, H2O_TEMP[cellLoc]); 00522 DOM_SED_AEROB_Z[cellLoc] = Min(Max(UNSAT_DEPTH[cellLoc],HP_DOM_AEROBTHIN[HAB[cellLoc]]),HP_DOM_MAXDEPTH[HAB[cellLoc]]); 00523 DOM_SED_ANAEROB_Z[cellLoc] = HP_DOM_MAXDEPTH[HAB[cellLoc]]-DOM_SED_AEROB_Z[cellLoc]; 00524 00525 /* GP_calibDecomp is an adjustable calib parm */ 00526 DOM_DECOMP_POT[cellLoc] = (double) GP_calibDecomp*GP_DOM_RCDECOMP*DOM_QUALITY_CF[cellLoc]*DOM_TEMP_CF[cellLoc]*DEPOS_ORG_MAT[cellLoc] 00527 *(Min(DOM_SED_AEROB_Z[cellLoc]/HP_DOM_MAXDEPTH[HAB[cellLoc]],1.0)*soil_MOIST_CF[cellLoc] 00528 +GP_DOM_DECOMPRED*Min(DOM_SED_ANAEROB_Z[cellLoc]/HP_DOM_MAXDEPTH[HAB[cellLoc]],1.0) ); 00529 DOM_DECOMP[cellLoc] = 00530 ( (DOM_DECOMP_POT[cellLoc])*DT>DEPOS_ORG_MAT[cellLoc] ) ? 00531 ( (DEPOS_ORG_MAT[cellLoc])/DT ) : 00532 ( DOM_DECOMP_POT[cellLoc]); 00533 /* calc state var (kg OM/m2) */ 00534 DEPOS_ORG_MAT[cellLoc] = DEPOS_ORG_MAT[cellLoc] + 00535 ( DOM_fr_nphBio[cellLoc] + DOM_FR_FLOC[cellLoc] 00536 - DOM_DECOMP[cellLoc] ) * DT; 00537 00538 /* soil elevation */ 00539 DOM_Z[cellLoc] = (double) DEPOS_ORG_MAT[cellLoc] / DOM_BD[cellLoc] ; /* (m) organic depth */ 00540 SED_ELEV[cellLoc] = DOM_Z[cellLoc]+Inorg_Z[cellLoc]+SED_INACT_Z[cellLoc]; /* total land surface elevation, including model GP_DATUM_DISTANCE below NGVD 1929 (m) */ 00541 00542 /* P DOM stoich (kg P /m2) */ 00543 DOP_nphBio[cellLoc] = nphbio_mort_P[cellLoc]; 00544 DOP_FLOC[cellLoc] = FlocP_DEPO[cellLoc]; 00545 00546 DOP_DECOMP[cellLoc] = (double) DOM_DECOMP[cellLoc] * DOM_P_OM[cellLoc]; 00547 00548 /* calc state var of total "organic" P in soil (NOT including dissolved in pore water or sorbed) (kgP/m2) */ 00549 DOP[cellLoc] = DOP[cellLoc] 00550 + ( DOP_nphBio[cellLoc] + DOP_FLOC[cellLoc] 00551 - DOP_DECOMP[cellLoc]) * DT; /* kgP/m2 */ 00552 00553 /* now the P ratio */ 00554 DOM_P_OM[cellLoc] = (DEPOS_ORG_MAT[cellLoc]>0.0) ? ( DOP[cellLoc] / DEPOS_ORG_MAT[cellLoc]) : (0.0); /* kgP/kgOM */ 00555 TPsoil = DOP[cellLoc]*CELL_SIZE + TP_SORB[cellLoc]; /* kg TP in soil */ 00556 TPtoSOIL[cellLoc] = ((DEPOS_ORG_MAT[cellLoc]*CELL_SIZE + DIM[cellLoc])>0.0) ? 00557 ( TPsoil / (DEPOS_ORG_MAT[cellLoc]*CELL_SIZE + DIM[cellLoc]) ) : (0.0); /* kgP/kgsoil */ 00558 TPtoVOL[cellLoc] = (CELL_SIZE * DOM_Z[cellLoc]>0.0) ? 00559 (TPsoil / (CELL_SIZE * DOM_Z[cellLoc]) ) : 00560 (0.0); /* kgP/m3 soil */ 00561 00562 TPtoSOIL_rep[cellLoc] = TPtoSOIL[cellLoc] * conv_kgTOmg; /* reporting purposes only (kg/kg->mg/kg) */ 00563 TPtoVOL_rep[cellLoc] = TPtoVOL[cellLoc] * conv_kgTOg; /* reporting purposes only (kg/m3->g/m3 == ug/cm3) */ 00564 00565 /* now the P gain in sed water with decomp 00566 a small proportion goes into surface water P (below) */ 00567 TP_sedMin = (1.0 - HP_DOM_AEROBTHIN[HAB[cellLoc]] / HP_DOM_MAXDEPTH[HAB[cellLoc]] ) 00568 * DOP_DECOMP[cellLoc] * CELL_SIZE; 00569 00570 /* calc P in sed water state variables (kg P) */ 00571 TP_SED_WT[cellLoc] = TP_SED_WT[cellLoc] + TP_sedMin * DT; 00572 /* this is the active zone, where uptake, sorption, and mineralization take place */ 00573 TP_SED_WT_AZ[cellLoc] = TP_SED_WT_AZ[cellLoc] + TP_sedMin * DT; 00574 00575 TP_SED_CONC[cellLoc] = (HYD_SED_WAT_VOL[cellLoc]>0.0) ? 00576 (TP_SED_WT[cellLoc] / HYD_SED_WAT_VOL[cellLoc]) : 00577 (0.0); 00578 TP_SEDWT_CONCACT[cellLoc] = ( HYD_DOM_ACTWAT_PRES[cellLoc] > 0.0) ? 00579 ( TP_SED_WT_AZ[cellLoc]/HYD_DOM_ACTWAT_VOL[cellLoc] ) : 00580 (TP_SED_CONC[cellLoc]); /* g/L */ 00581 TP_SEDWT_CONCACTMG[cellLoc] = TP_SEDWT_CONCACT[cellLoc]*conv_kgTOg; /* g/m3==mg/L */ 00582 00583 /* now store the ratio of the conc in the active zone relative to total, prior to horiz fluxes 00584 ***** very simple constant, code in transition **** */ 00585 TP_Act_to_Tot[cellLoc] = 1.0 / HP_TP_CONC_GRAD[HAB[cellLoc]]; 00586 TP_Act_to_TotRep[cellLoc] = (float) TP_Act_to_Tot[cellLoc]; 00587 00588 /* now the P gain in surface water with decomp in the very thin upper layer of the soil */ 00589 /* if there is no surface water present, assume that this 00590 relative contribution will be an additional sorbed component that 00591 is introduced to surface water column immediately upon hydration 00592 with surface water */ 00593 TP_sfMin = HP_DOM_AEROBTHIN[HAB[cellLoc]] / HP_DOM_MAXDEPTH[HAB[cellLoc]] 00594 * DOP_DECOMP[cellLoc] * CELL_SIZE; 00595 00596 /* calc P in surface water state variable (kg P) */ 00597 TP_SF_WT[cellLoc] = TP_SF_WT[cellLoc] + TP_sfMin * DT; 00598 TP_SFWT_CONC[cellLoc] = 00599 ( SFWT_VOL[cellLoc] > 0.0 ) ? 00600 ( TP_SF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : 00601 ( 0.0); /* used in P fluxes for mass balance */ 00602 TP_SFWT_CONC_MG[cellLoc] = 00603 ( SURFACE_WAT[cellLoc] > GP_DetentZ ) ? 00604 (TP_SFWT_CONC[cellLoc]*conv_kgTOg) : 00605 (0.0); /* (g/m3==mg/L) used for reporting and other modules to evaluate P conc when water is present */ 00606 00607 /* for reporting only: calc sum of all P storages in grid cells (budget calcs do same for Basin/Indicator-Regions) (g P /m^2) */ 00608 P_SUM_CELL[cellLoc] = ( (C_ALG_P[cellLoc] + NC_ALG_P[cellLoc]) * 0.001 * CELL_SIZE + /* gP/m2 => kgP */ 00609 (mac_nph_P[cellLoc] + mac_ph_P[cellLoc] )* CELL_SIZE + /* kgP/m2 => kgP */ 00610 TP_SORB[cellLoc] + 00611 ( FlocP[cellLoc] + DOP[cellLoc] ) * CELL_SIZE + /* kgP/m2 => kgP */ 00612 TP_SED_WT[cellLoc] + TP_SF_WT[cellLoc] ) /* kgP */ 00613 /CELL_SIZE * conv_kgTOg; /* kg P/m^2 => g P/m^2 */ 00614 00615 } 00616 } 00617 } 00618 }
|
|
Horizontal raster fluxes. Flows of water and dissolved/suspended constituents (phosphorus, salt/tracer) among cells and in water management network.
Definition at line 628 of file UnitMod.c. Referenced by call_cell_dyn(). 00629 { 00630 int it; 00631 float celWid_to_ref; 00632 00633 celWid_to_ref = 1.0 - GP_dispLenRef/celWid; /* relative diff between the current model cell width and a reference grid cell that has numerical dispersion == actual dispersion */ 00634 dispParm_scaled = celWid_to_ref * GP_dispParm; 00635 00636 for ( it = 0; it < hyd_iter; it++ ) 00637 { 00638 sprintf(msgStr,"\b\b\b%3d",it); 00639 usrErr0(msgStr); 00640 00641 /* horizontal raster-vector canal fluxes and water management functions 00642 Water Management switch set at runtime in Driver.parm 00643 this routine also integrates surface, unsaturated, and saturated exchanges 00644 */ 00645 /* Nitrogen (DINdummy) argument is dummy argument placeholder */ 00646 if (WatMgmtOn ) { 00647 Run_Canal_Network(SURFACE_WAT,SED_ELEV,HYD_MANNINGS_N,SAT_WATER,HP_HYD_POROSITY, 00648 HYD_RCCONDUCT, DINdummy,TP_SF_WT,SALT_SURF_WT,DINdummy,TP_SED_WT,SALT_SED_WT, 00649 UNSAT_WATER,HP_HYD_SPEC_YIELD ); 00650 } 00651 00652 00653 00654 /* Function for horiz fluxing of surface water, no exchange with sat/unsat water */ 00655 /* if the order of the solute is changed, be sure to change the mass bal info in FluxSWstuff fcn */ 00656 /* Nitrogen (DINdummy) argument is dummy argument placeholder */ 00657 Flux_SWater(it,SURFACE_WAT,SED_ELEV,HYD_MANNINGS_N,SALT_SURF_WT,DINdummy,TP_SF_WT); 00658 00659 /* Function for horiz fluxing of ground water and its vertical itegration with unsat and surface water 00660 It is only called every other hyd_iter iteration, and passes the realized number of gwat iterations to the function. 00661 If the order of the solutes is changed, be sure to change the mass bal info in FluxGWstuff fcn 00662 */ 00663 /* Nitrogen (DINdummy) argument is dummy argument placeholder */ 00664 if ( it%2 ) 00665 Flux_GWater((it-1)/2, SAT_WATER, UNSAT_WATER, SURFACE_WAT, HYD_RCCONDUCT, HP_HYD_POROSITY, 00666 HP_HYD_SPEC_YIELD, SED_ELEV, SALT_SED_WT, DINdummy, TP_SED_WT, SALT_SURF_WT, DINdummy, TP_SF_WT); 00667 00668 } /* end of hyd_iter */ 00669 00670 }
|
|
Hydrologic (vertical) dynamics. Temporal dynamics of water storages (not including horizontal flows).
Definition at line 694 of file UnitMod.c. References SimTime, and WriteMsg(). Referenced by call_cell_dyn(). 00695 { 00696 int ix, iy, cellLoc; 00697 float SatWat_Root_CF, field_cap; 00698 float mann_height, N_density, f_LAI_eff, sfwat_pr1; 00699 float cloudy=0.0; 00700 00701 /* the horizontal raster and vector fluxes are always called before this cell_dyn */ 00702 for(ix=1; ix<=s0; ix++) { 00703 for(iy=1; iy<=s1; iy++) { 00704 if(ON_MAP[cellLoc= T(ix,iy)]) { 00705 00706 if (debug > 3) { /* these are old, relatively coarse checks - surface-ground water integration occurs in Fluxes.c */ 00707 if (SAT_WT_HEAD[cellLoc] - 0.01 > SED_ELEV[cellLoc] ) { 00708 sprintf(msgStr,"Day %6.1f. Warning - SAT_WT_HEAD exceeds elev in cell (%d,%d) by %f.", 00709 SimTime.TIME, ix,iy,(SAT_WT_HEAD[cellLoc] - SED_ELEV[cellLoc]) ); 00710 WriteMsg( msgStr,True ); } 00711 if (SURFACE_WAT[cellLoc] > 0.2 && UNSAT_DEPTH[cellLoc] > 0.1 ) { 00712 sprintf(msgStr,"Day: %6.1f. Warning - large sfwat depth (%5.2f m) in presence of unsat= %5.2f m, %4.2f %% moist, in cell (%d,%d).", 00713 SimTime.TIME, SURFACE_WAT[cellLoc], UNSAT_DEPTH[cellLoc],UNSAT_MOIST_PRP[cellLoc], ix,iy ); 00714 WriteMsg( msgStr,True ); } 00715 if (SAT_WATER[cellLoc] < -0.01) { /* this seems unnecessary but... */ 00716 sprintf(msgStr,"Day %6.1f: capacityERR - neg SAT_WATER (%f m) in cell (%d,%d) before cell_dyn7!", 00717 SimTime.TIME, SAT_WATER[cellLoc], ix,iy ); 00718 WriteMsg( msgStr,True ); dynERRORnum++; } 00719 if (SURFACE_WAT[cellLoc] < -0.01) { 00720 sprintf(msgStr,"Day %6.1f: capacityERR - neg SURFACE_WAT (%f m) in cell (%d,%d) before cell_dyn7!", 00721 SimTime.TIME, SURFACE_WAT[cellLoc], ix,iy ); 00722 WriteMsg( msgStr,True ); dynERRORnum++; } 00723 } 00724 00725 /* note that rainfall during a time step is added to surface water storage and available */ 00726 /* for runoff (horizFlow) before the calc of infiltration & ET associated with that new input */ 00727 /* (infiltration/ET etc will be of avail water the next time step after a rainfall event and horiz flows) */ 00728 /* NSM/SFWMM rainfall input data, created in cell_dyn1, convert here from tenths of mm to meters */ 00729 SF_WT_FROM_RAIN[cellLoc] = boundcond_rain[cellLoc]*0.0001; /* tenths of mm *0.0001 = m */ 00730 00731 /* solar radiation at altitude of 274m in atmosphere cal/cm2/d) */ 00732 /* v2.2+, CLOUDY (cloudiness) spatiotemporal data "temporarily" unavailable, is constant in space and time, local var "cloudy" */ 00733 SOLRAD274[cellLoc] = SOLRADATMOS*(SOLBETA-GP_SOLOMEGA* ( ( cloudy>0.0 ) ? ( cloudy ) : ( 0.0) ) ) -SOLALPHA; 00734 SOLRADGRD[cellLoc] = SOLRAD274[cellLoc]+((SOLRADATMOS+1.0)-SOLRAD274[cellLoc])*SOLALTCORR; 00735 H2O_TEMP[cellLoc] = AIR_TEMP[cellLoc]; /* v2.2+, temperature data "temporarily" unavailable, is constant in space and time */ 00736 00737 /******** determine new unsat potentials */ 00738 SAT_WT_HEAD[cellLoc] = SAT_WATER[cellLoc]/HP_HYD_POROSITY[HAB[cellLoc]]; 00739 UNSAT_DEPTH[cellLoc] = SED_ELEV[cellLoc]-SAT_WT_HEAD[cellLoc]; 00740 UNSAT_CAP[cellLoc] = UNSAT_DEPTH[cellLoc]*HP_HYD_POROSITY[HAB[cellLoc]]; 00741 00742 UNSAT_MOIST_PRP[cellLoc] = 00743 ( UNSAT_CAP[cellLoc]>0.0 ) ? 00744 ( Min(UNSAT_WATER[cellLoc]/UNSAT_CAP[cellLoc],1.0) ) : 00745 ( 1.0); 00746 /* determining the pathway of flow of surface water depending on depth 00747 of an unsat zone relative to the surface water */ 00748 SAT_VS_UNSAT[cellLoc] = 1/Exp(100.0*Max((SURFACE_WAT[cellLoc]-UNSAT_DEPTH[cellLoc]),0.0)); 00749 /* empirical data of a (0-1) control function, the proportion of maximum vertical water infiltration rate through soil (dependent var) as a function of soil moisture proportion (0-1) (independent var) */ 00750 UNSAT_HYD_COND_CF[cellLoc] = graph7(0x0,UNSAT_MOIST_PRP[cellLoc] ); 00751 /* field capacity = porosity - specific yield; spec yield== proportion of total soil vol 00752 that represents water that can be moved by gravity */ 00753 field_cap = (HP_HYD_POROSITY[HAB[cellLoc]]-HP_HYD_SPEC_YIELD[HAB[cellLoc]]); 00754 /* unsat_avail is proportion of water in pore space available for gravitational flow (above field capacity) */ 00755 /* e.g., when moisture prop in pore space <= field_cap/pore_space, no percolation */ 00756 /* using old moisture proportion (hasn't changed unless unsat zone was replaced by sat water) */ 00757 UNSAT_AVAIL[cellLoc] = Max(UNSAT_MOIST_PRP[cellLoc] 00758 -(field_cap)/HP_HYD_POROSITY[HAB[cellLoc]],0.0); 00759 UNSAT_WT_POT[cellLoc] = Max(UNSAT_CAP[cellLoc]-UNSAT_WATER[cellLoc],0.0); 00760 00761 /******** now determine the potential total transpiration and evaporation */ 00762 /* Potential ET is input data used in SFWMM v5.4 */ 00763 /* GP_calibET is an adjustable calibration parameter (close to 1.0, adjusted in global parameter input file) */ 00764 HYD_EVAP_CALC[cellLoc] = boundcond_ETp[cellLoc] * 0.0001*GP_calibET; /* tenths of mm *0.0001 = m */ 00765 00766 /* Leaf Area Index (LAI) of emergent macrophytes: this effective LAI estimates leaf area index that is above ponded surface water */ 00767 LAI_eff[cellLoc] = 00768 (MAC_HEIGHT[cellLoc]>0.0) ? 00769 (Max(1.0 - SURFACE_WAT[cellLoc]/MAC_HEIGHT[cellLoc], 0.0)*MAC_LAI[cellLoc]) : 00770 (0.0) ; 00771 00772 /* control function (0-1) of relative magnitude of the effective Leaf Area Index */ 00773 f_LAI_eff = exp(-LAI_eff[cellLoc]); 00774 00775 00776 HYD_TOT_POT_TRANSP[cellLoc] = HYD_EVAP_CALC[cellLoc] * (1.0-f_LAI_eff); 00777 00778 /* 0-1 control function of saturated water available to roots - capillary draw when roots don't quite reach down to water table */ 00779 SatWat_Root_CF = Exp(-10.0* Max(UNSAT_DEPTH[cellLoc]-HP_NPHBIO_ROOTDEPTH[HAB[cellLoc]],0.0) ); 00780 /* HYDrologic, control function (0-1) of proportion of WATer in upper soil profile that is AVAILable for plant uptake, including unsaturated storage withdrawal, and small capillary withdrawal from saturated storage, depending on relative depths */ 00781 HYD_WATER_AVAIL[cellLoc] = (UNSAT_DEPTH[cellLoc] > HP_NPHBIO_ROOTDEPTH[HAB[cellLoc]] ) ? 00782 ( Max(UNSAT_MOIST_PRP[cellLoc], SatWat_Root_CF) ) : 00783 ( 1.0 ); 00784 /* empirical data of a (0-1) control function, the proportion of water available to plants (dependent var) as a function of proportion (0-1) of water available upper soil profile (independent var) (generally, simply 1:1 relationship) */ 00785 MAC_WATER_AVAIL_CF[cellLoc] = graph8(0x0,HYD_WATER_AVAIL[cellLoc]); 00786 00787 /******** next calc the potential and actual flows */ 00788 /* unsatLoss(1) unsat to sat percolation */ 00789 /*unsat to sat flow here only includes percolation (rising water table accomodated in update after horiz fluxes) */ 00790 UNSAT_PERC[cellLoc] = Min(HP_HYD_RCINFILT[HAB[cellLoc]]*UNSAT_HYD_COND_CF[cellLoc],UNSAT_AVAIL[cellLoc]*UNSAT_WATER[cellLoc]); 00791 UNSAT_TO_SAT_FL[cellLoc] = 00792 ( (UNSAT_PERC[cellLoc])*DT > UNSAT_WATER[cellLoc] ) ? 00793 ( UNSAT_WATER[cellLoc]/DT ) : 00794 ( UNSAT_PERC[cellLoc]); 00795 /* unsatLoss(2) unsat to atmosph transpiration */ 00796 HYD_UNSAT_POT_TRANS[cellLoc] = (UNSAT_DEPTH[cellLoc] > HP_NPHBIO_ROOTDEPTH[HAB[cellLoc]] ) ? 00797 ( HYD_TOT_POT_TRANSP[cellLoc]*MAC_WATER_AVAIL_CF[cellLoc] ) : 00798 (0.0); /* no unsat transp if roots are in saturated zone */ 00799 UNSAT_TRANSP[cellLoc] = 00800 ( (HYD_UNSAT_POT_TRANS[cellLoc]+UNSAT_TO_SAT_FL[cellLoc])*DT>UNSAT_WATER[cellLoc] ) ? 00801 ( (UNSAT_WATER[cellLoc]-UNSAT_TO_SAT_FL[cellLoc]*DT)/DT ) : 00802 ( HYD_UNSAT_POT_TRANS[cellLoc]); 00803 00804 /* satLoss(1) sat to deep aquifer recharge **RATE parameter IS ALWAYS SET to ZERO *****/ 00805 SAT_WT_RECHG[cellLoc] = 00806 ( GP_HYD_RCRECHG*HP_HYD_SPEC_YIELD[HAB[cellLoc]]/HP_HYD_POROSITY[HAB[cellLoc]]*DT>SAT_WATER[cellLoc] ) ? 00807 ( SAT_WATER[cellLoc]/DT ) : 00808 ( GP_HYD_RCRECHG*HP_HYD_SPEC_YIELD[HAB[cellLoc]]/HP_HYD_POROSITY[HAB[cellLoc]]); 00809 00810 /* sat to surf upflow when gwater exceeds soil capacity due to lateral inflows 00811 accomodated in gwFluxes */ 00812 00813 /* satLoss(2) sat to unsat with lowering water table due to recharge loss ONLY (horiz outflows accomodated in gwFluxes) 00814 (leaves field capacity amount in unsat zone)*/ 00815 SAT_TO_UNSAT_FL[cellLoc] = 00816 ( SAT_WT_RECHG[cellLoc]*field_cap/HP_HYD_POROSITY[HAB[cellLoc]]*DT > SAT_WATER[cellLoc] ) ? 00817 ( (SAT_WATER[cellLoc])/DT ) : 00818 ( SAT_WT_RECHG[cellLoc]*field_cap/HP_HYD_POROSITY[HAB[cellLoc]]) ; 00819 /* satLoss(3) sat to atmosph */ 00820 HYD_SAT_POT_TRANS[cellLoc] = HYD_TOT_POT_TRANSP[cellLoc]*SatWat_Root_CF; 00821 SAT_WT_TRANSP[cellLoc] = 00822 ( (HYD_SAT_POT_TRANS[cellLoc]+SAT_TO_UNSAT_FL[cellLoc])*DT > SAT_WATER[cellLoc] ) ? 00823 ( (SAT_WATER[cellLoc]-SAT_TO_UNSAT_FL[cellLoc]*DT)/DT ) : 00824 ( HYD_SAT_POT_TRANS[cellLoc]); 00825 00826 /* sfwatLoss(1) sf to sat */ 00827 /* downflow to saturated assumed to occur in situations with small 00828 unsat layer overlain by significant surface water (SAT_VS_UNSAT very small), 00829 with immediate hydraulic connectivity betweent the two storages */ 00830 SF_WT_TO_SAT_DOWNFLOW[cellLoc] = 00831 ( (1.0-SAT_VS_UNSAT[cellLoc])*UNSAT_WT_POT[cellLoc]*DT>SURFACE_WAT[cellLoc] ) ? 00832 ( SURFACE_WAT[cellLoc]/DT ) : 00833 ( (1.0-SAT_VS_UNSAT[cellLoc])*UNSAT_WT_POT[cellLoc]); 00834 /* sfwatLoss(2) sf to unsat infiltration (sat_vs_unsat splits these losses to groundwater, but downflow to sat is given priority) */ 00835 SF_WT_POT_INF[cellLoc] = 00836 ( (SAT_VS_UNSAT[cellLoc]*HP_HYD_RCINFILT[HAB[cellLoc]]+SF_WT_TO_SAT_DOWNFLOW[cellLoc])*DT>SURFACE_WAT[cellLoc] ) ? 00837 ( (SURFACE_WAT[cellLoc]-SF_WT_TO_SAT_DOWNFLOW[cellLoc]*DT)/DT ) : 00838 ( SAT_VS_UNSAT[cellLoc]*HP_HYD_RCINFILT[HAB[cellLoc]]); 00839 SF_WT_INFILTRATION[cellLoc] = 00840 ( SF_WT_POT_INF[cellLoc]*DT > (UNSAT_WT_POT[cellLoc]-SF_WT_TO_SAT_DOWNFLOW[cellLoc]*DT) ) ? 00841 ((UNSAT_WT_POT[cellLoc]-SF_WT_TO_SAT_DOWNFLOW[cellLoc]*DT)/DT ) : 00842 ( SF_WT_POT_INF[cellLoc]); 00843 sfwat_pr1 = SF_WT_INFILTRATION[cellLoc]+SF_WT_TO_SAT_DOWNFLOW[cellLoc]; 00844 /* sfwatLoss(3) sf to atmosph */ 00845 SF_WT_EVAP[cellLoc] = 00846 ( (f_LAI_eff*HYD_EVAP_CALC[cellLoc]+sfwat_pr1 )*DT>SURFACE_WAT[cellLoc] ) ? 00847 ( (SURFACE_WAT[cellLoc]-sfwat_pr1*DT)/DT ) : 00848 ( f_LAI_eff*HYD_EVAP_CALC[cellLoc]); 00849 00850 00851 /******** then update the state variable storages */ 00852 00853 /* unsat loss priority: percolation, transpiration */ 00854 /* calc unsaturated storage state var (m) */ 00855 UNSAT_WATER[cellLoc] = UNSAT_WATER[cellLoc] 00856 + (SAT_TO_UNSAT_FL[cellLoc] + SF_WT_INFILTRATION[cellLoc] 00857 - UNSAT_TO_SAT_FL[cellLoc] - UNSAT_TRANSP[cellLoc]) * DT; 00858 00859 /* sat loss priority: recharge to deep aquifer, re-assign to unsat with lowered water table, transpiration */ 00860 /* calc saturated storage state var (m) */ 00861 SAT_WATER[cellLoc] = SAT_WATER[cellLoc] 00862 + (UNSAT_TO_SAT_FL[cellLoc] + SF_WT_TO_SAT_DOWNFLOW[cellLoc] 00863 - SAT_WT_TRANSP[cellLoc] - SAT_TO_UNSAT_FL[cellLoc] - SAT_WT_RECHG[cellLoc]) * DT; 00864 00865 /* sfwat loss priority: downflow to replace groundwater loss, infiltration to unsat, evaporation */ 00866 /* calc surface storage state var (m) */ 00867 SURFACE_WAT[cellLoc] = SURFACE_WAT[cellLoc] 00868 + (SF_WT_FROM_RAIN[cellLoc] 00869 - SF_WT_EVAP[cellLoc] - SF_WT_INFILTRATION[cellLoc] - SF_WT_TO_SAT_DOWNFLOW[cellLoc]) * DT; 00870 00871 /******** lastly, update of head calcs, unsat capacity, moisture proportion, etc. 00872 in order to calc water in diff storages for solute concentrations */ 00873 SAT_WT_HEAD[cellLoc] = SAT_WATER[cellLoc]/HP_HYD_POROSITY[HAB[cellLoc]]; 00874 UNSAT_DEPTH[cellLoc] = Max(SED_ELEV[cellLoc]-SAT_WT_HEAD[cellLoc],0.0); 00875 UNSAT_CAP[cellLoc] = UNSAT_DEPTH[cellLoc]*HP_HYD_POROSITY[HAB[cellLoc]]; 00876 00877 UNSAT_MOIST_PRP[cellLoc] = 00878 ( UNSAT_CAP[cellLoc]>0.0 ) ? 00879 ( Min(UNSAT_WATER[cellLoc]/UNSAT_CAP[cellLoc],1.0) ) : 00880 ( 1.0); 00881 HYD_DOM_ACTWAT_VOL[cellLoc] = ( Min(HP_DOM_MAXDEPTH[HAB[cellLoc]],UNSAT_DEPTH[cellLoc])*UNSAT_MOIST_PRP[cellLoc] + 00882 Max(HP_DOM_MAXDEPTH[HAB[cellLoc]]-UNSAT_DEPTH[cellLoc], 0.0)*HP_HYD_POROSITY[HAB[cellLoc]] ) 00883 *CELL_SIZE; 00884 /* flag for presence of small amount of water storage in the active zone must be present */ 00885 HYD_DOM_ACTWAT_PRES[cellLoc] = 00886 ( HYD_DOM_ACTWAT_VOL[cellLoc] > CELL_SIZE*0.01 ) ? 00887 ( 1.0 ) : ( 0.0); 00888 HYD_SED_WAT_VOL[cellLoc] = (SAT_WATER[cellLoc]+UNSAT_WATER[cellLoc])*CELL_SIZE; 00889 SFWT_VOL[cellLoc] = SURFACE_WAT[cellLoc]*CELL_SIZE; 00890 00891 HydTotHd[cellLoc] = SAT_WT_HEAD[cellLoc]+SURFACE_WAT[cellLoc]; /* only used for reporting purposes */ 00892 00893 /* at the square of xx% of the macrophyte's height, the manning's n 00894 calc will indicate the macrophyte *starting* to bend over, 00895 starting to offer increasingly less resistance */ 00896 mann_height = (GP_mann_height_coef*MAC_HEIGHT[cellLoc])*(GP_mann_height_coef*MAC_HEIGHT[cellLoc]); 00897 N_density = Max(HP_MAC_MAXROUGH[HAB[cellLoc]] * MAC_REL_BIOM[cellLoc], HP_MAC_MINROUGH[HAB[cellLoc]] ); 00898 /* manning's n for overland (horiz) flow */ 00899 mann_height = Max(mann_height,0.01); /* ensure that even in absence of veg, there is miniscule (1 cm in model grid cell) height related to some form of veg */ 00900 HYD_MANNINGS_N[cellLoc] = Max(-Abs((N_density-HP_MAC_MINROUGH[HAB[cellLoc]]) 00901 *(pow(2.0,(1.0-SURFACE_WAT[cellLoc]/mann_height))-1.0) ) 00902 + N_density,HP_MAC_MINROUGH[HAB[cellLoc]]); 00903 00904 /* sum of transpiration for output only */ 00905 HYD_TRANSP[cellLoc] = UNSAT_TRANSP[cellLoc]+SAT_WT_TRANSP[cellLoc]; 00906 HYD_ET[cellLoc] = HYD_TRANSP[cellLoc]+SF_WT_EVAP[cellLoc]; 00907 00908 } 00909 } 00910 } 00911 }
|
Here is the call graph for this function:
|
Macrophyte (vertical) dynamics. Temporal dynamics of carbon and phosphorus including growth, mortality, etc of macrophyte community
Definition at line 936 of file UnitMod.c. References SimTime, and WriteMsg(). Referenced by call_cell_dyn(). 00937 { 00938 int ix, iy, cellLoc; 00939 float reduc, NPP_P, min_litTemp, nphbio_ddep, phbio_ddep, MAC_PHtoNPH, MAC_PHtoNPH_Init; 00940 00941 for(ix=1; ix<=s0; ix++) { 00942 for(iy=1; iy<=s1; iy++) { 00943 00944 if(ON_MAP[cellLoc= T(ix,iy)]) { 00945 00946 /* these thresholds need updating when a habitat type of a grid cell changes */ 00947 MAC_MAX_BIO[cellLoc] = HP_NPHBIO_MAX[HAB[cellLoc]]+HP_PHBIO_MAX[HAB[cellLoc]]; 00948 NPHBIO_REFUGE[cellLoc] = HP_NPHBIO_MAX[HAB[cellLoc]]*GP_MAC_REFUG_MULT; 00949 NPHBIO_SAT[cellLoc] = HP_NPHBIO_MAX[HAB[cellLoc]]*0.9; 00950 PHBIO_REFUGE[cellLoc] = HP_PHBIO_MAX[HAB[cellLoc]]*GP_MAC_REFUG_MULT; 00951 PHBIO_SAT[cellLoc] = HP_PHBIO_MAX[HAB[cellLoc]]*0.9; 00952 /* various control functions for production calc */ 00953 MAC_LIGHT_CF[cellLoc] = SOLRADGRD[cellLoc]/HP_MAC_LIGHTSAT[HAB[cellLoc]] 00954 *Exp(1.0-SOLRADGRD[cellLoc]/HP_MAC_LIGHTSAT[HAB[cellLoc]]); 00955 MAC_TEMP_CF[cellLoc] = tempCF(0, 0.20, HP_MAC_TEMPOPT[HAB[cellLoc]], 5.0, 40.0, AIR_TEMP[cellLoc]); 00956 HP_MAC_WAT_TOLER[HAB[cellLoc]] = Max(HP_MAC_WAT_TOLER[HAB[cellLoc]],0.005); /* water tolerance is supposed to be non-zero; set to 5mm if user input a 0 */ 00957 MAC_WATER_CF[cellLoc] = Min(MAC_WATER_AVAIL_CF[cellLoc], 00958 Max(1.0-Max( (SURFACE_WAT[cellLoc]-HP_MAC_WAT_TOLER[HAB[cellLoc]]) 00959 /HP_MAC_WAT_TOLER[HAB[cellLoc]],0.0),0.0)); 00960 MAC_NUT_CF[cellLoc] = 00961 Exp(-GP_mac_uptake_coef * Max(HP_MAC_KSP[HAB[cellLoc]]-TP_SEDWT_CONCACTMG[cellLoc], 0.0) 00962 /HP_MAC_KSP[HAB[cellLoc]]) ; /* mg/L */ 00963 MAC_SALT_CF[cellLoc] = 1.0; /* made inactive here; can set up relation to HP_MAC_SALIN_THRESH[HAB[cellLoc]] parm */ 00964 min_litTemp = Min(MAC_LIGHT_CF[cellLoc], MAC_TEMP_CF[cellLoc]); 00965 MAC_PROD_CF[cellLoc] = Min(min_litTemp,MAC_WATER_CF[cellLoc]) 00966 *MAC_NUT_CF[cellLoc] *MAC_SALT_CF[cellLoc]; 00967 /* net primary production, kg C/m2/d */ 00968 PHBIO_NPP[cellLoc] = HP_PHBIO_RCNPP[HAB[cellLoc]]*MAC_PROD_CF[cellLoc]*MAC_PH_BIOMAS[cellLoc] 00969 * Max( (1.0-MAC_TOT_BIOM[cellLoc]/MAC_MAX_BIO[cellLoc]), 0.0); 00970 /* P uptake is dependent on available P and relative to a maximum P:C ratio for the tissue (kg C/m^2/d * P:Cmax * dimless = kgP/m2/d ) */ 00971 NPP_P = PHBIO_NPP[cellLoc] * HP_PHBIO_IC_PC[HAB[cellLoc]] * Max(MAC_NUT_CF[cellLoc]*2.0,1.0) 00972 * Max(1.0-mac_ph_PC[cellLoc]/HP_PHBIO_IC_PC[HAB[cellLoc]], 0.0); 00973 /* check for available P mass that will be taken up from sed water in active zone (nutCF does not); v2.5 constrained TP_SED_WT_AZ to pos */ 00974 reduc = (NPP_P > 0.0) ? 00975 (Max(TP_SED_WT_AZ[cellLoc],0.0) / ( NPP_P*CELL_SIZE*DT) ) : /* within-plant variable stoichiometry */ 00976 (1.0); 00977 /* reduce the production proportionally if excess demand is found */ 00978 /* can have high conc, but low mass of P avail, in presence of high plant biomass and high demand */ 00979 if (reduc < 1.0) { 00980 PHBIO_NPP[cellLoc] *= reduc; 00981 NPP_P *= reduc; 00982 } 00983 00984 /* losses from photobio */ 00985 phbio_ddep = Max(1.0-Max( (PHBIO_SAT[cellLoc]-MAC_PH_BIOMAS[cellLoc]) 00986 /(PHBIO_SAT[cellLoc]-PHBIO_REFUGE[cellLoc]),0.0),0.0); 00987 PHBIO_AVAIL[cellLoc] = MAC_PH_BIOMAS[cellLoc]*phbio_ddep; 00988 MAC_PHtoNPH_Init = HP_PHBIO_MAX[HAB[cellLoc]] / HP_NPHBIO_MAX[HAB[cellLoc]] ; /*if habitat type changes */ 00989 MAC_PHtoNPH = (MAC_NOPH_BIOMAS[cellLoc]>0.0) ? ( MAC_PH_BIOMAS[cellLoc] / MAC_NOPH_BIOMAS[cellLoc]) : (MAC_PHtoNPH_Init); 00990 00991 NPHBIO_TRANSLOC_POT[cellLoc] = (MAC_PHtoNPH>MAC_PHtoNPH_Init) ? 00992 (exp(HP_MAC_TRANSLOC_RC[HAB[cellLoc]] *(MAC_PHtoNPH-MAC_PHtoNPH_Init)) - 1.0) : 00993 (0.0); 00994 NPHBIO_TRANSLOC[cellLoc] = 00995 ( (NPHBIO_TRANSLOC_POT[cellLoc])*DT >PHBIO_AVAIL[cellLoc] ) ? 00996 ( (PHBIO_AVAIL[cellLoc])/DT ) : 00997 ( NPHBIO_TRANSLOC_POT[cellLoc]); 00998 00999 PHBIO_MORT_POT[cellLoc] = HP_PHBIO_RCMORT[HAB[cellLoc]] *PHBIO_AVAIL[cellLoc] 01000 *(1.0 + (1.0-MAC_WATER_AVAIL_CF[cellLoc]) )/2.0; 01001 PHBIO_MORT[cellLoc] = 01002 ( (PHBIO_MORT_POT[cellLoc]+NPHBIO_TRANSLOC[cellLoc])*DT>PHBIO_AVAIL[cellLoc] ) ? 01003 ( (PHBIO_AVAIL[cellLoc]-NPHBIO_TRANSLOC[cellLoc]*DT)/DT ) : 01004 ( PHBIO_MORT_POT[cellLoc]); 01005 01006 01007 /* losses from non-photobio */ 01008 nphbio_ddep = Max(1.0-Max((NPHBIO_SAT[cellLoc]-MAC_NOPH_BIOMAS[cellLoc]) 01009 /(NPHBIO_SAT[cellLoc]-NPHBIO_REFUGE[cellLoc]),0.0),0.0); 01010 NPHBIO_AVAIL[cellLoc] = MAC_NOPH_BIOMAS[cellLoc]*nphbio_ddep; 01011 01012 PHBIO_TRANSLOC_POT[cellLoc] = (MAC_PHtoNPH<MAC_PHtoNPH_Init) ? 01013 (exp(HP_MAC_TRANSLOC_RC[HAB[cellLoc]] *(MAC_PHtoNPH_Init-MAC_PHtoNPH)) - 1.0) : 01014 (0.0); 01015 PHBIO_TRANSLOC[cellLoc] = 01016 ( (PHBIO_TRANSLOC_POT[cellLoc])*DT >NPHBIO_AVAIL[cellLoc] ) ? 01017 ( (NPHBIO_AVAIL[cellLoc])/DT ) : 01018 ( PHBIO_TRANSLOC_POT[cellLoc]); 01019 NPHBIO_MORT_POT[cellLoc] = NPHBIO_AVAIL[cellLoc]*HP_PHBIO_RCMORT[HAB[cellLoc]] 01020 * (1.0 + Max(1.0-MAC_PH_BIOMAS[cellLoc]/HP_PHBIO_MAX[HAB[cellLoc]],0.0) )/2.0; /* decreased mort w/ increasing photobio */ 01021 NPHBIO_MORT[cellLoc] = 01022 ( (PHBIO_TRANSLOC[cellLoc]+NPHBIO_MORT_POT[cellLoc])*DT>NPHBIO_AVAIL[cellLoc] ) ? 01023 ( (NPHBIO_AVAIL[cellLoc]-PHBIO_TRANSLOC[cellLoc]*DT)/DT ) : 01024 ( NPHBIO_MORT_POT[cellLoc]); 01025 01026 01027 /* calc nonphotosynthetic biomass state var (kgC/m2) */ 01028 MAC_NOPH_BIOMAS[cellLoc] = MAC_NOPH_BIOMAS[cellLoc] 01029 + (NPHBIO_TRANSLOC[cellLoc] - NPHBIO_MORT[cellLoc] 01030 - PHBIO_TRANSLOC[cellLoc] ) * DT; 01031 01032 /* calc nonphotosynthetic biomass state var (kgC/m2) */ 01033 MAC_PH_BIOMAS[cellLoc] = MAC_PH_BIOMAS[cellLoc] 01034 + (PHBIO_TRANSLOC[cellLoc] + PHBIO_NPP[cellLoc] 01035 - PHBIO_MORT[cellLoc] - NPHBIO_TRANSLOC[cellLoc]) * DT; 01036 01037 /* total biomass */ 01038 MAC_TOT_BIOM[cellLoc] = MAC_PH_BIOMAS[cellLoc]+MAC_NOPH_BIOMAS[cellLoc]; 01039 /* book-keeping calcs used in other modules */ 01040 MAC_REL_BIOM[cellLoc] = 01041 ( MAC_TOT_BIOM[cellLoc] > 0.0 ) ? 01042 MAC_TOT_BIOM[cellLoc]/MAC_MAX_BIO[cellLoc] : 01043 0.0001; 01044 MAC_HEIGHT[cellLoc] = pow(MAC_REL_BIOM[cellLoc],0.33)*HP_MAC_MAXHT[HAB[cellLoc]]; 01045 MAC_LAI[cellLoc] = MAC_REL_BIOM[cellLoc]*HP_MAC_MAXLAI[HAB[cellLoc]]; 01046 /* note that an "effective" LAI that accounts for water depth is calc'd in hydro module */ 01047 01048 /* now calc the P and organic matter associated with the C fluxes */ 01049 phbio_npp_P[cellLoc] = NPP_P; /* within-plant variable stoichiometry */ 01050 phbio_npp_OM[cellLoc] = PHBIO_NPP[cellLoc] / HP_PHBIO_IC_CTOOM[HAB[cellLoc]]; /* habitat-specfic stoichiometry */ 01051 01052 phbio_mort_P[cellLoc] = PHBIO_MORT[cellLoc] * mac_ph_PC[cellLoc]; 01053 phbio_mort_OM[cellLoc] = PHBIO_MORT[cellLoc] / mac_ph_CtoOM[cellLoc]; 01054 01055 phbio_transl_P[cellLoc] = PHBIO_TRANSLOC[cellLoc] * mac_nph_PC[cellLoc]; 01056 phbio_transl_OM[cellLoc] = PHBIO_TRANSLOC[cellLoc] / mac_nph_CtoOM[cellLoc]; 01057 01058 nphbio_transl_P[cellLoc] = NPHBIO_TRANSLOC[cellLoc] * mac_ph_PC[cellLoc]; 01059 nphbio_transl_OM[cellLoc] = NPHBIO_TRANSLOC[cellLoc] / mac_ph_CtoOM[cellLoc]; 01060 01061 nphbio_mort_P[cellLoc] = NPHBIO_MORT[cellLoc] * mac_nph_PC[cellLoc]; 01062 nphbio_mort_OM[cellLoc] = NPHBIO_MORT[cellLoc] / mac_nph_CtoOM[cellLoc]; 01063 01064 01065 /* state vars: now calc the P and OM associated with those C state vars */ 01066 mac_nph_P[cellLoc] = mac_nph_P[cellLoc] 01067 + (nphbio_transl_P[cellLoc] - nphbio_mort_P[cellLoc] 01068 - phbio_transl_P[cellLoc] ) * DT; 01069 mac_nph_PC[cellLoc] = ( (MAC_NOPH_BIOMAS[cellLoc] > 0.0) && (mac_nph_P[cellLoc] > 0.0)) ? 01070 (mac_nph_P[cellLoc] / MAC_NOPH_BIOMAS[cellLoc]) : /* these second mass checks not needed */ 01071 0.3 * HP_NPHBIO_IC_PC[HAB[cellLoc]]; /* default to 0.3 of max for habitat */ 01072 mac_nph_PC_rep[cellLoc] = (float)mac_nph_PC[cellLoc] * conv_kgTOmg; /* variable for output _rep-orting only */ 01073 01074 01075 mac_nph_OM[cellLoc] = mac_nph_OM[cellLoc] 01076 + (nphbio_transl_OM[cellLoc] - nphbio_mort_OM[cellLoc] 01077 - phbio_transl_OM[cellLoc] ) * DT; 01078 mac_nph_CtoOM[cellLoc] = ( (mac_nph_OM[cellLoc] > 0.0) && (MAC_NOPH_BIOMAS[cellLoc]>0.0)) ? 01079 (MAC_NOPH_BIOMAS[cellLoc] / mac_nph_OM[cellLoc]) : 01080 HP_NPHBIO_IC_CTOOM[HAB[cellLoc]]; 01081 01082 mac_ph_P[cellLoc] = mac_ph_P[cellLoc] 01083 + (phbio_transl_P[cellLoc] + phbio_npp_P[cellLoc] - phbio_mort_P[cellLoc] 01084 - nphbio_transl_P[cellLoc] ) * DT; 01085 mac_ph_PC[cellLoc] = ( (MAC_PH_BIOMAS[cellLoc] > 0.0) && (mac_ph_P[cellLoc]>0.0)) ? 01086 (mac_ph_P[cellLoc] / MAC_PH_BIOMAS[cellLoc]) : 01087 0.3 * HP_PHBIO_IC_PC[HAB[cellLoc]]; /* default to 0.3 of max for habitat */ 01088 mac_ph_PC_rep[cellLoc] = (float)mac_ph_PC[cellLoc] * conv_kgTOmg; /* variable for output _rep-orting only */ 01089 01090 mac_ph_OM[cellLoc] = mac_ph_OM[cellLoc] 01091 + (phbio_transl_OM[cellLoc] + phbio_npp_OM[cellLoc] - phbio_mort_OM[cellLoc] 01092 - nphbio_transl_OM[cellLoc] ) * DT; 01093 mac_ph_CtoOM[cellLoc] = ( (mac_ph_OM[cellLoc] > 0.0) && (MAC_PH_BIOMAS[cellLoc]>0.0)) ? 01094 (MAC_PH_BIOMAS[cellLoc] / mac_ph_OM[cellLoc]) : 01095 HP_PHBIO_IC_CTOOM[HAB[cellLoc]]; 01096 01097 if (debug > 0 && MAC_NOPH_BIOMAS[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg NPhoto C biomass (%f m) in cell (%d,%d)!", 01098 SimTime.TIME, MAC_NOPH_BIOMAS[cellLoc], ix,iy ); WriteMsg( msgStr,True ); dynERRORnum++;} 01099 if (debug > 0 && MAC_PH_BIOMAS[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg Photo C biomass (%f m) in cell (%d,%d)!", 01100 SimTime.TIME, MAC_PH_BIOMAS[cellLoc], ix,iy ); WriteMsg( msgStr,True ); dynERRORnum++;} 01101 if (debug > 0 && mac_nph_P[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg NPhoto P biomass (%f m) in cell (%d,%d)!", 01102 SimTime.TIME, mac_nph_P[cellLoc], ix,iy ); WriteMsg( msgStr,True ); dynERRORnum++;} 01103 if (debug > 0 && mac_ph_P[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg Photo P biomass (%f m) in cell (%d,%d)!", 01104 SimTime.TIME, mac_ph_P[cellLoc], ix,iy ); WriteMsg( msgStr,True ); dynERRORnum++;} 01105 01106 01107 /******** phosphorus removed from water here *************/ 01108 TP_SEDWT_UPTAKE[cellLoc] = phbio_npp_P[cellLoc]*CELL_SIZE; 01109 /* recalc P in sed water state variable (kg P) */ 01110 TP_SED_WT[cellLoc] = TP_SED_WT[cellLoc] - (TP_SEDWT_UPTAKE[cellLoc]) * DT; 01111 TP_SED_CONC[cellLoc] = (HYD_SED_WAT_VOL[cellLoc]>0.0) ? 01112 (TP_SED_WT[cellLoc] / HYD_SED_WAT_VOL[cellLoc]) : 01113 (0.0); 01114 01115 /* this is the active zone, where uptake, sorption, and mineralization take place */ 01116 TP_SED_WT_AZ[cellLoc] = TP_SED_WT_AZ[cellLoc] - (TP_SEDWT_UPTAKE[cellLoc]) * DT; 01117 TP_SEDWT_CONCACT[cellLoc] = ( HYD_DOM_ACTWAT_PRES[cellLoc] > 0.0) ? 01118 ( TP_SED_WT_AZ[cellLoc]/HYD_DOM_ACTWAT_VOL[cellLoc] ) : 01119 (TP_SED_CONC[cellLoc]); /* g/L */ 01120 TP_SEDWT_CONCACTMG[cellLoc] = TP_SEDWT_CONCACT[cellLoc]*conv_kgTOg; /* g/m3==mg/L */ 01121 01122 } 01123 } 01124 } 01125 }
|
Here is the call graph for this function:
|
Phosphorus (vertical) dynamics. Temporal dynamics of phosphorus in water and sorbed to soil.
Definition at line 1144 of file UnitMod.c. References SimTime, and WriteMsg(). Referenced by call_cell_dyn(). 01145 { 01146 int ix, iy, cellLoc; 01147 float TPpartic, TPsettlRat, TP_settl_pot; 01148 double PO4Pconc, nonPO4Pconc; 01149 01150 for(ix=1; ix<=s0; ix++) { 01151 for(iy=1; iy<=s1; iy++) { 01152 01153 if(ON_MAP[cellLoc= T(ix,iy)]) { 01154 /* calc concentrations after horiz fluxes */ 01155 TP_SFWT_CONC[cellLoc] = 01156 ( SFWT_VOL[cellLoc] > 0.0 ) ? 01157 ( TP_SF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : 01158 ( 0.0); /* used in P fluxes for mass balance */ 01159 /* using regression for predicting PO4 from TP */ 01160 PO4Pconc = Max( TP_SFWT_CONC[cellLoc]*GP_PO4toTP + 0.001*GP_PO4toTPint,0.0); /* g/l (note that intercept may be <0)*/ 01161 /* after spatial (horiz) fluxes, recalc the active zone P mass based on old active/total ratio */ 01162 TP_SED_CONC[cellLoc] = (HYD_SED_WAT_VOL[cellLoc]>0.0) ? 01163 (TP_SED_WT[cellLoc] / HYD_SED_WAT_VOL[cellLoc]) : 01164 (0.0); 01165 /* this is the active zone, where uptake, sorption, and mineralization take place */ 01166 TP_SED_WT_AZ[cellLoc] = TP_SED_CONC[cellLoc] * TP_Act_to_Tot[cellLoc] * HYD_DOM_ACTWAT_VOL[cellLoc]; 01167 TP_SEDWT_CONCACT[cellLoc] =(HYD_DOM_ACTWAT_PRES[cellLoc] > 0.0) ? 01168 ( TP_SED_WT_AZ[cellLoc]/HYD_DOM_ACTWAT_VOL[cellLoc] ) : 01169 ( TP_SED_CONC[cellLoc]); 01170 01171 /* inputs to surf P (kg P) (rain conc in mg/L) */ 01172 TP_FR_RAIN[cellLoc] = SF_WT_FROM_RAIN[cellLoc]*CELL_SIZE*GP_TP_IN_RAIN*0.001; 01173 01174 /* calc various loss and/or vertical exchange potentials (kg P) */ 01175 /* diffusive flux */ 01176 TP_UPFLOW_POT[cellLoc] = /* advective upflow has been handled in surf-ground integration in fluxes.c */ 01177 Max((TP_SEDWT_CONCACT[cellLoc]-PO4Pconc) 01178 *GP_TP_DIFFCOEF*8.64/GP_TP_DIFFDEPTH*CELL_SIZE,0.0); 01179 TP_UPFLOW[cellLoc] = 01180 ( (TP_UPFLOW_POT[cellLoc])*DT>TP_SED_WT_AZ[cellLoc] ) ? 01181 ( (TP_SED_WT_AZ[cellLoc])/DT ) : 01182 ( TP_UPFLOW_POT[cellLoc]); 01183 /* units = mgP/L */ 01184 TP_K[cellLoc] = Max(GP_TP_K_SLOPE*TP_SORBCONC[cellLoc]+GP_TP_K_INTER,0.0); 01185 /*fix rate */ 01186 TP_SORB_POT[cellLoc] = 01187 ( HYD_DOM_ACTWAT_PRES[cellLoc]>0.0 ) ? 01188 ( (double) 0.001 01189 *(TP_K[cellLoc]*(pow(Max(TP_SEDWT_CONCACT[cellLoc],0.0),0.8) ) 01190 *0.001*(DEPOS_ORG_MAT[cellLoc]*CELL_SIZE+DIM[cellLoc])-TP_SORB[cellLoc] ) ) : 01191 ( 0.0); 01192 if (TP_SORB_POT[cellLoc]>0.0) { 01193 TP_SORBTION[cellLoc] = 01194 ( (TP_SORB_POT[cellLoc]+TP_UPFLOW[cellLoc])*DT>TP_SED_WT_AZ[cellLoc] ) ? 01195 ( (TP_SED_WT_AZ[cellLoc]-TP_UPFLOW[cellLoc]*DT)/DT ) : 01196 ( TP_SORB_POT[cellLoc]); 01197 } 01198 else { /* neg sorption, loss from sorb variable*/ 01199 TP_SORBTION[cellLoc] = 01200 ( (-TP_SORB_POT[cellLoc])*DT>TP_SORB[cellLoc] ) ? 01201 ( (-TP_SORB[cellLoc])/DT ) : 01202 ( TP_SORB_POT[cellLoc]); 01203 } 01204 01205 /* diffusive + advective flux */ 01206 TP_DNFLOW_POT[cellLoc] = (SF_WT_INFILTRATION[cellLoc]+SF_WT_TO_SAT_DOWNFLOW[cellLoc]) 01207 *CELL_SIZE*TP_SFWT_CONC[cellLoc] 01208 + Max((PO4Pconc-TP_SEDWT_CONCACT[cellLoc]) 01209 *GP_TP_DIFFCOEF*8.64/GP_TP_DIFFDEPTH*CELL_SIZE,0.0) ; 01210 TP_DNFLOW[cellLoc] = 01211 ( ( TP_DNFLOW_POT[cellLoc])*DT > TP_SF_WT[cellLoc] ) ? 01212 ( ( TP_SF_WT[cellLoc])/DT ) : 01213 ( TP_DNFLOW_POT[cellLoc]); 01214 /* calc P in sed water state variables (kg P) */ 01215 TP_SED_WT[cellLoc] = TP_SED_WT[cellLoc] + 01216 ( TP_DNFLOW[cellLoc] - TP_UPFLOW[cellLoc] - TP_SORBTION[cellLoc]) * DT; 01217 /* this is the active zone, where uptake, sorption, and mineralization take place */ 01218 TP_SED_WT_AZ[cellLoc] = TP_SED_WT_AZ[cellLoc] + 01219 (TP_DNFLOW[cellLoc] - TP_UPFLOW[cellLoc] - TP_SORBTION[cellLoc]) * DT; 01220 01221 /* calc P in surface water state variable (kg P) */ 01222 TP_SF_WT[cellLoc] = TP_SF_WT[cellLoc] + 01223 (TP_UPFLOW[cellLoc] + TP_FR_RAIN[cellLoc] 01224 - TP_DNFLOW[cellLoc]) * DT; 01225 01226 /* calc P sorbed-to-soil state variable (kg P) */ 01227 TP_SORB[cellLoc] = TP_SORB[cellLoc] + (TP_SORBTION[cellLoc]) * DT; 01228 01229 TP_SED_CONC[cellLoc] = (HYD_SED_WAT_VOL[cellLoc]>0.0) ? 01230 (TP_SED_WT[cellLoc] / HYD_SED_WAT_VOL[cellLoc]) : 01231 (0.0); /* g/L */ 01232 TP_SEDWT_CONCACT[cellLoc] = ( HYD_DOM_ACTWAT_PRES[cellLoc] > 0.0) ? 01233 ( TP_SED_WT_AZ[cellLoc]/HYD_DOM_ACTWAT_VOL[cellLoc] ) : 01234 (TP_SED_CONC[cellLoc]); /* g/L */ 01235 TP_SEDWT_CONCACTMG[cellLoc] = TP_SEDWT_CONCACT[cellLoc]*conv_kgTOg; /* g/m^3==mg/L */ 01236 01237 TP_SORBCONC[cellLoc] = ((DEPOS_ORG_MAT[cellLoc]*CELL_SIZE + DIM[cellLoc])>0.0) ? 01238 ( (double) TP_SORB[cellLoc]*conv_kgTOg / (DEPOS_ORG_MAT[cellLoc]*CELL_SIZE + DIM[cellLoc]) ) : 01239 (0.0); /* gP/kgsoil */ 01240 01241 TP_SORBCONC_rep[cellLoc] = TP_SORBCONC[cellLoc] * conv_gTOmg; /* reporting purposes only (g/kg->mg/kg)*/ 01242 01243 TP_SFWT_CONC[cellLoc] = 01244 ( SFWT_VOL[cellLoc] > 0.0 ) ? 01245 ( TP_SF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : 01246 ( 0.0); /* g/L used in P fluxes for mass balance */ 01247 TP_SFWT_CONC_MG[cellLoc] = 01248 ( SURFACE_WAT[cellLoc] > GP_DetentZ ) ? 01249 (TP_SFWT_CONC[cellLoc]*conv_kgTOg) : 01250 (0.0); /* g/m^3==mg/L used for reporting and other modules to evaluate P conc when water is present */ 01251 01252 /* the following is an empirical method to calculate settling of particulate P out of the water column 01253 into the sediments. It uses the fixed ratio of PO4 to TP, but allows for a decreasing proportion of 01254 TP to be in (large) particulate form as TP concentration drops below a chosen threshold - the sum of 01255 the TP is considered to be dissolved plus large particulate plus small particulate (that cannot settle out) */ 01256 /* mass (kg) of particulate fraction of TP, available for settling to sediments */ 01257 /* using regression for predicting PO4 from TP */ 01258 PO4Pconc = Max(TP_SFWT_CONC_MG[cellLoc]*GP_PO4toTP + GP_PO4toTPint,0.0); /* mg/l (note that intercept may be <0)*/ 01259 nonPO4Pconc = Max(TP_SFWT_CONC_MG[cellLoc]-PO4Pconc,0.0); /* non-PO4 conc, mg/l */ 01260 TPpartic = nonPO4Pconc * (1.0-exp(-nonPO4Pconc/GP_TPpart_thresh)) *0.001 * SFWT_VOL[cellLoc] ; /* kg particulate P */ 01261 01262 01263 /* settling rate, 1/d */ 01264 TPsettlRat = ( SURFACE_WAT[cellLoc] > GP_DetentZ ) ? 01265 (GP_settlVel/SURFACE_WAT[cellLoc]) : 01266 0.0; 01267 01268 /* potential settling of particulate TP (kg/d) */ 01269 TP_settl_pot = TPsettlRat * TPpartic; 01270 TP_settl[cellLoc] = 01271 ( ( TP_settl_pot)*DT > TPpartic ) ? 01272 ( (TPpartic)/DT ) : 01273 ( TP_settl_pot); 01274 /* calc P in surface water state variable (kg P) */ 01275 TP_SF_WT[cellLoc] = TP_SF_WT[cellLoc] - TP_settl[cellLoc] * DT; 01276 01277 /* various book-keeping calcs used in other modules */ 01278 /* conc surf and sed wat = kgP/m3==gP/L, another var calc for mg/L */ 01279 TP_SFWT_CONC[cellLoc] = 01280 ( SFWT_VOL[cellLoc] > 0.0 ) ? 01281 ( TP_SF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : 01282 ( 0.0); /* used in P fluxes for mass balance */ 01283 TP_SFWT_CONC_MG[cellLoc] = 01284 ( SURFACE_WAT[cellLoc] > GP_DetentZ ) ? 01285 (TP_SFWT_CONC[cellLoc]*conv_kgTOg) : 01286 (0.0); /* g/m3==mg/L used for reporting and other modules to evaluate P conc when water is present */ 01287 01288 if (debug > 0 && TP_SF_WT[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg TP_SF_WT (%f m) in cell (%d,%d)!", 01289 SimTime.TIME, TP_SF_WT[cellLoc], ix,iy ); WriteMsg( msgStr,True ); usrErr( msgStr ); dynERRORnum++; } 01290 if (debug > 0 && TP_SED_WT_AZ[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg TP_SED_WT_AZ (%f m) in cell (%d,%d)!", 01291 SimTime.TIME, TP_SED_WT_AZ[cellLoc], ix,iy ); WriteMsg( msgStr,True ); usrErr( msgStr ); dynERRORnum++; } 01292 01293 } 01294 } 01295 } 01296 }
|
Here is the call graph for this function:
|
Salt/tracer (vertical) dynamics. This module can be used as a conservative tracer if salinity is not important to objectives; replicate this module if salinity and an independent, conservative tracer, are both desired.
Definition at line 1394 of file UnitMod.c. Referenced by call_cell_dyn(). 01395 { 01396 int ix, iy, cellLoc; 01397 double SALT_SED_TO_SF_FLOW_pot; 01398 01399 01400 for(ix=1; ix<=s0; ix++) { 01401 for(iy=1; iy<=s1; iy++) { 01402 01403 if(ON_MAP[cellLoc= T(ix,iy)]) { 01404 SAL_SF_WT_mb[cellLoc] = 01405 ( SFWT_VOL[cellLoc] > 0.0 ) ? 01406 ( SALT_SURF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : 01407 ( 0.0); /* used in salt fluxes for mass balance */ 01408 SAL_SED_WT[cellLoc] = 01409 ( HYD_SED_WAT_VOL[cellLoc]>0.0 ) ? 01410 ( SALT_SED_WT[cellLoc]/HYD_SED_WAT_VOL[cellLoc] ) : 01411 ( 0.0); 01412 01413 /* diffusive + advective flux */ 01414 SALT_SFWAT_DOWNFL_POT[cellLoc] = (SF_WT_INFILTRATION[cellLoc] + SF_WT_TO_SAT_DOWNFLOW[cellLoc]) 01415 * CELL_SIZE*SAL_SF_WT_mb[cellLoc] 01416 + Max((SAL_SF_WT_mb[cellLoc]-SAL_SED_WT[cellLoc]) 01417 * GP_TP_DIFFCOEF*8.64/GP_TP_DIFFDEPTH*CELL_SIZE,0.0) ; /* TODO: get cl diffusion parm; diffusion parms same as P */ 01418 SALT_SFWAT_DOWNFL[cellLoc] = 01419 ( SALT_SFWAT_DOWNFL_POT[cellLoc]*DT>SALT_SURF_WT[cellLoc] ) ? 01420 ( SALT_SURF_WT[cellLoc]/DT ) : 01421 ( SALT_SFWAT_DOWNFL_POT[cellLoc]); 01422 01423 /* diffusive flux */ 01424 SALT_SED_TO_SF_FLOW_pot = 01425 /* advective upflow has been handled in surf-ground integration in fluxes.c */ 01426 Max((SAL_SED_WT[cellLoc]-SAL_SF_WT_mb[cellLoc]) 01427 *GP_TP_DIFFCOEF*8.64/GP_TP_DIFFDEPTH*CELL_SIZE,0.0) ; /* TODO: get cl diffusion parm; diffusion parms same as P */ 01428 SALT_SED_TO_SF_FLOW[cellLoc] = 01429 ( SALT_SED_TO_SF_FLOW_pot*DT>SALT_SED_WT[cellLoc] ) ? 01430 ( SALT_SED_WT[cellLoc]/DT ) : 01431 ( SALT_SED_TO_SF_FLOW_pot ); 01432 /* calc state vars (kg salt) */ 01433 SALT_SED_WT[cellLoc] = SALT_SED_WT[cellLoc] 01434 + (SALT_SFWAT_DOWNFL[cellLoc] - SALT_SED_TO_SF_FLOW[cellLoc]) * DT; 01435 01436 SALT_SURF_WT[cellLoc] = SALT_SURF_WT[cellLoc] 01437 + (SALT_SED_TO_SF_FLOW[cellLoc] - SALT_SFWAT_DOWNFL[cellLoc] ) * DT; 01438 01439 /* book-keeping concentration calcs, (kg/m3==g/L==ppt) used in other modules */ 01440 SAL_SF_WT_mb[cellLoc] = 01441 ( SFWT_VOL[cellLoc] > 0.0 ) ? 01442 ( SALT_SURF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : 01443 ( 0.0); /* used in salt fluxes for mass balance */ 01444 SAL_SF_WT[cellLoc] = 01445 ( SURFACE_WAT[cellLoc] > GP_DetentZ ) ? 01446 ( SAL_SF_WT_mb[cellLoc] ) : 01447 ( 0.0); /* used for reporting and other modules to evaluate salinity when water is present */ 01448 SAL_SED_WT[cellLoc] = 01449 ( HYD_SED_WAT_VOL[cellLoc]>0.0 ) ? 01450 ( SALT_SED_WT[cellLoc]/HYD_SED_WAT_VOL[cellLoc] ) : 01451 ( 0.0); 01452 01453 } 01454 } 01455 } 01456 01457 }
|
|
FLOCculent organic matter (vertical) dynamics. Temporal dynamics of carbon and phosphorus of flocculent organic matter of (top/overlying zone of) soil.
Definition at line 1478 of file UnitMod.c. References SimTime, and WriteMsg(). Referenced by call_cell_dyn(). 01479 { 01480 int ix, iy, cellLoc; 01481 float FlocP_DECOMP_pot, FlocP_DEPO_pot, FlocP_settl, Floc_settl; 01482 01483 for(ix=1; ix<=s0; ix++) { 01484 for(iy=1; iy<=s1; iy++) { 01485 01486 if(ON_MAP[cellLoc= T(ix,iy)]) { 01487 /* inputs (kg OM / m2) */ 01488 /* all periphyton mortality goes to floc */ 01489 FLOC_FR_ALGAE[cellLoc] = (double) (C_ALG_MORT[cellLoc]+NC_ALG_MORT[cellLoc]) 01490 /GP_ALG_C_TO_OM*0.001 ; 01491 /* all photobiomass mortality goes to floc */ 01492 Floc_fr_phBio[cellLoc] = phbio_mort_OM[cellLoc]; 01493 01494 /* all settling from water column goes to floc */ 01495 FlocP_settl = TP_settl[cellLoc] / CELL_SIZE; /* kg P/m2; */ 01496 /* the particulate P settling is assumed a fixed Redfield P:OM ratio */ 01497 Floc_settl = FlocP_settl / GP_TP_P_OM; 01498 01499 01500 /* outputs (kg OM / m2) */ 01501 FLOC_DECOMP_QUAL_CF[cellLoc] = /* use the avg conc of sed and sf water here */ 01502 Exp(-GP_DOM_decomp_coef * Max(GP_DOM_DECOMP_POPT- 01503 (TP_SFWT_CONC_MG[cellLoc]+TP_SEDWT_CONCACTMG[cellLoc])/2.0, 0.0) 01504 /GP_DOM_DECOMP_POPT) ; /* mg/L */ 01505 /* decomp in surface water has higher rate than in soil, 01506 assuming this stock is of much higer substrate quality than the total soil layer */ 01507 /* GP_calibDecomp is an adjustable calib parm */ 01508 soil_MOIST_CF[cellLoc] = (UNSAT_DEPTH[cellLoc]>HP_DOM_AEROBTHIN[HAB[cellLoc]]) ? 01509 ( Max(UNSAT_MOIST_PRP[cellLoc],0.0) ) : 01510 ( 1.0 ); 01511 FLOC_DECOMP_POT[cellLoc] = GP_calibDecomp * 10.0*GP_DOM_RCDECOMP*FLOC[cellLoc] 01512 *DOM_TEMP_CF[cellLoc] *FLOC_DECOMP_QUAL_CF[cellLoc] * soil_MOIST_CF[cellLoc]; 01513 FLOC_DECOMP[cellLoc] = 01514 ( (FLOC_DECOMP_POT[cellLoc])*DT>FLOC[cellLoc] ) ? 01515 ( (FLOC[cellLoc])/DT ) : 01516 ( FLOC_DECOMP_POT[cellLoc]); 01517 01518 /* the incorporation of the floc layer into the "true" soil layer occurs 01519 at a rate dependent on the floc depth under flooded conditions, then constant rate under dry conditions */ 01520 FLOC_DEPO_POT[cellLoc] = 01521 ( SURFACE_WAT[cellLoc] > GP_DetentZ ) ? 01522 ( FLOC_Z[cellLoc]/GP_FlocMax * FLOC[cellLoc]*GP_Floc_rcSoil ) : 01523 ( FLOC[cellLoc]*GP_Floc_rcSoil); 01524 FLOC_DEPO[cellLoc] = 01525 ( (FLOC_DEPO_POT[cellLoc]+FLOC_DECOMP[cellLoc])*DT>FLOC[cellLoc] ) ? 01526 ( (FLOC[cellLoc]-FLOC_DECOMP[cellLoc]*DT)/DT ) : 01527 ( FLOC_DEPO_POT[cellLoc]); 01528 /* calc the state var (kg OM / m2) */ 01529 FLOC[cellLoc] = FLOC[cellLoc] 01530 + ( Floc_settl + Floc_fr_phBio[cellLoc] + FLOC_FR_ALGAE[cellLoc] 01531 - FLOC_DECOMP[cellLoc] - FLOC_DEPO[cellLoc] ) * DT; 01532 01533 /* the depth of floc is dependent on a fixed floc bulk density */ 01534 FLOC_Z[cellLoc] = (double) FLOC[cellLoc] / GP_Floc_BD ; 01535 01536 01537 /* Floc phosphorus (kg P / m2) */ 01538 FlocP_FR_ALGAE[cellLoc] = (double) (NC_ALG_MORT_P[cellLoc] 01539 + C_ALG_MORT_P[cellLoc])*0.001; /* kg P/m2 */ 01540 FlocP_PhBio[cellLoc] = phbio_mort_P[cellLoc] ; 01541 01542 FlocP_DECOMP_pot = FLOC_DECOMP[cellLoc] * FlocP_OM[cellLoc]; 01543 FlocP_DECOMP[cellLoc] = 01544 ( (FlocP_DECOMP_pot)*DT>FlocP[cellLoc] ) ? 01545 ( (FlocP[cellLoc])/DT ) : 01546 ( FlocP_DECOMP_pot); 01547 FlocP_DEPO_pot = FLOC_DEPO[cellLoc] * FlocP_OM[cellLoc]; 01548 FlocP_DEPO[cellLoc] = 01549 ( (FlocP_DEPO_pot+FlocP_DECOMP[cellLoc])*DT>FlocP[cellLoc] ) ? 01550 ( (FlocP[cellLoc]-FlocP_DECOMP[cellLoc]*DT)/DT ) : 01551 ( FlocP_DEPO_pot); 01552 01553 /* calc the state var (kg P / m2) */ 01554 FlocP[cellLoc] = FlocP[cellLoc] 01555 + ( FlocP_settl + FlocP_PhBio[cellLoc] + FlocP_FR_ALGAE[cellLoc] 01556 - FlocP_DECOMP[cellLoc] - FlocP_DEPO[cellLoc] ) * DT; 01557 01558 FlocP_OM[cellLoc] = ( FLOC[cellLoc]>0.0) ? (FlocP[cellLoc]/FLOC[cellLoc]) : (0.0); /* kgP/kgOM */ 01559 FlocP_OMrep[cellLoc] = (float) FlocP_OM[cellLoc] * conv_kgTOmg; /* mgP/kgOM, variable for output _rep-orting only */ 01560 01561 if (debug > 0 && FLOC[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg FLOC OM biomass (%f m) in cell (%d,%d)!", 01562 SimTime.TIME, FLOC[cellLoc], ix,iy ); WriteMsg( msgStr,True ); dynERRORnum++;} 01563 if (debug > 0 && FlocP[cellLoc] < -GP_MinCheck) { sprintf(msgStr,"Day %6.1f: ERROR - neg FLOC P biomass (%f m) in cell (%d,%d)!", 01564 SimTime.TIME, FlocP[cellLoc], ix,iy ); WriteMsg( msgStr,True ); dynERRORnum++;} 01565 01566 /* now the P gain in sediment pore water with decomp - 90% goes to porewater, 10% to sfwat */ 01567 TP_SED_MINER[cellLoc] = 0.90 * FlocP_DECOMP[cellLoc] * CELL_SIZE ; 01568 /* calc P in sed water state variables (kg P) */ 01569 TP_SED_WT[cellLoc] = TP_SED_WT[cellLoc] + 01570 (TP_SED_MINER[cellLoc]) * DT; 01571 /* this is the active zone, where uptake, sorption, and mineralization take place */ 01572 TP_SED_WT_AZ[cellLoc] = TP_SED_WT_AZ[cellLoc] + 01573 (TP_SED_MINER[cellLoc]) * DT; 01574 01575 TP_SED_CONC[cellLoc] = (HYD_SED_WAT_VOL[cellLoc]>0.0) ? 01576 (TP_SED_WT[cellLoc] / HYD_SED_WAT_VOL[cellLoc]) : 01577 (0.0); 01578 TP_SEDWT_CONCACT[cellLoc] = ( HYD_DOM_ACTWAT_PRES[cellLoc] > 0.0) ? 01579 ( TP_SED_WT_AZ[cellLoc]/HYD_DOM_ACTWAT_VOL[cellLoc] ) : 01580 (TP_SED_CONC[cellLoc]); 01581 TP_SEDWT_CONCACTMG[cellLoc] = TP_SEDWT_CONCACT[cellLoc]*conv_kgTOg; /* g/m3==mg/L */ 01582 01583 01584 /* now the P gain in surface water with decomp - 90% goes to porewater, 10% to sfwat */ 01585 TP_SFWT_MINER[cellLoc] = 0.10*FlocP_DECOMP[cellLoc] * CELL_SIZE ; 01586 /* calc P in surface water state variable (kg P) */ 01587 TP_SF_WT[cellLoc] = TP_SF_WT[cellLoc] + 01588 (TP_SFWT_MINER[cellLoc]) * DT; 01589 TP_SFWT_CONC[cellLoc] = 01590 ( SFWT_VOL[cellLoc] > 0.0 ) ? 01591 ( TP_SF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : 01592 ( 0.0); /* used in P fluxes for mass balance */ 01593 TP_SFWT_CONC_MG[cellLoc] = 01594 ( SURFACE_WAT[cellLoc] > GP_DetentZ ) ? 01595 (TP_SFWT_CONC[cellLoc]*conv_kgTOg) : 01596 (0.0); /* g/m3==mg/L used for reporting and other modules to evaluate P conc when water is present */ 01597 } 01598 } 01599 } 01600 }
|
Here is the call graph for this function:
|
Net settling of TP loss (stand-alone).
Emulates the Everglades Water Quality Model net settling rate algorithm for TP loss. The only dynamics are phosphorus input from rain and loss from settling out of water column. This should be run WITHOUT running ecological modules:
Definition at line 1313 of file UnitMod.c. Referenced by call_cell_dyn(). 01314 { 01315 int ix, iy, cellLoc; 01316 float TPsettlRat, TP_settl_pot; 01317 01318 for(ix=1; ix<=s0; ix++) { 01319 for(iy=1; iy<=s1; iy++) { 01320 01321 if(ON_MAP[cellLoc= T(ix,iy)]) { 01322 /* concentration of P in surface water used in P fluxes for mass transfer (kgP/m3==gP/L) */ 01323 TP_SFWT_CONC[cellLoc] = 01324 ( SFWT_VOL[cellLoc] > 0.0 ) ? 01325 ( TP_SF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : 01326 ( 0.0); 01327 /* rainfall inputs to surface water P (m * m^2 * g/m^3 * kg/g == kg P) */ 01328 TP_FR_RAIN[cellLoc] = SF_WT_FROM_RAIN[cellLoc] 01329 *CELL_SIZE*GP_TP_IN_RAIN*0.001; 01330 /* TP settling rate calculation (m/d) = 0 if water depth (m) less than depth threshold parm */ 01331 if (SURFACE_WAT[cellLoc] > GP_WQMthresh ) { 01332 TPsettlRat = WQMsettlVel[cellLoc]; 01333 TP_settlDays[cellLoc]++; 01334 } 01335 else 01336 TPsettlRat = 0.0; 01337 01338 /* before we had to put in the day accumulator*/ 01339 /* TPsettlRat = ( SURFACE_WAT[cellLoc] > GP_WQMthresh ) ? */ 01340 /* (WQMsettlVel[cellLoc]) : 0.0; */ 01341 /* potential settling of particulate TP (m/d * m^2 * kg/m^3 = kg/d) */ 01342 TP_settl_pot = TPsettlRat * CELL_SIZE * TP_SFWT_CONC[cellLoc]; 01343 01344 /* like EWQM, shows mass bal error when -> TP_settl[cellLoc] = TP_settl_pot; */ 01345 01346 /* constrain settling to be no more than kg P available in water column */ 01347 TP_settl[cellLoc] = 01348 ( ( TP_settl_pot)*DT > TP_SF_WT[cellLoc] ) ? 01349 ( (TP_SF_WT[cellLoc])/DT ) : 01350 ( TP_settl_pot); 01351 /* calc P in surface water state variable (kg P) */ 01352 TP_SF_WT[cellLoc] = TP_SF_WT[cellLoc] + 01353 ( TP_FR_RAIN[cellLoc] - TP_settl[cellLoc] ) * DT; 01354 01355 /* this was in EWQM!!! (mass balance error!): if (TP_SF_WT[cellLoc]<0.0) TP_SF_WT[cellLoc]=0.0; */ 01356 01357 /* concentration of P in surface water used in P fluxes for mass transfer (kgP/m3==gP/L) */ 01358 TP_SFWT_CONC[cellLoc] = 01359 ( SFWT_VOL[cellLoc] > 0.0 ) ? 01360 ( TP_SF_WT[cellLoc]/SFWT_VOL[cellLoc] ) : 01361 ( 0.0); 01362 /* concentration used for reporting (e.g., in maps) when water is present. 01363 The hydraulic detention depth parm also used for all 01364 concentration reporting thresholds (currently 1 cm) 01365 */ 01366 TP_SFWT_CONC_MG[cellLoc] = 01367 ( SURFACE_WAT[cellLoc] > GP_DetentZ ) ? 01368 (TP_SFWT_CONC[cellLoc]*conv_kgTOg) : 01369 (0.0); /* g/m3==mg/L */ 01370 } 01371 } 01372 } 01373 }
|
|
Temperature control function for biology.
Definition at line 1613 of file UnitMod.c. 01614 { 01615 if (form == 1) { 01616 /* Lassiter et al. 1975, where c1 = curvature parm */ 01617 return (Exp(c1*(tempC-topt)) * pow(((tmax-tempC)/(tmax-topt)), (c1*(tmax-topt))) ); 01618 } 01619 else { 01620 /* Jorgensen 1976 */ 01621 return ( Exp(-2.3 * Abs((tempC-topt)/(topt-tmin))) ); 01622 } 01623 }
|
|
Initialize static spatial data.
Definition at line 1626 of file UnitMod.c. 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 }
|
|
Initialize dynamic spatial data.
Definition at line 1645 of file UnitMod.c. 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 }
|
|
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. References Cos, FMOD(), and SimTime. 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 */
|
Here is the call graph for this function:
|
Call to initialize the water managment canal network topology and data.
Definition at line 2007 of file UnitMod.c. Referenced by main(). 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 }
|
|
Call to initialize the habitat succession module.
Definition at line 2021 of file UnitMod.c. 02022 { 02023 HabSwitch_Init( ); 02024 02025 }
|
|
Calls to re-initialize Basin/Indicator-Region data.
Definition at line 2028 of file UnitMod.c. 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 }
|
|
Call to re-initialize canal storages.
Definition at line 2039 of file UnitMod.c. 02040 { 02041 usrErr0("Re-initializing Canal depths & constituent masses..."); 02042 CanalReInit(); 02043 usrErr("Done."); 02044 }
|
|
Generate output. Create output of spatial maps, point locations and debug data (if any)
Definition at line 2059 of file UnitMod.c. References ViewParm, and write_output(). Referenced by main(). 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 */
|
Here is the call graph for this function:
|
Acquire the model parameters that are global to the domain.
Definition at line 2414 of file UnitMod.c. References get_global_parm(), GP_alg_alkP_min, GP_ALG_C_TO_OM, GP_ALG_IC_MULT, GP_alg_light_ext_coef, GP_ALG_LIGHT_SAT, GP_ALG_PC, GP_alg_R_accel, GP_ALG_RC_MORT, GP_ALG_RC_MORT_DRY, GP_ALG_RC_PROD, GP_ALG_RC_RESP, GP_ALG_REF_MULT, GP_ALG_SHADE_FACTOR, GP_ALG_TEMP_OPT, GP_alg_uptake_coef, GP_AlgComp, GP_algMortDepth, GP_ALTIT, GP_C_ALG_KS_P, GP_C_ALG_threshTP, GP_calibDecomp, GP_calibET, GP_calibGWat, GP_DATUM_DISTANCE, GP_DetentZ, GP_dispLenRef, GP_dispParm, GP_DOM_decomp_coef, GP_DOM_DECOMP_POPT, GP_DOM_DECOMP_TOPT, GP_DOM_DECOMPRED, GP_DOM_RCDECOMP, GP_Floc_BD, GP_Floc_rcSoil, GP_FlocMax, GP_HYD_IC_SFWAT_ADD, GP_HYD_IC_UNSAT_ADD, GP_HYD_ICUNSATMOIST, GP_HYD_RCRECHG, GP_IC_BATHY_MULT, GP_IC_BulkD_MULT, GP_IC_DOM_BD_MULT, GP_IC_ELEV_MULT, GP_IC_TPtoSOIL_MULT, GP_IDW_pow, GP_LATDEG, GP_MAC_IC_MULT, GP_MAC_REFUG_MULT, GP_mac_uptake_coef, GP_mann_height_coef, GP_mannDepthPow, GP_mannHeadPow, GP_MinCheck, GP_NC_ALG_KS_P, GP_PO4toTP, GP_PO4toTPint, GP_settlVel, GP_SLRise, GP_SOLOMEGA, GP_sorbToTP, GP_TP_DIFFCOEF, GP_TP_DIFFDEPTH, GP_TP_ICSEDWAT, GP_TP_ICSFWAT, GP_TP_IN_RAIN, GP_TP_K_INTER, GP_TP_K_SLOPE, GP_TP_P_OM, GP_TPpart_thresh, and GP_WQMthresh. Referenced by read_model_parameters(). 02415 { 02416 02417 /* Geography, hydrology */ 02418 GP_SOLOMEGA = get_global_parm(s_parm_name, s_parm_relval,"GP_SOLOMEGA"); 02419 GP_ALTIT = get_global_parm(s_parm_name, s_parm_relval,"GP_ALTIT"); 02420 GP_LATDEG = get_global_parm(s_parm_name, s_parm_relval,"GP_LATDEG"); 02421 GP_mannDepthPow = get_global_parm(s_parm_name, s_parm_relval,"GP_mannDepthPow"); 02422 GP_mannHeadPow = get_global_parm(s_parm_name, s_parm_relval,"GP_mannHeadPow"); 02423 GP_calibGWat = get_global_parm(s_parm_name, s_parm_relval,"GP_calibGWat"); 02424 GP_IDW_pow = get_global_parm(s_parm_name, s_parm_relval,"GP_IDW_pow"); 02425 GP_calibET = get_global_parm(s_parm_name, s_parm_relval,"GP_calibET"); 02426 GP_DATUM_DISTANCE = get_global_parm(s_parm_name, s_parm_relval,"GP_DATUM_DISTANCE"); 02427 GP_HYD_IC_SFWAT_ADD = get_global_parm(s_parm_name, s_parm_relval,"GP_HYD_IC_SFWAT_ADD"); 02428 GP_HYD_IC_UNSAT_ADD = get_global_parm(s_parm_name, s_parm_relval,"GP_HYD_IC_UNSAT_ADD"); 02429 GP_HYD_RCRECHG = get_global_parm(s_parm_name, s_parm_relval,"GP_HYD_RCRECHG"); 02430 GP_HYD_ICUNSATMOIST = get_global_parm(s_parm_name, s_parm_relval,"GP_HYD_ICUNSATMOIST"); 02431 GP_DetentZ = get_global_parm(s_parm_name, s_parm_relval,"GP_DetentZ"); 02432 GP_MinCheck = get_global_parm(s_parm_name, s_parm_relval,"GP_MinCheck"); 02433 GP_SLRise = get_global_parm(s_parm_name, s_parm_relval,"GP_SLRise"); 02434 GP_dispLenRef = get_global_parm(s_parm_name, s_parm_relval,"GP_dispLenRef"); 02435 GP_dispParm = get_global_parm(s_parm_name, s_parm_relval,"GP_dispParm"); 02436 02437 /* Periphyton/Algae */ 02438 GP_ALG_IC_MULT = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_IC_MULT"); 02439 GP_alg_uptake_coef = get_global_parm(s_parm_name, s_parm_relval,"GP_alg_uptake_coef"); 02440 GP_ALG_SHADE_FACTOR = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_SHADE_FACTOR"); 02441 GP_algMortDepth = get_global_parm(s_parm_name, s_parm_relval,"GP_algMortDepth"); 02442 GP_ALG_RC_MORT_DRY = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_RC_MORT_DRY"); 02443 GP_ALG_RC_MORT = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_RC_MORT"); 02444 GP_ALG_RC_PROD = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_RC_PROD"); 02445 GP_ALG_RC_RESP = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_RC_RESP"); 02446 GP_alg_R_accel = get_global_parm(s_parm_name, s_parm_relval,"GP_alg_R_accel"); 02447 GP_AlgComp = get_global_parm(s_parm_name, s_parm_relval,"GP_AlgComp"); 02448 GP_ALG_REF_MULT = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_REF_MULT"); 02449 GP_NC_ALG_KS_P = get_global_parm(s_parm_name, s_parm_relval,"GP_NC_ALG_KS_P"); 02450 GP_alg_alkP_min = get_global_parm(s_parm_name, s_parm_relval,"GP_alg_alkP_min"); 02451 GP_C_ALG_KS_P = get_global_parm(s_parm_name, s_parm_relval,"GP_C_ALG_KS_P"); 02452 GP_ALG_TEMP_OPT = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_TEMP_OPT"); 02453 GP_C_ALG_threshTP = get_global_parm(s_parm_name, s_parm_relval,"GP_C_ALG_threshTP"); 02454 GP_ALG_C_TO_OM = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_C_TO_OM"); 02455 GP_alg_light_ext_coef = get_global_parm(s_parm_name, s_parm_relval,"GP_alg_light_ext_coef"); 02456 GP_ALG_LIGHT_SAT = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_LIGHT_SAT"); 02457 GP_ALG_PC = get_global_parm(s_parm_name, s_parm_relval,"GP_ALG_PC"); 02458 02459 /* Soil */ 02460 GP_DOM_RCDECOMP = get_global_parm(s_parm_name, s_parm_relval,"GP_DOM_RCDECOMP"); 02461 GP_DOM_DECOMPRED = get_global_parm(s_parm_name, s_parm_relval,"GP_DOM_DECOMPRED"); 02462 GP_calibDecomp = get_global_parm(s_parm_name, s_parm_relval,"GP_calibDecomp"); 02463 GP_DOM_decomp_coef = get_global_parm(s_parm_name, s_parm_relval,"GP_DOM_decomp_coef"); 02464 GP_DOM_DECOMP_POPT = get_global_parm(s_parm_name, s_parm_relval,"GP_DOM_DECOMP_POPT"); 02465 GP_DOM_DECOMP_TOPT = get_global_parm(s_parm_name, s_parm_relval,"GP_DOM_DECOMP_TOPT"); 02466 GP_sorbToTP = get_global_parm(s_parm_name, s_parm_relval,"GP_sorbToTP"); 02467 GP_IC_ELEV_MULT = get_global_parm(s_parm_name, s_parm_relval,"GP_IC_ELEV_MULT"); 02468 GP_IC_BATHY_MULT = get_global_parm(s_parm_name, s_parm_relval,"GP_IC_BATHY_MULT"); 02469 GP_IC_DOM_BD_MULT = get_global_parm(s_parm_name, s_parm_relval,"GP_IC_DOM_BD_MULT"); 02470 GP_IC_BulkD_MULT = get_global_parm(s_parm_name, s_parm_relval,"GP_IC_BulkD_MULT"); 02471 GP_IC_TPtoSOIL_MULT = get_global_parm(s_parm_name, s_parm_relval,"GP_IC_TPtoSOIL_MULT"); 02472 02473 /* Macrophytes */ 02474 GP_MAC_IC_MULT = get_global_parm(s_parm_name, s_parm_relval,"GP_MAC_IC_MULT"); 02475 GP_MAC_REFUG_MULT = get_global_parm(s_parm_name, s_parm_relval,"GP_MAC_REFUG_MULT"); 02476 GP_mac_uptake_coef = get_global_parm(s_parm_name, s_parm_relval,"GP_mac_uptake_coef"); 02477 GP_mann_height_coef = get_global_parm(s_parm_name, s_parm_relval,"GP_mann_height_coef"); 02478 02479 /* Floc */ 02480 GP_Floc_BD = get_global_parm(s_parm_name, s_parm_relval,"GP_Floc_BD"); 02481 GP_FlocMax = get_global_parm(s_parm_name, s_parm_relval,"GP_FlocMax"); 02482 GP_TP_P_OM = get_global_parm(s_parm_name, s_parm_relval,"GP_TP_P_OM"); 02483 GP_Floc_rcSoil = get_global_parm(s_parm_name, s_parm_relval,"GP_Floc_rcSoil"); 02484 02485 /* Phosphorus */ 02486 GP_TP_DIFFCOEF = get_global_parm(s_parm_name, s_parm_relval,"GP_TP_DIFFCOEF"); 02487 GP_TP_K_INTER = get_global_parm(s_parm_name, s_parm_relval,"GP_TP_K_INTER"); 02488 GP_TP_K_SLOPE = get_global_parm(s_parm_name, s_parm_relval,"GP_TP_K_SLOPE"); 02489 GP_WQMthresh = get_global_parm(s_parm_name, s_parm_relval,"GP_WQMthresh"); 02490 GP_PO4toTP = get_global_parm(s_parm_name, s_parm_relval,"GP_PO4toTP"); 02491 GP_TP_IN_RAIN = get_global_parm(s_parm_name, s_parm_relval,"GP_TP_IN_RAIN"); 02492 GP_PO4toTPint = get_global_parm(s_parm_name, s_parm_relval,"GP_PO4toTPint"); 02493 GP_TP_ICSFWAT = get_global_parm(s_parm_name, s_parm_relval,"GP_TP_ICSFWAT"); 02494 GP_TP_ICSEDWAT = get_global_parm(s_parm_name, s_parm_relval,"GP_TP_ICSEDWAT"); 02495 GP_TPpart_thresh = get_global_parm(s_parm_name, s_parm_relval,"GP_TPpart_thresh"); 02496 GP_TP_DIFFDEPTH = get_global_parm(s_parm_name, s_parm_relval,"GP_TP_DIFFDEPTH"); 02497 GP_settlVel = get_global_parm(s_parm_name, s_parm_relval,"GP_settlVel"); 02498 02499 }
|
Here is the call graph for this function:
|
Acquire the model parameters that are specific to different habitat types in the domain.
Definition at line 2348 of file UnitMod.c. References get_hab_parm(), HP_ALG_MAX, HP_DOM_AEROBTHIN, HP_DOM_MAXDEPTH, HP_FireInt, HP_FLOC_IC, HP_FLOC_IC_CTOOM, HP_FLOC_IC_PC, HP_HYD_POROSITY, HP_HYD_RCINFILT, HP_HYD_SPEC_YIELD, HP_MAC_CANOPDECOUP, HP_MAC_KSP, HP_MAC_LIGHTSAT, HP_MAC_MAXCANOPCOND, HP_MAC_MAXHT, HP_MAC_MAXLAI, HP_MAC_MAXROUGH, HP_MAC_MINROUGH, HP_MAC_SALIN_THRESH, HP_MAC_TEMPOPT, HP_MAC_TRANSLOC_RC, HP_MAC_WAT_TOLER, HP_NPHBIO_IC_CTOOM, HP_NPHBIO_IC_PC, HP_NPHBIO_MAX, HP_NPHBIO_ROOTDEPTH, HP_PHBIO_IC_CTOOM, HP_PHBIO_IC_PC, HP_PHBIO_MAX, HP_PHBIO_RCMORT, HP_PHBIO_RCNPP, HP_PhosHi, HP_PhosInt, HP_PhosLo, HP_SALT_ICSEDWAT, HP_SALT_ICSFWAT, HP_SfDepthHi, HP_SfDepthInt, HP_SfDepthLo, and HP_TP_CONC_GRAD. Referenced by read_model_parameters(). 02349 { 02350 02351 /* Periphyton/Algae */ 02352 HP_ALG_MAX = get_hab_parm(s_parm_name, s_parm_relval, "HP_ALG_MAX"); 02353 02354 /* Soil */ 02355 HP_DOM_MAXDEPTH = get_hab_parm(s_parm_name, s_parm_relval,"HP_DOM_MAXDEPTH"); 02356 HP_DOM_AEROBTHIN = get_hab_parm(s_parm_name, s_parm_relval,"HP_DOM_AEROBTHIN"); 02357 02358 /* Phosphorus */ 02359 HP_TP_CONC_GRAD = get_hab_parm(s_parm_name, s_parm_relval,"HP_TP_CONC_GRAD"); 02360 02361 /* Salt/tracer */ 02362 HP_SALT_ICSEDWAT = get_hab_parm(s_parm_name, s_parm_relval,"HP_SALT_ICSEDWAT"); 02363 HP_SALT_ICSFWAT = get_hab_parm(s_parm_name, s_parm_relval,"HP_SALT_ICSFWAT"); 02364 02365 /* Macrophytes */ 02366 HP_PHBIO_MAX = get_hab_parm(s_parm_name, s_parm_relval,"HP_PHBIO_MAX"); 02367 HP_NPHBIO_MAX = get_hab_parm(s_parm_name, s_parm_relval,"HP_NPHBIO_MAX"); 02368 HP_MAC_MAXHT = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_MAXHT"); 02369 HP_NPHBIO_ROOTDEPTH = get_hab_parm(s_parm_name, s_parm_relval,"HP_NPHBIO_ROOTDEPTH"); 02370 HP_MAC_MAXROUGH = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_MAXROUGH"); 02371 HP_MAC_MINROUGH = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_MINROUGH"); 02372 HP_MAC_MAXLAI = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_MAXLAI"); 02373 HP_MAC_MAXCANOPCOND = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_MAXCANOPCOND"); /* unused in ELMv2.2, 2.3 */ 02374 HP_MAC_CANOPDECOUP = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_CANOPDECOUP"); /* unused in ELMv2.2, 2.3 */ 02375 HP_MAC_TEMPOPT = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_TEMPOPT"); 02376 HP_MAC_LIGHTSAT = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_LIGHTSAT"); 02377 HP_MAC_KSP = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_KSP"); 02378 HP_PHBIO_RCNPP = get_hab_parm(s_parm_name, s_parm_relval,"HP_PHBIO_RCNPP"); 02379 HP_PHBIO_RCMORT = get_hab_parm(s_parm_name, s_parm_relval,"HP_PHBIO_RCMORT"); 02380 HP_MAC_WAT_TOLER = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_WAT_TOLER"); 02381 HP_MAC_SALIN_THRESH = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_SALIN_THRESH"); /* unused in ELMv2.2, 2.3 */ 02382 HP_PHBIO_IC_CTOOM = get_hab_parm(s_parm_name, s_parm_relval,"HP_PHBIO_IC_CTOOM"); 02383 HP_NPHBIO_IC_CTOOM = get_hab_parm(s_parm_name, s_parm_relval,"HP_NPHBIO_IC_CTOOM"); 02384 HP_PHBIO_IC_PC = get_hab_parm(s_parm_name, s_parm_relval,"HP_PHBIO_IC_PC"); 02385 HP_NPHBIO_IC_PC = get_hab_parm(s_parm_name, s_parm_relval,"HP_NPHBIO_IC_PC"); 02386 HP_MAC_TRANSLOC_RC = get_hab_parm(s_parm_name, s_parm_relval,"HP_MAC_TRANSLOC_RC"); 02387 02388 /* Hydrology */ 02389 HP_HYD_RCINFILT = get_hab_parm(s_parm_name, s_parm_relval,"HP_HYD_RCINFILT"); 02390 HP_HYD_SPEC_YIELD = get_hab_parm(s_parm_name, s_parm_relval,"HP_HYD_SPEC_YIELD"); 02391 HP_HYD_POROSITY = get_hab_parm(s_parm_name, s_parm_relval,"HP_HYD_POROSITY"); 02392 02393 /* Floc */ 02394 HP_FLOC_IC = get_hab_parm(s_parm_name, s_parm_relval,"HP_FLOC_IC"); 02395 HP_FLOC_IC_CTOOM = get_hab_parm(s_parm_name, s_parm_relval,"HP_FLOC_IC_CTOOM"); 02396 HP_FLOC_IC_PC = get_hab_parm(s_parm_name, s_parm_relval,"HP_FLOC_IC_PC"); 02397 02398 /* Habitat succession */ 02399 HP_SfDepthLo = get_hab_parm(s_parm_name, s_parm_relval,"HP_SfDepthLo"); 02400 HP_SfDepthHi = get_hab_parm(s_parm_name, s_parm_relval,"HP_SfDepthHi"); 02401 HP_SfDepthInt = get_hab_parm(s_parm_name, s_parm_relval,"HP_SfDepthInt"); 02402 HP_PhosLo = get_hab_parm(s_parm_name, s_parm_relval,"HP_PhosLo"); 02403 HP_PhosHi = get_hab_parm(s_parm_name, s_parm_relval,"HP_PhosHi"); 02404 HP_PhosInt = get_hab_parm(s_parm_name, s_parm_relval,"HP_PhosInt"); 02405 HP_FireInt = get_hab_parm(s_parm_name, s_parm_relval,"HP_FireInt"); 02406 02407 }
|
Here is the call graph for this function:
|
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. References read_map_dims(). 02505 { 02506 read_map_dims("Elevation"); 02507 }
|
Here is the call graph for this function:
|
Allocate memory. Allocate memory for model variables, and initialize (not context-specific) values. Definition at line 2514 of file UnitMod.c. References AIR_TEMP, ALG_INCID_LIGHT, ALG_LIGHT_CF, ALG_LIGHT_EXTINCT, ALG_REFUGE, ALG_SAT, ALG_TEMP_CF, ALG_TOT, ALG_WAT_CF, basn, Bathymetry, BCondFlow, boundcond_depth, boundcond_ETp, boundcond_rain, BulkD, C_ALG, C_ALG_AVAIL_MORT, C_ALG_GPP, C_ALG_GPP_P, C_ALG_MORT, C_ALG_MORT_P, C_ALG_MORT_POT, C_ALG_NPP, C_ALG_NUT_CF, C_ALG_P, C_ALG_PC, C_ALG_PCrep, C_ALG_PROD_CF, C_ALG_RESP, C_ALG_RESP_POT, DEPOS_ORG_MAT, DIM, DINdummy, DOM_BD, DOM_DECOMP, DOM_DECOMP_POT, DOM_FR_FLOC, DOM_fr_nphBio, DOM_P_OM, DOM_QUALITY_CF, DOM_SED_AEROB_Z, DOM_SED_ANAEROB_Z, DOM_TEMP_CF, DOM_Z, DOP, DOP_DECOMP, DOP_FLOC, DOP_nphBio, ELEVATION, FIREdummy, FLOC, FLOC_DECOMP, FLOC_DECOMP_POT, FLOC_DECOMP_QUAL_CF, FLOC_DEPO, FLOC_DEPO_POT, FLOC_FR_ALGAE, Floc_fr_phBio, FLOC_Z, FlocP, FlocP_DECOMP, FlocP_DEPO, FlocP_FR_ALGAE, FlocP_OM, FlocP_OMrep, FlocP_PhBio, H2O_TEMP, HAB, HP_ALG_MAX, HP_DOM_AEROBTHIN, HP_DOM_MAXDEPTH, HP_FireInt, HP_FLOC_IC, HP_FLOC_IC_CTOOM, HP_FLOC_IC_PC, HP_HYD_POROSITY, HP_HYD_RCINFILT, HP_HYD_SPEC_YIELD, HP_MAC_CANOPDECOUP, HP_MAC_KSP, HP_MAC_LIGHTSAT, HP_MAC_MAXCANOPCOND, HP_MAC_MAXHT, HP_MAC_MAXLAI, HP_MAC_MAXROUGH, HP_MAC_MINROUGH, HP_MAC_SALIN_THRESH, HP_MAC_TEMPOPT, HP_MAC_TRANSLOC_RC, HP_MAC_WAT_TOLER, HP_NPHBIO_IC_CTOOM, HP_NPHBIO_IC_PC, HP_NPHBIO_MAX, HP_NPHBIO_ROOTDEPTH, HP_PHBIO_IC_CTOOM, HP_PHBIO_IC_PC, HP_PHBIO_MAX, HP_PHBIO_RCMORT, HP_PHBIO_RCNPP, HP_PhosHi, HP_PhosInt, HP_PhosLo, HP_SALT_ICSEDWAT, HP_SALT_ICSFWAT, HP_SfDepthHi, HP_SfDepthInt, HP_SfDepthLo, HP_TP_CONC_GRAD, HYD_DOM_ACTWAT_PRES, HYD_DOM_ACTWAT_VOL, HYD_ET, HYD_EVAP_CALC, HYD_MANNINGS_N, HYD_RCCONDUCT, HYD_SAT_POT_TRANS, HYD_SED_WAT_VOL, HYD_TOT_POT_TRANSP, HYD_TRANSP, HYD_UNSAT_POT_TRANS, HYD_WATER_AVAIL, HydTotHd, init_pvar(), Inorg_Z, LAI_eff, MAC_HEIGHT, MAC_LAI, MAC_LIGHT_CF, MAC_MAX_BIO, MAC_NOPH_BIOMAS, mac_nph_CtoOM, mac_nph_OM, mac_nph_P, mac_nph_PC, mac_nph_PC_rep, MAC_NUT_CF, MAC_PH_BIOMAS, mac_ph_CtoOM, mac_ph_OM, mac_ph_P, mac_ph_PC, mac_ph_PC_rep, MAC_PROD_CF, MAC_REL_BIOM, MAC_SALT_CF, MAC_TEMP_CF, MAC_TOT_BIOM, MAC_WATER_AVAIL_CF, MAC_WATER_CF, nalloc(), NC_ALG, NC_ALG_AVAIL_MORT, NC_ALG_GPP, NC_ALG_GPP_P, NC_ALG_MORT, NC_ALG_MORT_P, NC_ALG_MORT_POT, NC_ALG_NPP, NC_ALG_NUT_CF, NC_ALG_P, NC_ALG_PC, NC_ALG_PCrep, NC_ALG_PROD_CF, NC_ALG_RESP, NC_ALG_RESP_POT, NPHBIO_AVAIL, NPHBIO_MORT, nphbio_mort_OM, nphbio_mort_P, NPHBIO_MORT_POT, NPHBIO_REFUGE, NPHBIO_SAT, nphbio_transl_OM, nphbio_transl_P, NPHBIO_TRANSLOC, NPHBIO_TRANSLOC_POT, ON_MAP, P_SUM_CELL, PHBIO_AVAIL, PHBIO_MORT, phbio_mort_OM, phbio_mort_P, PHBIO_MORT_POT, PHBIO_NPP, phbio_npp_OM, phbio_npp_P, PHBIO_REFUGE, PHBIO_SAT, phbio_transl_OM, phbio_transl_P, PHBIO_TRANSLOC, PHBIO_TRANSLOC_POT, s0, s1, SAL_SED_WT, SAL_SF_WT, SAL_SF_WT_mb, SALT_SED_TO_SF_FLOW, SALT_SED_WT, SALT_SFWAT_DOWNFL, SALT_SFWAT_DOWNFL_POT, SALT_SURF_WT, SAT_TO_UNSAT_FL, SAT_VS_UNSAT, SAT_WATER, SAT_WT_HEAD, SAT_WT_RECHG, SAT_WT_TRANSP, SED_ELEV, SED_INACT_Z, SF_WT_EVAP, SF_WT_FROM_RAIN, SF_WT_INFILTRATION, SF_WT_POT_INF, SF_WT_TO_SAT_DOWNFLOW, SFWT_VOL, soil_MOIST_CF, SOLRAD274, SOLRADGRD, SURFACE_WAT, TP_Act_to_Tot, TP_Act_to_TotRep, TP_DNFLOW, TP_DNFLOW_POT, TP_FR_RAIN, TP_K, TP_SED_CONC, TP_SED_MINER, TP_SED_WT, TP_SED_WT_AZ, TP_SEDWT_CONCACT, TP_SEDWT_CONCACTMG, TP_SEDWT_UPTAKE, TP_settl, TP_settlDays, TP_SF_WT, TP_SFWT_CONC, TP_SFWT_CONC_MG, TP_SFWT_MINER, TP_SFWT_UPTAK, TP_SORB, TP_SORB_POT, TP_SORBCONC, TP_SORBCONC_rep, TP_SORBTION, TP_UPFLOW, TP_UPFLOW_POT, TPtoSOIL, TPtoSOIL_rep, TPtoVOL, TPtoVOL_rep, UNSAT_AVAIL, UNSAT_CAP, UNSAT_DEPTH, UNSAT_HYD_COND_CF, UNSAT_MOIST_PRP, UNSAT_PERC, UNSAT_TO_SAT_FL, UNSAT_TRANSP, UNSAT_WATER, UNSAT_WT_POT, usrErr(), usrErr0(), and WQMsettlVel. 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 }
|
Here is the call graph for this function:
|
Time series interplator, data set 7. The graphX functions are generic time-series interpolator; graph7 is interpolator for data set g7 (determining unsaturated infiltration control function).
Definition at line 3047 of file UnitMod.c. References g7. 03048 { 03049 float s; 03050 int ig=0, Np=10; 03057 while(1) { 03058 if (x <= g7[ig][0]) { if(ig>0) ig=ig-1; else return(g7[0][1+y]);} 03059 else if (x > g7[ig][0] && x <= g7[ig+1][0]) { 03060 s = (g7[ig+1][1+y]-g7[ig][1+y])/ 03061 (g7[ig+1][0]-g7[ig][0]); 03062 return(s * (x-g7[ig][0]) + g7[ig][1+y]); } 03063 else if (x > g7[ig+1][0]) { if(ig<Np) ig=ig+1; else return(g7[Np][1+y]);} 03064 } 03065 }
|
|
Time series interplator, data set 8. The graphX functions are generic time-series interpolator; graph8 is interpolator for data set g8 (determining water availability to plants).
Definition at line 3074 of file UnitMod.c. References g8. 03075 { 03076 float s; 03077 int ig=0, Np=10; 03084 while(1) { 03085 if (x <= g8[ig][0]) { if(ig>0) ig=ig-1; else return(g8[0][1+y]);} 03086 else if (x > g8[ig][0] && x <= g8[ig+1][0]) { 03087 s = (g8[ig+1][1+y]-g8[ig][1+y])/ 03088 (g8[ig+1][0]-g8[ig][0]); 03089 return(s * (x-g8[ig][0]) + g8[ig][1+y]); } 03090 else if (x > g8[ig+1][0]) { if(ig<Np) ig=ig+1; else return(g8[Np][1+y]);} 03091 } 03092 }
|
|
Transfers habitat-specific parameters into data struct, allocate memory.
Definition at line 23 of file Success.c. 00024 { 00025 int ii; 00026 00027 /* put these habitat-specific parameters into a concise data struct for use here */ 00028 for( ii = 0; ii < habNumTot; ii++) { 00029 Habi[ii].Water.Llo = HP_SfDepthLo[ii+1]; 00030 Habi[ii].Water.Lhi = HP_SfDepthHi[ii+1]; 00031 Habi[ii].Water.Pin = HP_SfDepthInt[ii+1]; 00032 Habi[ii].Nutrient.Llo = HP_PhosLo[ii+1]; 00033 Habi[ii].Nutrient.Lhi = HP_PhosHi[ii+1]; 00034 Habi[ii].Nutrient.Pin = HP_PhosInt[ii+1]; 00035 Habi[ii].PFin = HP_FireInt[ii+1]; 00036 } 00037 00038 alloc_hab_hist( ); 00039 sprintf (msgStr, "Succession ON, module OK for %d habitats...", ii ); usrErr(msgStr); WriteMsg(msgStr,1); 00040 00041 return; 00042 }
|
|
Switches habitats (the option that is currently used). Returns the number of habitat to switch to based on the length of the weekly (or other) averaged period of favorable conditions. In this case the period of habitat favorable conditions is calculated as the number of weeks (or other time intervals) during which the habitat conditions matched the specified for a period longer than the given one - SW_TIME_TH. The switching occurs as soon as the number of such successfull weeks exceeds the time specified in Pin
Definition at line 60 of file Success.c. Referenced by cell_dyn1(). 00061 { 00062 int StateW, StateN, i; 00063 int HabW[MAX_NHAB], HabN[MAX_NHAB], DW, DN; 00064 int cell = T(ix,iy); 00065 int hab = HAB[cell]; /* current habitat in the cell */ 00066 00067 /* define the habitat type that matches the existing water conditions */ 00068 00069 /* HabHist is an array of integers : nnNssS, where nn are the two digits for the number of 00070 weeks being in the nutrient favorable conditions, N the number of days in those conditions 00071 during the current week; similarly ss are the two digits for the number of weeks in the 00072 water level favorable conditions and S is the number of days during the current week in 00073 that state. The switching occurs when both of these histories exceed the habitat specific 00074 periods Pin. 00075 */ 00076 for ( i = 0; i < habNumTot; i++ ) 00077 { 00078 DW = HabHist[cell*habNumTot +i]%10; 00079 HabW[i] = (HabHist[cell*habNumTot +i]/10)%100; 00080 DN = (HabHist[cell*habNumTot +i]/1000)%10; 00081 HabN[i] = HabHist[cell*habNumTot +i]/10000; 00082 00083 /* when the averaging time elapses, if #favorable days exceeds a threshold (using 4 for 7 day AV_PER), increment the period (weeks) history */ 00084 if ((int)SimTime.TIME%AV_PER == 0) 00085 { 00086 if (DW > SW_TIME_TH_W) HabHist[cell*habNumTot +i] = HabHist[cell*habNumTot +i] - DW + 100; 00087 else HabHist[cell*habNumTot +i] = 0; 00088 if (DN > SW_TIME_TH_N) HabHist[cell*habNumTot +i] = HabHist[cell*habNumTot +i] - DN*1000 + 10000; 00089 else HabHist[cell*habNumTot +i] = 0; 00090 } 00091 00092 /* check what habitat type the existing conditions match; increment the day# if conditions are favorable */ 00093 if ( InHab (Water[cell], Habi[i].Water) ) HabHist[cell*habNumTot + i]++; 00094 if ( InHab (Nutrient[cell]*conv_kgTOmg, Habi[i].Nutrient) ) 00095 HabHist[cell*habNumTot + i] = HabHist[cell*habNumTot + i] + 1000; 00096 } 00097 00098 /* check if the historical conditions for switching hold */ 00099 for ( i = 0; i < habNumTot; i++ ) 00100 if ( HabW[i] >= Habi[i].Water.Pin && HabN[i] >= Habi[i].Nutrient.Pin ) 00101 { HabHist[cell*habNumTot +i] = 0; 00102 return (i+1); /* returns new hab, HAB[] is offset by 1 from these array IDs */ 00103 } 00104 00105 return hab; 00106 }
|
|
Runs the water management network. Invoke the calls to water control structure flows and the canal-cell interactions.
Definition at line 306 of file WatMgmt.c. References Chan::area, Chan::basin, CanalOutFile, CanalOutFile_P, CanalOutFile_S, canDebugFile, canPrint, canstep, Chan_list, simTime::da, debug, Flows_in_Structures(), FluxChannel(), FMOD(), simTime::IsBudgEnd, simTime::IsSimulationEnd, simTime::mo, N_c_iter, Chan::P, Chan::P_con, printchan, Chan::S, Chan::S_con, SimTime, Chan::sumHistIn, Chan::sumHistOut, Chan::sumRuleIn, Chan::sumRuleOut, TOT_P_CAN, TOT_S_CAN, TOT_VOL_CAN, Chan::wat_depth, Chan::width, WstructOutFile, WstructOutFile_P, WstructOutFile_S, and simTime::yr. 00310 { int i; 00311 float CH_vol; 00312 00313 if ( canPrint && (( N_c_iter++ % hyd_iter ) == 0.0) ) { 00314 if (SensiOn) { 00315 printchan = (SimTime.IsSimulationEnd) ? (1) : (0); /* flag to indicate to print canal/struct data */ 00316 } 00317 else printchan = 1; 00318 } 00319 else printchan = 0; 00320 00321 if (printchan == 1) { 00322 00323 fprintf( WstructOutFile, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 00324 fprintf( WstructOutFile_P, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 00325 /* fprintf( WstructOutFile_N, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); */ 00326 fprintf( WstructOutFile_S, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 00327 00328 fprintf (CanalOutFile, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 00329 fprintf (CanalOutFile_P, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 00330 /* fprintf (CanalOutFile_N, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); */ 00331 fprintf (CanalOutFile_S, "\n%d/%d/%d\t",SimTime.yr[0],SimTime.mo[0],SimTime.da[0] ); 00332 } 00333 00334 00335 for ( i = 0; i < num_chan; i++ ) 00336 { /* set the sum of historical/other-data flows to/from a canal per iteration to 0 */ 00337 Chan_list[i]->sumHistIn = Chan_list[i]->sumHistOut = 0.0; 00338 Chan_list[i]->sumRuleIn = Chan_list[i]->sumRuleOut = 0.0; 00339 } 00340 00341 /* calculate flows through water control structures */ 00342 Flows_in_Structures ( SWH, Elevation, MC, NA, PA, SA ); 00343 00344 /* output header for canal-cell flux output canal debug file, at relatively high debug levels (writes a LOT of stuff) */ 00345 if( debug > 3 ) 00346 { 00347 fprintf( canDebugFile, "N%3d WatDepth Pconc Sconc flux_S flux_G flux_L Qin Qout #_iter Area error \n", N_c_iter ); 00348 00349 } 00350 00351 /* Flux the water along a canal using the relaxation procedure */ 00352 00353 for( i = 0; i < num_chan; i++ ) 00354 if (Chan_list[i]->width > 0) /* a neg width canal is skipped */ 00355 00356 { 00357 FluxChannel ( i, SWH, Elevation, MC, GW, poros, GWcond, NA, PA, SA, GNA, GPA, GSA, Unsat, sp_yield ); 00358 /* calculate total canal volume after canal fluxes */ 00359 CH_vol = Chan_list[i]->area*Chan_list[i]->wat_depth; 00360 00361 /* sum the storages on iteration that performs budget checks */ 00362 if ( !( FMOD(N_c_iter,(1/canstep) )) && (SimTime.IsBudgEnd ) ) { 00363 TOT_VOL_CAN[Chan_list[i]->basin] += CH_vol; 00364 TOT_VOL_CAN[0] += CH_vol; 00365 TOT_P_CAN[Chan_list[i]->basin] += Chan_list[i]->P; 00366 TOT_P_CAN[0] += Chan_list[i]->P; 00367 TOT_S_CAN[Chan_list[i]->basin] += Chan_list[i]->S; 00368 TOT_S_CAN[0] += Chan_list[i]->S; 00369 } 00370 00371 00372 if ( printchan ) 00373 { 00374 /* report N&P concentration in mg/L (kg/m3==g/L * 1000 = mg/L) */ 00375 Chan_list[i]->P_con = (CH_vol > 0) ? (Chan_list[i]->P/CH_vol*1000.0) : 0.0; 00376 /* Chan_list[i]->N_con = (CH_vol > 0) ? (Chan_list[i]->N/CH_vol*1000.0) : 0.0; */ 00377 Chan_list[i]->S_con = (CH_vol > 0) ? (Chan_list[i]->S/CH_vol ) : 0.0; 00378 00379 /* v2.2 increased decimal places in output (from 6.3f to 7.4f) */ 00380 fprintf( CanalOutFile, "%6.2f\t", Chan_list[i]->wat_depth ); 00381 fprintf( CanalOutFile_P, "%7.4f\t", Chan_list[i]->P_con ); 00382 /* fprintf( CanalOutFile_N, "%7.4f\t", Chan_list[i]->N_con ); */ 00383 fprintf( CanalOutFile_S, "%7.4f\t", Chan_list[i]->S_con ); 00384 } 00385 } 00386 if ( printchan ) 00387 { 00388 fflush(CanalOutFile); 00389 fflush(CanalOutFile_P); 00390 /* fflush(CanalOutFile_N); */ 00391 fflush(CanalOutFile_S); 00392 } 00393 00394 return; 00395 }
|
Here is the call graph for this function:
|
Initialize the water managment network topology. Initialize/configure the network of canals/levees and and water control structures. The canal information stored in the global array Chan_list
Definition at line 72 of file WatMgmt.c. References Chan::area, CanalOutFile, CanalOutFile_P, CanalOutFile_S, canDebugFile, Chan_list, ChanInFile, Channel_configure(), debug, H_OPSYS, Chan::ic_depth, Chan::ic_N_con, Chan::ic_P_con, Chan::ic_S_con, init_pvar(), MCopen, modelFileName, modelName, modelVers, Chan::N, nalloc(), Structure::next_in_list, ON_MAP, OutputPath, Chan::P, ProjName, ReadChanStruct(), ReadStructures(), Chan::S, s0, s1, Structure::S_nam, SimAlt, SimModif, structs, T, usrErr(), Chan::width, WstructOutFile, WstructOutFile_P, and WstructOutFile_S. 00074 { struct Structure *structs; 00075 int i,j; 00076 char filename[30]; 00077 00078 sprintf(filename,"CanalData"); 00079 00080 /* Input the canals geometry file, return pointer to first vector */ 00081 /* Configure the canals, marking the cells that interact with them */ 00082 /* and storing the pointers to the cells for each of the canals in Chan_list array */ 00083 Channel_configure(elev, ReadChanStruct (filename)); 00084 00085 for( i = 0; i < num_chan; i++ ) 00086 { 00087 Chan_list[i]->P = Chan_list[i]->ic_P_con * Chan_list[i]->area * Chan_list[i]->ic_depth; /* kg/m3 * m2 * m */ 00088 Chan_list[i]->N = Chan_list[i]->ic_N_con * Chan_list[i]->area * Chan_list[i]->ic_depth; /* kg/m3 * m2 * m */ 00089 Chan_list[i]->S = Chan_list[i]->ic_S_con * Chan_list[i]->area * Chan_list[i]->ic_depth; /* kg/m3 * m2 * m */ 00090 } 00091 00092 usrErr ("\tCanal geometry configured OK"); 00093 00094 /* Read data on the water control structures, return pointer to the first structure */ 00095 ReadStructures (filename, baseDatum); 00096 00097 ON_MAP[T(2,2)] = 0; 00098 00099 MCopen = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MCopen"); /* open-water manning's coef, used in structure cell-cell bridge flow */ 00100 init_pvar(MCopen,NULL,'f',0.05); /* this is a hard-wired parameter - but do not do anything much with it now for the bridge flows */ 00101 00102 00103 if ( debug > 0 ) /* Output the canal/levee modifications to ON_MAP */ 00104 { 00105 sprintf( modelFileName, "%s/%s/Output/Debug/ON_MAP_CANAL.txt", OutputPath, ProjName ); 00106 00107 00108 if ( ( ChanInFile = fopen( modelFileName, "w" ) ) == NULL ) 00109 { 00110 printf( "Can't open the %s canal/levee debug file!\n", modelFileName ); 00111 exit(-1) ; 00112 } 00113 fprintf ( ChanInFile, "ROWS=%d\nCOLUMNS=%d\nFORMAT=text\nINFO=\"Debug data: Overland flow restrictions due to levees. \"\nMISSING=0\n", s0, s1 ); 00114 00115 for ( i = 1; i <= s0 ; i++ ) 00116 { for ( j = 1 ; j <= s1 ; j++ ) 00117 fprintf( ChanInFile, "%4d\t", ON_MAP[T(i,j)]) ; 00118 fprintf ( ChanInFile, "\n" ); 00119 } 00120 fclose( ChanInFile ) ; 00121 } 00122 00123 00124 /* Open file for writing structure flows */ 00125 { if(H_OPSYS==UNIX) 00126 sprintf( modelFileName, "%s/%s/Output/Canal/structsOut", OutputPath, ProjName ); 00127 else sprintf( modelFileName, "%s%s:Output:structsOut", OutputPath, ProjName ); 00128 } 00129 00130 /* Open file to print structure flows to */ 00131 if ( ( WstructOutFile = fopen( modelFileName, "w" ) ) == NULL ) 00132 { 00133 printf( "Can't open %s file!\n", modelFileName ); 00134 exit(-1) ; 00135 } 00136 /* Print The Header Line For This File */ 00137 fprintf ( WstructOutFile, 00138 "%s %s %s %s scenario: Sum of water flows at structures (ft^3/sec)\n Date\t", &modelName, &modelVers, &SimAlt, &SimModif ); 00139 structs = struct_first; 00140 while ( structs != NULL ) 00141 { fprintf( WstructOutFile, "%7s\t", structs->S_nam); 00142 structs = structs->next_in_list; 00143 } 00144 00145 /* Open file for writing structure P concs */ 00146 { if(H_OPSYS==UNIX) 00147 sprintf( modelFileName, "%s/%s/Output/Canal/structsOut_P", OutputPath, ProjName ); 00148 else sprintf( modelFileName, "%s%s:Output:structsOut_P", OutputPath, ProjName ); 00149 } 00150 00151 /* Open file to print structure flows to */ 00152 if ( ( WstructOutFile_P = fopen( modelFileName, "w" ) ) == NULL ) 00153 { 00154 printf( "Can't open %s file!\n", modelFileName ); 00155 exit(-1) ; 00156 } 00157 /* Print The Header Line For This File */ 00158 fprintf ( WstructOutFile_P, 00159 "%s %s %s %s scenario: Flow weighted mean TP conc at structures ( mg/L) \n Date\t", &modelName, &modelVers, &SimAlt, &SimModif ); 00160 structs = struct_first; 00161 while ( structs != NULL ) 00162 { fprintf( WstructOutFile_P, "%7s\t", structs->S_nam); 00163 structs = structs->next_in_list; 00164 } 00165 00166 /* Open file for writing structure Salin concs */ 00167 { if(H_OPSYS==UNIX) 00168 sprintf( modelFileName, "%s/%s/Output/Canal/structsOut_S", OutputPath, ProjName ); 00169 else sprintf( modelFileName, "%s%s:Output:structsOut_S", OutputPath, ProjName ); 00170 } 00171 00172 /* Open file to print structure flows to */ 00173 if ( ( WstructOutFile_S = fopen( modelFileName, "w" ) ) == NULL ) 00174 { 00175 printf( "Can't open %s file!\n", modelFileName ); 00176 exit(-1) ; 00177 } 00178 /* Print The Header Line For This File */ 00179 fprintf ( WstructOutFile_S, 00180 "%s %s %s %s scenario: Flow weighted mean tracer concentration at structures ( g/L) \n Date\t", &modelName, &modelVers, &SimAlt, &SimModif ); 00181 structs = struct_first; 00182 while ( structs != NULL ) 00183 { fprintf( WstructOutFile_S, "%7s\t", structs->S_nam); 00184 structs = structs->next_in_list; 00185 } 00186 00187 /****/ 00188 00189 /* Open file to print canal stage info to */ 00190 { if(H_OPSYS==UNIX) 00191 sprintf( modelFileName, "%s/%s/Output/Canal/CanalOut", OutputPath, ProjName ); 00192 else sprintf( modelFileName, "%s%s:Output:CanalOut", OutputPath, ProjName ); 00193 } 00194 00195 if ( ( CanalOutFile = fopen( modelFileName, "w" ) ) == NULL ) 00196 { 00197 printf( "Can't open %s file!\n", modelFileName ); 00198 exit(-1) ; 00199 } 00200 00201 fprintf ( CanalOutFile, "%s %s %s %s scenario: Instantaneous water depth (meters, from bottom of canal) in canal Reaches\n Date\t", &modelName, &modelVers, &SimAlt, &SimModif ); /* print the header line for this file */ 00202 /* channels with negative widths are reserved for new canals */ 00203 /* v2.2 put a "R_" prefix in front of the canal ID# */ 00204 for( i = 0; i < num_chan; i++ ) {if (Chan_list[i]->width > 0) fprintf ( CanalOutFile, "R_%d\t",Chan_list[i]->number);} 00205 00206 00207 /* Open file to print canal phosph info to */ 00208 { if(H_OPSYS==UNIX) 00209 sprintf( modelFileName, "%s/%s/Output/Canal/CanalOut_P", OutputPath, ProjName ); 00210 else sprintf( modelFileName, "%s%s:Output:CanalOut_P", OutputPath, ProjName ); 00211 } 00212 00213 if ( ( CanalOutFile_P = fopen( modelFileName, "w" ) ) == NULL ) 00214 { 00215 printf( "Can't open %s file!\n", modelFileName ); 00216 exit(-1) ; 00217 } 00218 00219 fprintf ( CanalOutFile_P, "%s %s %s %s scenario: Instantaneous TP conc (mg/L) in canal Reaches\n Date\t", &modelName, &modelVers, &SimAlt, &SimModif ); /* print the header line for this file */ 00220 /* v2.2 put a "R_" prefix in front of the canal ID# */ 00221 for( i = 0; i < num_chan; i++ ) {if (Chan_list[i]->width > 0) fprintf ( CanalOutFile_P, "R_%d\t",Chan_list[i]->number);} 00222 00223 /* Open file to print canal salinity/tracer info to */ 00224 { if(H_OPSYS==UNIX) 00225 sprintf( modelFileName, "%s/%s/Output/Canal/CanalOut_S", OutputPath, ProjName ); 00226 else sprintf( modelFileName, "%s%s:Output:CanalOut_S", OutputPath, ProjName ); 00227 } 00228 00229 if ( ( CanalOutFile_S = fopen( modelFileName, "w" ) ) == NULL ) 00230 { 00231 printf( "Can't open %s file!\n", modelFileName ); 00232 exit(-1) ; 00233 } 00234 00235 fprintf ( CanalOutFile_S, "%s %s %s %s scenario: Instantaneous tracer conc (g/L) in canal Reaches\n Date\t", &modelName, &modelVers, &SimAlt, &SimModif ); /* print the header line for this file */ 00236 /* v2.2 put a "R_" prefix in front of the canal ID# */ 00237 for( i = 0; i < num_chan; i++ ) {if (Chan_list[i]->width > 0) fprintf ( CanalOutFile_S, "R_%d\t",Chan_list[i]->number);} 00238 00239 00240 00241 /* Open file for canal-cell flux debugging purposes */ 00242 if( debug > 0 ) 00243 { 00244 if(H_OPSYS==UNIX) 00245 sprintf( modelFileName, "%s/%s/Output/Debug/Can_debug", OutputPath, ProjName ); 00246 else sprintf( modelFileName, "%s%s:Output:Can_debug", OutputPath, ProjName ); 00247 00248 00249 /* Open file for debug */ 00250 if ( ( canDebugFile = fopen( modelFileName, "w" ) ) == NULL ) 00251 { 00252 printf( "Can't open %s file!\n", modelFileName ); 00253 exit(-1) ; 00254 } 00255 00256 fprintf ( canDebugFile, "Depending on level of the debug parameter, data on canal-cell flows printed here. \n" ); /* v2.5 made use of this file pointer */ 00257 fflush(canDebugFile); 00258 00259 } 00260 00261 return; 00262 00263 }
|
Here is the call graph for this function:
|
Re-initialize the depths and concentrations in canals under the Positional Analysis mode.
Definition at line 268 of file WatMgmt.c. References Chan::area, Chan_list, Chan::ic_depth, Chan::ic_N_con, Chan::ic_P_con, Chan::ic_S_con, Chan::N, Chan::P, Chan::S, and Chan::wat_depth. 00269 { 00270 int i; 00271 for( i = 0; i < num_chan; i++ ) 00272 00273 { 00274 Chan_list[i]->wat_depth = Chan_list[i]->ic_depth; 00275 Chan_list[i]->P = Chan_list[i]->ic_P_con * Chan_list[i]->area * Chan_list[i]->ic_depth; /* kg/m3 * m2 * m */ 00276 Chan_list[i]->N = Chan_list[i]->ic_N_con * Chan_list[i]->area * Chan_list[i]->ic_depth; /* kg/m3 * m2 * m */ 00277 Chan_list[i]->S = Chan_list[i]->ic_S_con * Chan_list[i]->area * Chan_list[i]->ic_depth; /* kg/m3 * m2 * m */ 00278 00279 } 00280 }
|
|
Get an integer following a specific string.
Definition at line 1657 of file Driver_Utilities.c. References scan_forward(), and UCHAR. Referenced by get_parmf(). 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 }
|
Here is the call graph for this function:
|
Establish the number of rows and columns of the model. Read the map dimensions of the global model array, establishing #rows=s0 and #columns=s1
Definition at line 892 of file Driver_Utilities.c. References broadcastInt(), debug, Exit(), gbl_size, Lprocnum, modelFileName, ModelPath, msgStr, ProjName, s0, s1, scan_forward(), usrErr(), and WriteMsg(). Referenced by get_map_dims(). 00893 { 00894 FILE *file; 00895 00896 if (debug>3) { sprintf(msgStr,"Getting map dims: %s",filename); usrErr(msgStr);} 00897 if(Lprocnum == 1) { 00898 sprintf(modelFileName,"%s/%s/Data/Map_head/%s",ModelPath,ProjName,filename); 00899 file = fopen(modelFileName,"r"); 00900 if(file==NULL) { 00901 fprintf(stderr,"Unable to open map header file %s.\n",modelFileName); 00902 fflush(stderr); 00903 Exit(0); 00904 } 00905 scan_forward(file,"cols:"); 00906 fscanf(file,"%d",&gbl_size[1]); 00907 sprintf(msgStr,"cols = %d\n",gbl_size[1]); WriteMsg(msgStr,1); 00908 scan_forward(file,"rows:"); 00909 fscanf(file,"%d",&gbl_size[0]); 00910 sprintf(msgStr,"rows = %d\n",gbl_size[0]); WriteMsg(msgStr,1); 00911 fclose(file); 00912 } 00913 broadcastInt(gbl_size); /* does nothing in serial (non-parallel) implementation */ 00914 broadcastInt(gbl_size+1); /* does nothing in serial (non-parallel) implementation */ 00915 s0 = gbl_size[0]; 00916 s1 = gbl_size[1]; 00917 }
|
Here is the call graph for this function:
|
Determine which functions to call for model output.
Definition at line 408 of file Driver_Utilities.c. References calc_maxmin(), debug, point3D::format, getPrecision(), viewParm::mapType, msgStr, viewParm::nPoints, scale1::o, Point3D, viewParm::points, print_loc_ave(), print_point(), quick_look(), scale1::s, viewParm::scale, point3D::type, ViewParm, write_map_file(), WriteMsg(), point3D::x, point3D::y, and point3D::z. 00410 { 00411 int i; Point3D point; 00412 00413 00414 if(vp->mapType != 'N' ) { 00415 write_map_file((char*)filename,Map,Mtype,index,vp->scale.s,vp->scale.o,getPrecision(vp),vp->mapType); 00416 if (debug > 3) calc_maxmin(vp,Map,Mtype,(char*)filename,step); 00417 } 00418 for(i=0; i< (vp->nPoints); i++ ) { 00419 point = vp->points[i]; 00420 if (debug > 3) { sprintf(msgStr,"\nwriting Out: %s(%d): %c(), index = %d, step=%d\n", filename, i, point.type, index, step ); 00421 WriteMsg(msgStr,1); 00422 } 00423 00424 switch( point.type ) { 00425 case 'm': case 'M': calc_maxmin( vp,Map,Mtype,(char*)filename,step); break; 00426 case 'w': quick_look( Map,(char*) filename, Mtype, point.x, point.y, point.z, point.format ); break; 00427 case 'a': case 's': case 'A': case 'S': print_loc_ave( &point, Map, Mtype, (char*)filename, step ); break; 00428 case 'p': print_point( vp, Map, Mtype, (char*)filename, step, i ); break; 00429 } 00430 } 00431 }
|
Here is the call graph for this function:
|
Get a character following a specific string.
Definition at line 1619 of file Driver_Utilities.c. References scan_forward(), and UCHAR. 01620 { 01621 int test; 01622 UCHAR iEx=0; 01623 if(lString) scan_forward(inFile,lString); 01624 test = fscanf(inFile,"%c",cValPtr); 01625 if(test != 1) { 01626 fprintf(stderr,"Read Error (%d):",test); 01627 if(lString) fprintf(stderr,"%s\n",lString); 01628 iEx = 1; 01629 *cValPtr = '\0'; 01630 } 01631 if (iEx) exit(0); 01632 }
|
Here is the call graph for this function:
|
Initialize a variable to a value.
Definition at line 925 of file Driver_Utilities.c. 00926 { 00927 int i0, i1; 00928 00929 switch(Mtype) { 00930 case 'b' : /* added double for (non-map) basin (b) array budget calcs */ 00931 for(i0=0; i0<=numBasn; i0++) { 00932 ((double*)Map)[i0] = iv; 00933 } 00934 break; 00935 case 'l' : /* added double (l == letter "ell" ) for map arrays */ 00936 for(i0=0; i0<=s0+1; i0++) 00937 for(i1=0; i1<=s1+1; i1++) { 00938 if(mask==NULL) ((double*)Map)[T(i0,i1)] = iv; 00939 else if ( mask[T(i0,i1)] == 0 ) ((double*)Map)[T(i0,i1)] = 0; 00940 else ((double*)Map)[T(i0,i1)] = iv; 00941 } 00942 break; 00943 case 'f' : 00944 for(i0=0; i0<=s0+1; i0++) 00945 for(i1=0; i1<=s1+1; i1++) { 00946 if(mask==NULL) ((float*)Map)[T(i0,i1)] = iv; 00947 else if ( mask[T(i0,i1)] == 0 ) ((float*)Map)[T(i0,i1)] = 0; 00948 else ((float*)Map)[T(i0,i1)] = iv; 00949 } 00950 break; 00951 case 'i' : case 'd' : 00952 for(i0=0; i0<=s0+1; i0++) 00953 for(i1=0; i1<=s1+1; i1++) { 00954 if(mask==NULL) ((int*)Map)[T(i0,i1)] = (int)iv; 00955 else if ( mask[T(i0,i1)] == 0 ) ((int*)Map)[T(i0,i1)] = 0; 00956 else ((int*)Map)[T(i0,i1)] = (int)iv; 00957 } 00958 break; 00959 case 'c' : 00960 for(i0=0; i0<=s0+1; i0++) 00961 for(i1=0; i1<=s1+1; i1++) { 00962 if(mask==NULL) ((unsigned char*)Map)[T(i0,i1)] = (unsigned char) '\0' + (int) iv; 00963 else if ( mask[T(i0,i1)] == 0 ) ((unsigned char*)Map)[T(i0,i1)] = '\0'; 00964 else ((unsigned char*)Map)[T(i0,i1)] = (unsigned char) '\0' + (int) iv; 00965 } 00966 break; 00967 00968 default : 00969 printf(" in default case\n"); 00970 break; 00971 } 00972 }
|
|
Get the file and read/convert the data of map (array).
Definition at line 591 of file Driver_Utilities.c. References dbgPt, debug, gridSize, gTemp, gTempSize, lcl_size, link_edges(), msgStr, nalloc(), procnum, quick_look(), readMap(), s0, s1, T, UCHAR, usrErr(), WriteMsg(), point2D::x, and point2D::y. 00594 { 00595 int i, j, k0, size; 00596 unsigned temp; 00597 UCHAR *tmpPtr, Dsize; 00598 00599 gridSize = (s0+2)*(s1+2); 00600 gTempSize = gridSize*8; 00601 00602 00603 size = gridSize*4 +1; 00604 if( size > gTempSize ) { 00605 if(gTemp) free((char*)gTemp); 00606 gTemp = (UCHAR*)nalloc( size, "gTemp" ); 00607 gTempSize = size; 00608 } 00609 00610 if(debug>2) { 00611 sprintf(msgStr,"Reading %s\n",filename); 00612 usrErr(msgStr); 00613 WriteMsg(msgStr,1); 00614 } 00615 00616 Dsize = readMap(filename,gTemp); 00617 00618 if(debug) { 00619 sprintf(msgStr,"name = %s, proc = %d, scale_value = %f, offset_value = %f, size = %x\n ", 00620 filename,procnum,scale_value,offset_value,Dsize); 00621 WriteMsg(msgStr,1); 00622 } 00623 for (i=1; i<=s0; i++) { 00624 for (j=1; j<=s1; j++) { 00625 k0 = Dsize*((i-1)*lcl_size[1] + (j-1)); 00626 tmpPtr = gTemp+k0; 00627 switch(Dsize) { 00628 case 1: temp = gTemp[k0]; break; 00629 case 2: temp = gTemp[k0]*256 + gTemp[k0+1]; break; 00630 case 3: temp = gTemp[k0]*65536 + gTemp[k0+1]*256 + gTemp[k0+2]; break; 00631 case 4: temp = gTemp[k0]*16777216 + gTemp[k0+1]*65536 + gTemp[k0+2]*256 + gTemp[k0+3]; break; 00632 default: fprintf(stderr,"ERROR, illegal size: %x\n",Dsize); temp = 0; 00633 } 00634 switch (Mtype) { 00635 case 'f' : 00636 ((float*)Map)[T(i,j)] = scale_value*((float)temp)+offset_value; 00637 break; 00638 case 'd' : case 'i' : 00639 ((int*)Map)[T(i,j)] = (int)(scale_value * (float)temp + offset_value); 00640 break; 00641 case 'c' : 00642 ((unsigned char*)Map)[T(i,j)] = (int)(scale_value * (unsigned char)temp); 00643 break; 00644 } 00645 } 00646 } 00647 if(debug) quick_look(Map, (char*)filename, Mtype, dbgPt.x, dbgPt.y, 2,'E'); 00648 link_edges(Map,Mtype); 00649 fflush(stderr); 00650 return Dsize; 00651 }
|
Here is the call graph for this function:
|
Scan forward until a particular string is found.
Definition at line 1731 of file Driver_Utilities.c. Referenced by get_global_parm(), get_parmf(), getChar(), getFloat(), getInt(), getString(), read_header(), read_map_dims(), and readSeriesCol(). 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 }
|
|
Allocate memory for a variable.
Definition at line 1774 of file Driver_Utilities.c. 01775 { 01776 VOIDP rp; 01777 01778 01779 if(mem_size == 0) return(NULL); 01780 rp = (VOIDP)malloc( mem_size ); 01781 total_memory += mem_size; 01782 fasync(stderr); 01783 if( rp == NULL ) { 01784 fprintf(stderr,"Sorry, out of memory(%d): %s\n",mem_size,var_name); 01785 Exit(0); 01786 } 01787 fmulti(stderr); 01788 return(rp); 01789 }
|
|
Modulus of a pair of (double) arguments.
Definition at line 1592 of file Driver_Utilities.c. Referenced by cell_dyn1(), CellAvg(), main(), and Run_Canal_Network(). 01592 { 01593 return (float)fmod((double)x, (double)y); 01594 }
|
|
Calling function for budget and summary stats. Called every time step, this calls functions to summarize variables across time At the time interval for output, this calls functions to make the final summaries, and then resets the data for new interval. Definition at line 51 of file BudgStats.c. References BIRbudg_date(), BIRbudg_reset(), BIRbudg_sum(), BIRbudg_sumFinal(), BIRstats_date(), BIRstats_reset(), BIRstats_sum(), BIRstats_sumFinal(), CellAvg(), simTime::IsBIRavgEnd, simTime::IsBudgEnd, simTime::IsBudgFirst, simTime::IsDay0, and SimTime. Referenced by call_cell_dyn(). 00052 { 00053 CellAvg(); /* Generate sums, means (avgs), on cell-by-cell basis (not by Basin/IRegion here) */ 00054 00055 BIRstats_sum(); 00056 BIRbudg_sum(); 00057 00058 if ( (SimTime.IsBIRavgEnd) ) { 00059 if (!SimTime.IsDay0) BIRstats_date(); /* skip TIME 0 of simulation */ 00060 BIRstats_sumFinal(); 00061 BIRstats_reset(); 00062 } 00063 if ( (SimTime.IsBudgEnd) ) { 00064 if (!SimTime.IsBudgFirst) BIRbudg_date(); /* skip first budget interval to accumulate info for mass-balance budget check */ 00065 BIRbudg_sumFinal(); 00066 BIRbudg_reset(); 00067 } 00068 }
|
Here is the call graph for this function:
|
Allocate memory for the BIR-based and cell-based stats variables.
Definition at line 1986 of file BudgStats.c. References basn, C_Peri_mortAvg, C_Peri_nppAvg, C_Peri_PCAvg, C_PeriAvg, C_PeriNutCFAvg, C_PeriRespAvg, Calg_GPP, Calg_mort, Cperi_avg, dop_decomp, dop_desorb, dop_macIn, dop_sorbIn, Elev_avg, ETAvg, EVAP, EvapAvg, floc_decomp, Floc_fr_phBioAvg, floc_In, HydPerAnn, init_pvar(), LAI_effAvg, Mac_avg, mac_mort, mac_nph_PCAvg, Mac_nphBioAvg, Mac_nphMortAvg, mac_NPP, Mac_nppAvg, mac_ph_PCAvg, Mac_phBioAvg, Mac_phMortAvg, Mac_totBioAvg, MacNutCfAvg, MacWatCfAvg, Manning_nAvg, msgStr, nalloc(), NC_Peri_mortAvg, NC_Peri_nppAvg, NC_Peri_PCAvg, NC_PeriAvg, NC_PeriNutCFAvg, NC_PeriRespAvg, NCalg_GPP, NCalg_mort, NCperi_avg, numBasn, numCells, ON_MAP, P, P_Calg, P_CELL, P_DEAD, P_DEAD_CELL, P_DEAD_ERR, P_DEAD_ERR_CUM, P_DEAD_IN, P_DEAD_IN_AVG, P_DEAD_IN_SUM, P_DEAD_OLD, P_DEAD_OUT, P_DEAD_OUT_AVG, P_DEAD_OUT_SUM, P_ERR, P_ERR_CUM, P_IN, P_IN_AVG, P_IN_GW, P_IN_OVL, P_IN_SPG, P_IN_STR, P_IN_SUM, P_LIVE, P_LIVE_CELL, P_LIVE_ERR, P_LIVE_ERR_CUM, P_LIVE_IN, P_LIVE_IN_AVG, P_LIVE_IN_SUM, P_LIVE_OLD, P_LIVE_OUT, P_LIVE_OUT_AVG, P_LIVE_OUT_SUM, P_MAC, P_NCalg, P_OLD, P_OUT, P_OUT_AVG, P_OUT_GW, P_OUT_OVL, P_OUT_SPG, P_OUT_STR, P_OUT_SUM, P_RAIN, P_settl, P_WAT, P_WAT_CELL, P_WAT_ERR, P_WAT_ERR_CUM, P_WAT_IN, P_WAT_IN_AVG, P_WAT_IN_SUM, P_WAT_OLD, P_WAT_OUT, P_WAT_OUT_AVG, P_WAT_OUT_SUM, PeriAvg, PeriLiteCFAvg, RAIN, RainAvg, RCHG, s0, s1, S_ERR_CUM, S_IN, S_IN_AVG, S_IN_GW, S_IN_OVL, S_IN_SPG, S_IN_STR, S_IN_SUM, S_OUT, S_OUT_AVG, S_OUT_GW, S_OUT_OVL, S_OUT_SPG, S_OUT_STR, S_OUT_SUM, SaltSedAvg, SaltSfAvg, SedElevAvg, Sfwat_avg, SfWatAvg, SUMGW, SUMSF, SUMUW, T, TOT_P_CAN, TOT_S, TOT_S_CAN, TOT_S_CELL, TOT_S_ERR, TOT_S_OLD, TOT_VOL, TOT_VOL_AVG_ERR, TOT_VOL_CAN, TOT_VOL_CUM_ERR, TOT_VOL_ERR, TOT_VOL_OLD, TotHeadAvg, TP_settlAvg, TPpore_avg, TPSedMinAvg, TPSedUptAvg, TPSedWatAvg, TPsf_avg, TPSfMinAvg, TPSfUptAvg, TPSfWatAvg, TPsoil_avg, TPSorbAvg, TPtoSOILAvg, TPtoVOLAvg, TRANSP, TranspAvg, Unsat_avg, UnsatMoistAvg, UnsatZavg, usrErr0(), VOL_ERR_PER_INFL, VOL_IN, VOL_IN_AVG, VOL_IN_GW, VOL_IN_OVL, VOL_IN_SPG, VOL_IN_STR, VOL_IN_SUM, VOL_OUT, VOL_OUT_AVG, VOL_OUT_GW, VOL_OUT_OVL, VOL_OUT_SPG, VOL_OUT_STR, VOL_OUT_SUM, wat_sedMiner, wat_sedUpt, wat_sfMiner, and wat_sfUpt. 01987 { 01988 int ix,iy,cellLoc, numBasnMax=0; 01989 01990 01991 for(ix=0; ix<=s0+1; ix++) 01992 for(iy=0; iy<=s1+1; iy++) 01993 if (ON_MAP[cellLoc= T(ix,iy)]) { 01994 if (basn[cellLoc] > numBasnMax) numBasnMax = basn[cellLoc]; 01995 } 01996 numBasn = numBasnMax; /* total number of basins in domain */ 01997 01998 sprintf (msgStr," %d Basins/Indicator-Regions...",numBasn); usrErr0(msgStr); 01999 02000 /* basin budget arrays (number of actual basins plus basin 0, which is whole system) */ 02001 numCells = (int *) nalloc (sizeof(int)*(numBasn+1),"numCells"); /* number of cells in a basin */ 02002 02003 /* Indicator region averages (non-budget) */ 02004 Sfwat_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"Sfwat_avg"); 02005 init_pvar(Sfwat_avg,NULL,'b',0.0); 02006 Unsat_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"Unsat_avg"); 02007 init_pvar(Unsat_avg,NULL,'b',0.0); 02008 TPsf_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"TPsf_avg"); 02009 init_pvar(TPsf_avg,NULL,'b',0.0); 02010 TPpore_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"TPpore_avg"); 02011 init_pvar(TPpore_avg,NULL,'b',0.0); 02012 TPsoil_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"TPsoil_avg"); 02013 init_pvar(TPsoil_avg,NULL,'b',0.0); 02014 NCperi_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"NCperi_avg"); 02015 init_pvar(NCperi_avg,NULL,'b',0.0); 02016 Cperi_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"Cperi_avg"); 02017 init_pvar(Cperi_avg,NULL,'b',0.0); 02018 Mac_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"Mac_avg"); 02019 init_pvar(Mac_avg,NULL,'b',0.0); 02020 Elev_avg = (double *) nalloc(sizeof(double)*(numBasn+1),"Elev_avg"); 02021 init_pvar(Elev_avg,NULL,'b',0.0); 02022 /* hydro mass bal vars */ 02023 SUMSF = (double *) nalloc(sizeof(double)*(numBasn+1),"SUMSF"); 02024 init_pvar(SUMSF,NULL,'b',0.0); 02025 SUMGW = (double *) nalloc(sizeof(double)*(numBasn+1),"SUMGW"); 02026 init_pvar(SUMGW,NULL,'b',0.0); 02027 SUMUW = (double *) nalloc(sizeof(double)*(numBasn+1),"SUMUW"); 02028 init_pvar(SUMUW,NULL,'b',0.0); 02029 RAIN = (double *) nalloc(sizeof(double)*(numBasn+1),"RAIN"); 02030 init_pvar(RAIN,NULL,'b',0.0); 02031 EVAP = (double *) nalloc(sizeof(double)*(numBasn+1),"EVAP"); 02032 init_pvar(EVAP,NULL,'b',0.0); 02033 TRANSP = (double *) nalloc(sizeof(double)*(numBasn+1),"TRANSP"); 02034 init_pvar(TRANSP,NULL,'b',0.0); 02035 RCHG = (double *) nalloc(sizeof(double)*(numBasn+1),"RCHG"); 02036 init_pvar(RCHG,NULL,'b',0.0); 02037 02038 TOT_VOL = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL"); 02039 init_pvar(TOT_VOL,NULL,'b',0.0); 02040 TOT_VOL_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL_OLD"); 02041 init_pvar(TOT_VOL_OLD,NULL,'b',0.0); 02042 VOL_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN"); 02043 init_pvar(VOL_IN,NULL,'b',0.0); 02044 VOL_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT"); 02045 init_pvar(VOL_OUT,NULL,'b',0.0); 02046 TOT_VOL_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL_ERR"); 02047 init_pvar(TOT_VOL_ERR,NULL,'b',0.0); 02048 TOT_VOL_CUM_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL_CUM_ERR"); 02049 init_pvar(TOT_VOL_CUM_ERR,NULL,'b',0.0); 02050 TOT_VOL_AVG_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL_AVG_ERR"); 02051 init_pvar(TOT_VOL_AVG_ERR,NULL,'b',0.0); 02052 VOL_ERR_PER_INFL = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_ERR_PER_INFL"); 02053 init_pvar(VOL_ERR_PER_INFL,NULL,'b',0.0); 02054 02055 VOL_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_SUM"); 02056 init_pvar(VOL_IN_SUM,NULL,'b',0.0); 02057 VOL_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_SUM"); 02058 init_pvar(VOL_OUT_SUM,NULL,'b',0.0); 02059 VOL_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_AVG"); 02060 init_pvar(VOL_IN_AVG,NULL,'b',0.0); 02061 VOL_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_AVG"); 02062 init_pvar(VOL_OUT_AVG,NULL,'b',0.0); 02063 02064 TOT_VOL_CAN = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_VOL_CAN"); 02065 init_pvar(TOT_VOL_CAN,NULL,'b',0.0); 02066 02067 VOL_IN_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_STR"); 02068 init_pvar(VOL_IN_STR,NULL,'b',0.0); 02069 VOL_IN_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_OVL"); 02070 init_pvar(VOL_IN_OVL,NULL,'b',0.0); 02071 VOL_IN_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_SPG"); 02072 init_pvar(VOL_IN_SPG,NULL,'b',0.0); 02073 VOL_IN_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_IN_GW"); 02074 init_pvar(VOL_IN_GW,NULL,'b',0.0); 02075 02076 VOL_OUT_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_STR"); 02077 init_pvar(VOL_OUT_STR,NULL,'b',0.0); 02078 VOL_OUT_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_OVL"); 02079 init_pvar(VOL_OUT_OVL,NULL,'b',0.0); 02080 VOL_OUT_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_SPG"); 02081 init_pvar(VOL_OUT_SPG,NULL,'b',0.0); 02082 VOL_OUT_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"VOL_OUT_GW"); 02083 init_pvar(VOL_OUT_GW,NULL,'b',0.0); 02084 02085 /* phosph mass bal vars for all storage fractions */ 02086 P_CELL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_CELL"); 02087 init_pvar(P_CELL,NULL,'b',0.0); 02088 P_RAIN = (double *) nalloc(sizeof(double)*(numBasn+1),"P_RAIN"); 02089 init_pvar(P_RAIN,NULL,'b',0.0); 02090 02091 P = (double *) nalloc(sizeof(double)*(numBasn+1),"P"); 02092 init_pvar(P,NULL,'b',0.0); 02093 P_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OLD"); 02094 init_pvar(P_OLD,NULL,'b',0.0); 02095 P_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN"); 02096 init_pvar(P_IN,NULL,'b',0.0); 02097 P_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT"); 02098 init_pvar(P_OUT,NULL,'b',0.0); 02099 P_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_ERR"); 02100 init_pvar(P_ERR,NULL,'b',0.0); 02101 P_ERR_CUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_ERR_CUM"); 02102 init_pvar(P_ERR_CUM,NULL,'b',0.0); 02103 02104 P_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_SUM"); 02105 init_pvar(P_IN_SUM,NULL,'b',0.0); 02106 P_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_SUM"); 02107 init_pvar(P_OUT_SUM,NULL,'b',0.0); 02108 P_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_AVG"); 02109 init_pvar(P_IN_AVG,NULL,'b',0.0); 02110 P_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_AVG"); 02111 init_pvar(P_OUT_AVG,NULL,'b',0.0); 02112 02113 TOT_P_CAN = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_P_CAN"); 02114 init_pvar(TOT_P_CAN,NULL,'b',0.0); 02115 02116 P_IN_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_STR"); 02117 init_pvar(P_IN_STR,NULL,'b',0.0); 02118 P_IN_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_OVL"); 02119 init_pvar(P_IN_OVL,NULL,'b',0.0); 02120 P_IN_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_SPG"); 02121 init_pvar(P_IN_SPG,NULL,'b',0.0); 02122 P_IN_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"P_IN_GW"); 02123 init_pvar(P_IN_GW,NULL,'b',0.0); 02124 02125 P_OUT_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_STR"); 02126 init_pvar(P_OUT_STR,NULL,'b',0.0); 02127 P_OUT_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_OVL"); 02128 init_pvar(P_OUT_OVL,NULL,'b',0.0); 02129 P_OUT_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_SPG"); 02130 init_pvar(P_OUT_SPG,NULL,'b',0.0); 02131 P_OUT_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"P_OUT_GW"); 02132 init_pvar(P_OUT_GW,NULL,'b',0.0); 02133 02134 /* phosph mass bal vars for live fraction */ 02135 P_LIVE_CELL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_CELL"); 02136 init_pvar(P_LIVE_CELL,NULL,'b',0.0); 02137 P_MAC = (double *) nalloc(sizeof(double)*(numBasn+1),"P_MAC"); 02138 init_pvar(P_MAC,NULL,'b',0.0); 02139 P_Calg = (double *) nalloc(sizeof(double)*(numBasn+1),"P_Calg"); 02140 init_pvar(P_Calg,NULL,'b',0.0); 02141 P_NCalg = (double *) nalloc(sizeof(double)*(numBasn+1),"P_NCalg"); 02142 init_pvar(P_NCalg,NULL,'b',0.0); 02143 Calg_GPP = (double *) nalloc(sizeof(double)*(numBasn+1),"Calg_GPP"); 02144 init_pvar(Calg_GPP,NULL,'b',0.0); 02145 NCalg_GPP = (double *) nalloc(sizeof(double)*(numBasn+1),"NCalg_GPP"); 02146 init_pvar(NCalg_GPP,NULL,'b',0.0); 02147 Calg_mort = (double *) nalloc(sizeof(double)*(numBasn+1),"Calg_mort"); 02148 init_pvar(Calg_mort,NULL,'b',0.0); 02149 NCalg_mort = (double *) nalloc(sizeof(double)*(numBasn+1),"NCalg_mort"); 02150 init_pvar(NCalg_mort,NULL,'b',0.0); 02151 02152 mac_NPP = (double *) nalloc(sizeof(double)*(numBasn+1),"mac_NPP"); 02153 init_pvar(mac_NPP,NULL,'b',0.0); 02154 mac_mort = (double *) nalloc(sizeof(double)*(numBasn+1),"mac_mort"); 02155 init_pvar(mac_mort,NULL,'b',0.0); 02156 02157 P_LIVE = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE"); 02158 init_pvar(P_LIVE,NULL,'b',0.0); 02159 02160 P_LIVE_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_OLD"); 02161 init_pvar(P_LIVE_OLD,NULL,'b',0.0); 02162 P_LIVE_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_IN"); 02163 init_pvar(P_LIVE_IN,NULL,'b',0.0); 02164 P_LIVE_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_OUT"); 02165 init_pvar(P_LIVE_OUT,NULL,'b',0.0); 02166 P_LIVE_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_ERR"); 02167 init_pvar(P_LIVE_ERR,NULL,'b',0.0); 02168 P_LIVE_ERR_CUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_ERR_CUM"); 02169 init_pvar(P_LIVE_ERR_CUM,NULL,'b',0.0); 02170 02171 P_LIVE_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_IN_SUM"); 02172 init_pvar(P_LIVE_IN_SUM,NULL,'b',0.0); 02173 P_LIVE_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_OUT_SUM"); 02174 init_pvar(P_LIVE_OUT_SUM,NULL,'b',0.0); 02175 P_LIVE_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_IN_AVG"); 02176 init_pvar(P_LIVE_IN_AVG,NULL,'b',0.0); 02177 P_LIVE_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_LIVE_OUT_AVG"); 02178 init_pvar(P_LIVE_OUT_AVG,NULL,'b',0.0); 02179 02180 /* phosph mass bal vars for dead fraction */ 02181 P_DEAD_CELL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_CELL"); 02182 init_pvar(P_DEAD_CELL,NULL,'b',0.0); 02183 dop_macIn = (double *) nalloc(sizeof(double)*(numBasn+1),"dop_macIn"); 02184 init_pvar(dop_macIn,NULL,'b',0.0); 02185 dop_sorbIn = (double *) nalloc(sizeof(double)*(numBasn+1),"dop_sorbIn"); 02186 init_pvar(dop_sorbIn,NULL,'b',0.0); 02187 dop_decomp = (double *) nalloc(sizeof(double)*(numBasn+1),"dop_decomp"); 02188 init_pvar(dop_decomp,NULL,'b',0.0); 02189 dop_desorb = (double *) nalloc(sizeof(double)*(numBasn+1),"dop_desorb"); 02190 init_pvar(dop_desorb,NULL,'b',0.0); 02191 floc_decomp = (double *) nalloc(sizeof(double)*(numBasn+1),"floc_decomp"); 02192 init_pvar(floc_decomp,NULL,'b',0.0); 02193 floc_In = (double *) nalloc(sizeof(double)*(numBasn+1),"floc_In"); 02194 init_pvar(floc_In,NULL,'b',0.0); 02195 02196 P_DEAD = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD"); 02197 init_pvar(P_DEAD,NULL,'b',0.0); 02198 02199 P_DEAD_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_OLD"); 02200 init_pvar(P_DEAD_OLD,NULL,'b',0.0); 02201 P_DEAD_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_IN"); 02202 init_pvar(P_DEAD_IN,NULL,'b',0.0); 02203 P_DEAD_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_OUT"); 02204 init_pvar(P_DEAD_OUT,NULL,'b',0.0); 02205 P_DEAD_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_ERR"); 02206 init_pvar(P_DEAD_ERR,NULL,'b',0.0); 02207 P_DEAD_ERR_CUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_ERR_CUM"); 02208 init_pvar(P_DEAD_ERR_CUM,NULL,'b',0.0); 02209 02210 P_DEAD_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_IN_SUM"); 02211 init_pvar(P_DEAD_IN_SUM,NULL,'b',0.0); 02212 P_DEAD_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_OUT_SUM"); 02213 init_pvar(P_DEAD_OUT_SUM,NULL,'b',0.0); 02214 P_DEAD_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_IN_AVG"); 02215 init_pvar(P_DEAD_IN_AVG,NULL,'b',0.0); 02216 P_DEAD_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_DEAD_OUT_AVG"); 02217 init_pvar(P_DEAD_OUT_AVG,NULL,'b',0.0); 02218 02219 /* phosph mass bal vars for water-borne fraction */ 02220 P_WAT_CELL = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_CELL"); 02221 init_pvar(P_WAT_CELL,NULL,'b',0.0); 02222 wat_sfMiner = (double *) nalloc(sizeof(double)*(numBasn+1),"wat_sfMiner"); 02223 init_pvar(wat_sfMiner,NULL,'b',0.0); 02224 wat_sedMiner = (double *) nalloc(sizeof(double)*(numBasn+1),"wat_sedMiner"); 02225 init_pvar(wat_sedMiner,NULL,'b',0.0); 02226 wat_sfUpt = (double *) nalloc(sizeof(double)*(numBasn+1),"wat_sfUpt"); 02227 init_pvar(wat_sfUpt,NULL,'b',0.0); 02228 P_settl = (double *) nalloc(sizeof(double)*(numBasn+1),"P_settl"); 02229 init_pvar(P_settl,NULL,'b',0.0); 02230 wat_sedUpt = (double *) nalloc(sizeof(double)*(numBasn+1),"wat_sedUpt"); 02231 init_pvar(wat_sedUpt,NULL,'b',0.0); 02232 02233 P_WAT = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT"); 02234 init_pvar(P_WAT,NULL,'b',0.0); 02235 02236 P_WAT_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_OLD"); 02237 init_pvar(P_WAT_OLD,NULL,'b',0.0); 02238 P_WAT_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_IN"); 02239 init_pvar(P_WAT_IN,NULL,'b',0.0); 02240 P_WAT_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_OUT"); 02241 init_pvar(P_WAT_OUT,NULL,'b',0.0); 02242 P_WAT_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_ERR"); 02243 init_pvar(P_WAT_ERR,NULL,'b',0.0); 02244 P_WAT_ERR_CUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_ERR_CUM"); 02245 init_pvar(P_WAT_ERR_CUM,NULL,'b',0.0); 02246 02247 P_WAT_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_IN_SUM"); 02248 init_pvar(P_WAT_IN_SUM,NULL,'b',0.0); 02249 P_WAT_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_OUT_SUM"); 02250 init_pvar(P_WAT_OUT_SUM,NULL,'b',0.0); 02251 P_WAT_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_IN_AVG"); 02252 init_pvar(P_WAT_IN_AVG,NULL,'b',0.0); 02253 P_WAT_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"P_WAT_OUT_AVG"); 02254 init_pvar(P_WAT_OUT_AVG,NULL,'b',0.0); 02255 02256 /* salt mass bal vars */ 02257 TOT_S_CELL = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_S_CELL"); 02258 init_pvar(TOT_S_CELL,NULL,'b',0.0); 02259 02260 TOT_S = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_S"); 02261 init_pvar(TOT_S,NULL,'b',0.0); 02262 TOT_S_OLD = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_S_OLD"); 02263 init_pvar(TOT_S_OLD,NULL,'b',0.0); 02264 S_IN = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN"); 02265 init_pvar(S_IN,NULL,'b',0.0); 02266 S_OUT = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT"); 02267 init_pvar(S_OUT,NULL,'b',0.0); 02268 TOT_S_ERR = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_S_ERR"); 02269 init_pvar(TOT_S_ERR,NULL,'b',0.0); 02270 S_ERR_CUM = (double *) nalloc(sizeof(double)*(numBasn+1),"S_ERR_CUM"); 02271 init_pvar(S_ERR_CUM,NULL,'b',0.0); 02272 02273 S_IN_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_SUM"); 02274 init_pvar(S_IN_SUM,NULL,'b',0.0); 02275 S_OUT_SUM = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_SUM"); 02276 init_pvar(S_OUT_SUM,NULL,'b',0.0); 02277 S_IN_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_AVG"); 02278 init_pvar(S_IN_AVG,NULL,'b',0.0); 02279 S_OUT_AVG = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_AVG"); 02280 init_pvar(S_OUT_AVG,NULL,'b',0.0); 02281 02282 TOT_S_CAN = (double *) nalloc(sizeof(double)*(numBasn+1),"TOT_S_CAN"); 02283 init_pvar(TOT_S_CAN,NULL,'b',0.0); 02284 02285 S_IN_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_STR"); 02286 init_pvar(S_IN_STR,NULL,'b',0.0); 02287 S_IN_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_OVL"); 02288 init_pvar(S_IN_OVL,NULL,'b',0.0); 02289 S_IN_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_SPG"); 02290 init_pvar(S_IN_SPG,NULL,'b',0.0); 02291 S_IN_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"S_IN_GW"); 02292 init_pvar(S_IN_GW,NULL,'b',0.0); 02293 02294 S_OUT_STR = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_STR"); 02295 init_pvar(S_OUT_STR,NULL,'b',0.0); 02296 S_OUT_OVL = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_OVL"); 02297 init_pvar(S_OUT_OVL,NULL,'b',0.0); 02298 S_OUT_SPG = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_SPG"); 02299 init_pvar(S_OUT_SPG,NULL,'b',0.0); 02300 S_OUT_GW = (double *) nalloc(sizeof(double)*(numBasn+1),"S_OUT_GW"); 02301 init_pvar(S_OUT_GW,NULL,'b',0.0); 02302 02303 /* map arrays with summary stats */ 02304 HydPerAnn = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"HydPerAnn"); 02305 init_pvar(HydPerAnn,NULL,'f',0.0); 02306 SfWatAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SfWatAvg"); 02307 init_pvar(SfWatAvg,NULL,'f',0.0); 02308 TotHeadAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TotHeadAvg"); 02309 init_pvar(TotHeadAvg,NULL,'f',0.0); 02310 UnsatZavg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UnsatZavg"); 02311 init_pvar(UnsatZavg,NULL,'f',0.0); 02312 02313 RainAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"RainAvg"); 02314 init_pvar(RainAvg,NULL,'f',0.0); 02315 ETAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"ETAvg"); 02316 init_pvar(ETAvg,NULL,'f',0.0); 02317 EvapAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"EvapAvg"); 02318 init_pvar(EvapAvg,NULL,'f',0.0); 02319 TranspAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TranspAvg"); 02320 init_pvar(TranspAvg,NULL,'f',0.0); 02321 UnsatMoistAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"UnsatMoistAvg"); 02322 init_pvar(UnsatMoistAvg,NULL,'f',0.0); 02323 02324 TPSfWatAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSfWatAvg"); 02325 init_pvar(TPSfWatAvg,NULL,'f',0.0); 02326 TPSfUptAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSfUptAvg"); 02327 init_pvar(TPSfUptAvg,NULL,'f',0.0); 02328 TPSfMinAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSfMinAvg"); 02329 init_pvar(TPSfMinAvg,NULL,'f',0.0); 02330 TP_settlAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TP_settlAvg"); 02331 init_pvar(TP_settlAvg,NULL,'f',0.0); 02332 TPSedWatAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSedWatAvg"); 02333 init_pvar(TPSedWatAvg,NULL,'f',0.0); 02334 TPSedUptAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSedUptAvg"); 02335 init_pvar(TPSedUptAvg,NULL,'f',0.0); 02336 TPSedMinAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSedMinAvg"); 02337 init_pvar(TPSedMinAvg,NULL,'f',0.0); 02338 TPSorbAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPSorbAvg"); 02339 init_pvar(TPSorbAvg,NULL,'f',0.0); 02340 TPtoVOLAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPtoVOLAvg"); 02341 init_pvar(TPtoVOLAvg,NULL,'f',0.0); 02342 TPtoSOILAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"TPtoSOILAvg"); 02343 init_pvar(TPtoSOILAvg,NULL,'f',0.0); 02344 02345 SaltSfAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SaltSfAvg"); 02346 init_pvar(SaltSfAvg,NULL,'f',0.0); 02347 SaltSedAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SaltSedAvg"); 02348 init_pvar(SaltSedAvg,NULL,'f',0.0); 02349 02350 Floc_fr_phBioAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Floc_fr_phBioAvg"); 02351 init_pvar(Floc_fr_phBioAvg,NULL,'f',0.0); 02352 02353 NC_PeriAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_PeriAvg"); 02354 init_pvar(NC_PeriAvg,NULL,'f',0.0); 02355 NC_Peri_nppAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_Peri_nppAvg"); 02356 init_pvar(NC_Peri_nppAvg,NULL,'f',0.0); 02357 NC_Peri_mortAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_Peri_mortAvg"); 02358 init_pvar(NC_Peri_mortAvg,NULL,'f',0.0); 02359 NC_PeriRespAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_PeriRespAvg"); 02360 init_pvar(NC_PeriRespAvg,NULL,'f',0.0); 02361 NC_PeriNutCFAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_PeriNutCFAvg"); 02362 init_pvar(NC_PeriNutCFAvg,NULL,'f',0.0); 02363 NC_Peri_PCAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"NC_Peri_PCAvg"); 02364 init_pvar(NC_Peri_PCAvg,NULL,'f',0.0); 02365 C_PeriAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_PeriAvg"); 02366 init_pvar(C_PeriAvg,NULL,'f',0.0); 02367 C_Peri_nppAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_Peri_nppAvg"); 02368 init_pvar(C_Peri_nppAvg,NULL,'f',0.0); 02369 C_Peri_mortAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_Peri_mortAvg"); 02370 init_pvar(C_Peri_mortAvg,NULL,'f',0.0); 02371 C_PeriRespAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_PeriRespAvg"); 02372 init_pvar(C_PeriRespAvg,NULL,'f',0.0); 02373 C_PeriNutCFAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_PeriNutCFAvg"); 02374 init_pvar(C_PeriNutCFAvg,NULL,'f',0.0); 02375 C_Peri_PCAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"C_Peri_PCAvg"); 02376 init_pvar(C_Peri_PCAvg,NULL,'f',0.0); 02377 PeriAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PeriAvg"); 02378 init_pvar(PeriAvg,NULL,'f',0.0); 02379 PeriLiteCFAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"PeriLiteCFAvg"); 02380 init_pvar(PeriLiteCFAvg,NULL,'f',0.0); 02381 02382 Mac_nphBioAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_nphBioAvg"); 02383 init_pvar(Mac_nphBioAvg,NULL,'f',0.0); 02384 Mac_phBioAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_phBioAvg"); 02385 init_pvar(Mac_phBioAvg,NULL,'f',0.0); 02386 Mac_totBioAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_totBioAvg"); 02387 init_pvar(Mac_totBioAvg,NULL,'f',0.0); 02388 Mac_nppAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_nppAvg"); 02389 init_pvar(Mac_nppAvg,NULL,'f',0.0); 02390 Mac_nphMortAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_nphMortAvg"); 02391 init_pvar(Mac_nphMortAvg,NULL,'f',0.0); 02392 Mac_phMortAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Mac_phMortAvg"); 02393 init_pvar(Mac_phMortAvg,NULL,'f',0.0); 02394 LAI_effAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"LAI_effAvg"); 02395 init_pvar(LAI_effAvg,NULL,'f',0.0); 02396 Manning_nAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"Manning_nAvg"); 02397 init_pvar(Manning_nAvg,NULL,'f',0.0); 02398 MacNutCfAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MacNutCfAvg"); 02399 init_pvar(MacNutCfAvg,NULL,'f',0.0); 02400 MacWatCfAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"MacWatCfAvg"); 02401 init_pvar(MacWatCfAvg,NULL,'f',0.0); 02402 mac_nph_PCAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"mac_nph_PCAvg"); 02403 init_pvar(mac_nph_PCAvg,NULL,'f',0.0); 02404 mac_ph_PCAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"mac_ph_PCAvg"); 02405 init_pvar(mac_ph_PCAvg,NULL,'f',0.0); 02406 02407 SedElevAvg = (float *) nalloc(sizeof(float)*(s0+2)*(s1+2),"SedElevAvg"); 02408 init_pvar(SedElevAvg,NULL,'f',0.0); 02409 02410 } /* end of alloc_mem_stats */
|
Here is the call graph for this function:
|
Set up the Basin & Indicator Region (BIR) linkages/inheritances.
Definition at line 1041 of file BudgStats.c. References basInFile, basins, basn, basn_list, basnDef, basndef::basnTxt, conv_kgTOmg, basndef::conv_kgTOmgm2, basndef::conv_m3TOcm, conv_mTOcm, basndef::family, basndef::FLok, basndef::IR, modelFileName, modelName, ModelPath, msgStr, numBasn, numCells, basndef::numFLok, basndef::numIR, ON_MAP, basndef::parent, ProjName, s0, s1, Scip(), T, and usrErr(). 01042 { 01043 int ix,iy,cellLoc,ibas; 01044 int ii, jj, basnID; 01045 int basnCnt=-1; /* the whole system basin-0 in the basinIR file is not considered part of this count of the number of Basin/IRs */ 01046 char ss[222], *line, modnam[20], boundIR[3]; 01047 01048 sprintf( modelFileName, "%s/%s/Data/basinIR", ModelPath, ProjName ); 01049 /* Open file with basin linkage/inheritance data */ 01050 if ( ( basInFile = fopen( modelFileName, "r" ) ) == NULL ) 01051 { 01052 sprintf( msgStr,"Can't open %s basin definition input file! ",modelFileName ) ; usrErr(msgStr); 01053 exit(-1) ; 01054 } 01055 01056 fgets( ss, 220, basInFile );fgets( ss, 220, basInFile ); /* skip 2 header lines */ 01057 fgets( ss, 220, basInFile ); sscanf( ss,"%s", &modnam); 01058 if (strcmp(modnam,modelName) != 0) { 01059 sprintf(msgStr, "The model name (%s) found in the %s file doesn't match the one (%s) you asked for in Driver.parm!", 01060 modnam, modelFileName, modelName); usrErr(msgStr); 01061 exit(-1); 01062 } 01063 /* Allocate memory for first basin */ 01064 if ( (basins = ( basnDef *) malloc( (size_t) sizeof( basnDef ))) == NULL ) { 01065 printf( "Failed to allocate memory for first basin (%s)\n ", basins->basnTxt ) ; 01066 exit( -2 ) ; 01067 } 01068 /* allocate memory for array of pointers to basin atts */ 01069 if ( (basn_list = 01070 ( basnDef **) malloc( (size_t) sizeof( basnDef *) * (numBasn+1))) == NULL ) 01071 { 01072 printf( "Failed to allocate memory for basin_list\n " ) ; 01073 exit( -2 ) ; 01074 }; 01075 01076 01077 fgets( ss, 220, basInFile ); /* skip the column name header */ 01078 01079 while ( fgets( ss, 220, basInFile ) != NULL && !feof( basInFile ) ) 01080 { 01081 line = ss; 01082 sscanf (line, "%d\t%s\t%d",&basnID, &basins->basnTxt,&basins->numIR); 01083 line = Scip( line, '\t' );line = Scip( line, '\t' );line = Scip( line, '\t' ); 01084 /* the indicator regions within a hydrologic basin are subscripted starting at 1, 01085 with the 0'th indicator region being the hydrologic basin itself. Flok is 01086 used to check for allowable flows among basins/indicator-regions, to determine if user configured 01087 BIRs are OK (NOT used to constrain calculated flows, but only used to verify that no unallowed interbasin 01088 overland flow is occuring via some "leak" in the vector topology) */ 01089 for (ii=0; ii<basins->numIR; ii++) { 01090 sscanf (line, "%d%", &basins->IR[ii]); 01091 basins->FLok[ii] = basins->IR[ii]; /* flow is allowed among IRegions in a particular hydro basin (family) */ 01092 basins->numFLok++; 01093 line = Scip( line, ',' ); 01094 } 01095 basnCnt++; /* count the number of basins&IRs to check that the # in the file is same as # defined on the map */ 01096 01097 /* if there are any FlowOk Basin/Indicator-Region attached to this Basin/Indicator-Region, read them */ 01098 while (1) { 01099 while ( *line != '#' && *line != '\0' ) line++; 01100 if(*line != '\0') { 01101 ++line; 01102 sscanf (line, "%d%", &basins->FLok[ii]); 01103 basins->numFLok++; 01104 ii++; 01105 } 01106 else break; 01107 } 01108 01109 basn_list[basnID] = basins; 01110 01111 /* Allocate memory for next basin */ 01112 if ( ( basins = ( basnDef *) malloc( (size_t) sizeof( basnDef ))) == NULL ) 01113 { 01114 printf( "Failed to allocate memory for next basin (%s)\n ", basins->basnTxt ) ; 01115 exit( -2 ) ; 01116 } 01117 01118 01119 } /* end of reading basin lines */ 01120 01121 free ((char *)basins); 01122 fclose(basInFile); 01123 01124 if (basnCnt != numBasn) { sprintf(msgStr, "Error - the %d basins read from basinIR does not match the %d basins in the basins map! Please fix the basinIR file.\n", 01125 basnCnt,numBasn); usrErr(msgStr); exit (-1); } 01126 01127 /* count the number of cells in the Basins/Indicator-Regions */ 01128 for (ibas=numBasn;ibas>=0;ibas--) numCells[ibas] = 0; 01129 for(ix=0; ix<=s0+1; ix++) 01130 for(iy=0; iy<=s1+1; iy++) 01131 if (ON_MAP[cellLoc= T(ix,iy)]) { 01132 numCells[basn[cellLoc]]++; /* count the number of cells in each basin */ 01133 numCells[0]++; /* count the number of cells in each basin */ 01134 } 01135 /* whole system (basin 0) is calc'd independently, while each of the hydro basins are 01136 sums of their respective Indicator Regions */ 01137 for (ibas=numBasn;ibas>=0;ibas--) { 01138 basins = basn_list[ibas]; 01139 basins->family = ibas; /* set the basin to initially be it's own family; below it may find that it is a child of a diff family */ 01140 basins->parent = ibas; /* set the basin to initially be a childless parent */ 01141 for (ii=0; ii<basins->numIR; ii++) { 01142 01143 basn_list[basins->IR[ii]]->family = ibas; /* the hydrologic basin family name of this IRegion */ 01144 basn_list[basins->IR[ii]]->parent = 0; /* this IR is a child, not a parent */ 01145 numCells[ibas] += numCells[basins->IR[ii]]; /* add the IRegion cells to the parent basin #cells */ 01146 } 01147 basins->conv_m3TOcm = conv_mTOcm/(numCells[ibas]*CELL_SIZE); 01148 basins->conv_kgTOmgm2 = conv_kgTOmg/(numCells[ibas]*CELL_SIZE); 01149 01150 } 01151 } /* end of BIRinit() */
|
Here is the call graph for this function:
|
Open files and create headers for BIR output.
Definition at line 1159 of file BudgStats.c. References BIRavg1, BIRavg2, BIRavg3, BIRavg4, BIRavg5, budget_P1, budget_P2, budget_P3, budget_P4, budget_P5, budget_Par1, budget_Par2, budget_Par3, budget_Par4, budget_Par5, budget_Pdead1, budget_Pdead2, budget_Pdead3, budget_Pdead4, budget_Pdead5, budget_Plive1, budget_Plive2, budget_Plive3, budget_Plive4, budget_Plive5, budget_Pwat1, budget_Pwat2, budget_Pwat3, budget_Pwat4, budget_Pwat5, budget_S1, budget_S2, budget_S3, budget_S4, budget_S5, budget_Wacr1, budget_Wacr2, budget_Wacr3, budget_Wacr4, budget_Wacr5, budget_Wcm1, budget_Wcm2, budget_Wcm3, budget_Wcm4, budget_Wcm5, CELL_SIZE, Min, modelFileName, modelName, modelVers, numBasn, numCells, OutputPath, ProjName, SimAlt, and SimModif. 01160 { 01161 int Fnum,Fsets,ibasLow,ibasHigh,ibas; 01162 01163 01164 01165 /********/ 01166 /* For the budget & BIRavg files, we can have multiple sets of files, with 01167 >1 sets needed if a large (>12) number of Basins/Indicator-Regions are defined. First, 01168 we open the files, then go to write headers for them */ 01169 01170 {/*Open the primary files for all of the budgets & BIRavgs */ 01171 01172 /* Indicator region avgs */ 01173 sprintf( modelFileName, "%s/%s/Output/Budget/BIRavg1", OutputPath, ProjName ); 01174 if ( ( BIRavg1 = fopen( modelFileName, "w" ) ) == NULL ) 01175 {printf( "Can't open BIRavg1 file! " );exit(-1) ;} 01176 /* water budget/massCheck info - units in acre-feet */ 01177 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wacr1", OutputPath, ProjName ); 01178 if ( ( budget_Wacr1 = fopen( modelFileName, "w" ) ) == NULL ) 01179 {printf( "Can't open budg_Wacr1 file! " );exit(-1) ;} 01180 /* water budget/massCheck info - units in cm height */ 01181 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wcm1", OutputPath, ProjName ); 01182 if ( ( budget_Wcm1 = fopen( modelFileName, "w" ) ) == NULL ) 01183 {printf( "Can't open budg_Wcm1 file! " );exit(-1) ;} 01184 /* Phosph budget/massCheck info for all P fractions (units=Mg) */ 01185 sprintf( modelFileName, "%s/%s/Output/Budget/budg_P1", OutputPath, ProjName ); 01186 if ( ( budget_P1 = fopen( modelFileName, "w" ) ) == NULL ) 01187 {printf( "Can't open budg_P1 file! " );exit(-1) ;} 01188 /* Phosph budget/massCheck info for all P fractions (units=mg/m2) */ 01189 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Par1", OutputPath, ProjName ); 01190 if ( ( budget_Par1 = fopen( modelFileName, "w" ) ) == NULL ) 01191 {printf( "Can't open budg_Par1 file! " );exit(-1) ;} 01192 /* Salt budget/massCheck info */ 01193 sprintf( modelFileName, "%s/%s/Output/Budget/budg_S1", OutputPath, ProjName ); 01194 if ( ( budget_S1 = fopen( modelFileName, "w" ) ) == NULL ) 01195 {printf( "Can't open budg_S1 file! " );exit(-1) ;} 01196 if (!ESPmodeON) { 01197 /* Phosph budget/massCheck info for live P fraction */ 01198 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pliv1", OutputPath, ProjName ); 01199 if ( ( budget_Plive1 = fopen( modelFileName, "w" ) ) == NULL ) 01200 {printf( "Can't open budg_Pliv1 file! " );exit(-1) ;} 01201 /* Phosph budget/massCheck info for dead P fraction */ 01202 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pded1", OutputPath, ProjName ); 01203 if ( ( budget_Pdead1 = fopen( modelFileName, "w" ) ) == NULL ) 01204 {printf( "Can't open budg_Pded1 file! " );exit(-1) ;} 01205 /* Phosph budget/massCheck info for water-borne P fraction */ 01206 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pwat1", OutputPath, ProjName ); 01207 if ( ( budget_Pwat1 = fopen( modelFileName, "w" ) ) == NULL ) 01208 {printf( "Can't open budg_Pwat1 file! " );exit(-1) ;} 01209 } 01210 01211 01212 if (numBasn>=13) { 01213 /*Open the secondary files for all of the budgets & BIRavgs if we have more than 12 basins */ 01214 /* Indicator region avgs */ 01215 sprintf( modelFileName, "%s/%s/Output/Budget/BIRavg2", OutputPath, ProjName ); 01216 if ( ( BIRavg2 = fopen( modelFileName, "w" ) ) == NULL ) 01217 { printf( "Can't open BIRavg2 file! " ); exit(-1) ;} 01218 /* water budget/massCheck info - units in acre-feet */ 01219 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wacr2", OutputPath, ProjName ); 01220 if ( ( budget_Wacr2 = fopen( modelFileName, "w" ) ) == NULL ) 01221 { printf( "Can't open budg_Wacr2 file! " ); exit(-1) ;} 01222 /* water budget/massCheck info - units in cm height */ 01223 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wcm2", OutputPath, ProjName ); 01224 if ( ( budget_Wcm2 = fopen( modelFileName, "w" ) ) == NULL ) 01225 {printf( "Can't open budg_Wcm2 file! " ); exit(-1) ;} 01226 /* Phosph budget/massCheck info for all P fractions (units=Mg) */ 01227 sprintf( modelFileName, "%s/%s/Output/Budget/budg_P2", OutputPath, ProjName ); 01228 if ( ( budget_P2 = fopen( modelFileName, "w" ) ) == NULL ) 01229 {printf( "Can't open budg_P2 file! " );exit(-1) ;} 01230 /* Phosph budget/massCheck info for all P fractions (units=mg/m2) */ 01231 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Par2", OutputPath, ProjName ); 01232 if ( ( budget_Par2 = fopen( modelFileName, "w" ) ) == NULL ) 01233 {printf( "Can't open budg_Par2 file! " );exit(-1) ;} 01234 /* Salt budget/massCheck info */ 01235 sprintf( modelFileName, "%s/%s/Output/Budget/budg_S2", OutputPath, ProjName ); 01236 if ( ( budget_S2 = fopen( modelFileName, "w" ) ) == NULL ) 01237 {printf( "Can't open budg_S2 file! " );exit(-1) ;} 01238 01239 if (!ESPmodeON) { 01240 /* Phosph budget/massCheck info for live P fraction */ 01241 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pliv2", OutputPath, ProjName ); 01242 if ( ( budget_Plive2 = fopen( modelFileName, "w" ) ) == NULL ) 01243 {printf( "Can't open budg_Pliv2 file! " );exit(-1) ;} 01244 /* Phosph budget/massCheck info for dead P fraction */ 01245 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pded2", OutputPath, ProjName ); 01246 if ( ( budget_Pdead2 = fopen( modelFileName, "w" ) ) == NULL ) 01247 {printf( "Can't open budg_Pded2 file! " );exit(-1) ;} 01248 /* Phosph budget/massCheck info for water-borne P fraction */ 01249 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pwat2", OutputPath, ProjName ); 01250 if ( ( budget_Pwat2 = fopen( modelFileName, "w" ) ) == NULL ) 01251 {printf( "Can't open budg_Pwat2 file! " );exit(-1) ;} 01252 }/* end of !ESPmodeON */ 01253 01254 } /* end of opening secondary files */ 01255 01256 01257 if (numBasn>=26) { 01258 /*Open the tertiary files for all of the budgets if we have more than 25 basins */ 01259 /* Indicator region avgs */ 01260 sprintf( modelFileName, "%s/%s/Output/Budget/BIRavg3", OutputPath, ProjName ); 01261 if ( ( BIRavg3 = fopen( modelFileName, "w" ) ) == NULL ) 01262 { printf( "Can't open BIRavg3 file! " ); exit(-1) ;} 01263 /* water budget/massCheck info - units in acre-feet */ 01264 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wacr3", OutputPath, ProjName ); 01265 if ( ( budget_Wacr3 = fopen( modelFileName, "w" ) ) == NULL ) 01266 { printf( "Can't open budg_Wacr3 file! " ); exit(-1) ;} 01267 /* water budget/massCheck info - units in cm height */ 01268 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wcm3", OutputPath, ProjName ); 01269 if ( ( budget_Wcm3 = fopen( modelFileName, "w" ) ) == NULL ) 01270 {printf( "Can't open budg_Wcm3 file! " ); exit(-1) ;} 01271 /* Phosph budget/massCheck info for all P fractions (units=Mg) */ 01272 sprintf( modelFileName, "%s/%s/Output/Budget/budg_P3", OutputPath, ProjName ); 01273 if ( ( budget_P3 = fopen( modelFileName, "w" ) ) == NULL ) 01274 {printf( "Can't open budg_P3 file! " );exit(-1) ;} 01275 /* Phosph budget/massCheck info for all P fractions (units=mg/m2) */ 01276 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Par3", OutputPath, ProjName ); 01277 if ( ( budget_Par3 = fopen( modelFileName, "w" ) ) == NULL ) 01278 {printf( "Can't open budg_Par3 file! " );exit(-1) ;} 01279 /* Salt budget/massCheck info */ 01280 sprintf( modelFileName, "%s/%s/Output/Budget/budg_S3", OutputPath, ProjName ); 01281 if ( ( budget_S3 = fopen( modelFileName, "w" ) ) == NULL ) 01282 {printf( "Can't open budg_S3 file! " );exit(-1) ;} 01283 01284 if (!ESPmodeON) { 01285 /* Phosph budget/massCheck info for live P fraction */ 01286 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pliv3", OutputPath, ProjName ); 01287 if ( ( budget_Plive3 = fopen( modelFileName, "w" ) ) == NULL ) 01288 {printf( "Can't open budg_Pliv3 file! " );exit(-1) ;} 01289 /* Phosph budget/massCheck info for dead P fraction */ 01290 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pded3", OutputPath, ProjName ); 01291 if ( ( budget_Pdead3 = fopen( modelFileName, "w" ) ) == NULL ) 01292 {printf( "Can't open budg_Pded3 file! " );exit(-1) ;} 01293 /* Phosph budget/massCheck info for water-borne P fraction */ 01294 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pwat3", OutputPath, ProjName ); 01295 if ( ( budget_Pwat3 = fopen( modelFileName, "w" ) ) == NULL ) 01296 {printf( "Can't open budg_Pwat3 file! " );exit(-1) ;} 01297 }/* end of !ESPmodeON */ 01298 01299 } /* end of opening tertiary files */ 01300 01301 if (numBasn>=39) { 01302 /*Open the fourth set of files for all of the budgets if we have more than 38 basins */ 01303 /* Indicator region avgs */ 01304 sprintf( modelFileName, "%s/%s/Output/Budget/BIRavg4", OutputPath, ProjName ); 01305 if ( ( BIRavg4 = fopen( modelFileName, "w" ) ) == NULL ) 01306 { printf( "Can't open BIRavg4 file! " ); exit(-1) ;} 01307 /* water budget/massCheck info - units in acre-feet */ 01308 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wacr4", OutputPath, ProjName ); 01309 if ( ( budget_Wacr4 = fopen( modelFileName, "w" ) ) == NULL ) 01310 { printf( "Can't open budg_Wacr4 file! " ); exit(-1) ;} 01311 /* water budget/massCheck info - units in cm height */ 01312 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wcm4", OutputPath, ProjName ); 01313 if ( ( budget_Wcm4 = fopen( modelFileName, "w" ) ) == NULL ) 01314 {printf( "Can't open budg_Wcm4 file! " ); exit(-1) ;} 01315 /* Phosph budget/massCheck info for all P fractions (units=Mg) */ 01316 sprintf( modelFileName, "%s/%s/Output/Budget/budg_P4", OutputPath, ProjName ); 01317 if ( ( budget_P4 = fopen( modelFileName, "w" ) ) == NULL ) 01318 {printf( "Can't open budg_P4 file! " );exit(-1) ;} 01319 /* Phosph budget/massCheck info for all P fractions (units=mg/m2) */ 01320 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Par4", OutputPath, ProjName ); 01321 if ( ( budget_Par4 = fopen( modelFileName, "w" ) ) == NULL ) 01322 {printf( "Can't open budg_Par4 file! " );exit(-1) ;} 01323 /* Salt budget/massCheck info */ 01324 sprintf( modelFileName, "%s/%s/Output/Budget/budg_S4", OutputPath, ProjName ); 01325 if ( ( budget_S4 = fopen( modelFileName, "w" ) ) == NULL ) 01326 {printf( "Can't open budg_S4 file! " );exit(-1) ;} 01327 01328 if (!ESPmodeON) { 01329 /* Phosph budget/massCheck info for live P fraction */ 01330 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pliv4", OutputPath, ProjName ); 01331 if ( ( budget_Plive4 = fopen( modelFileName, "w" ) ) == NULL ) 01332 {printf( "Can't open budg_Pliv4 file! " );exit(-1) ;} 01333 /* Phosph budget/massCheck info for dead P fraction */ 01334 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pded4", OutputPath, ProjName ); 01335 if ( ( budget_Pdead4 = fopen( modelFileName, "w" ) ) == NULL ) 01336 {printf( "Can't open budg_Pded4 file! " );exit(-1) ;} 01337 /* Phosph budget/massCheck info for water-borne P fraction */ 01338 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pwat4", OutputPath, ProjName ); 01339 if ( ( budget_Pwat4 = fopen( modelFileName, "w" ) ) == NULL ) 01340 {printf( "Can't open budg_Pwat4 file! " );exit(-1) ;} 01341 }/* end of !ESPmodeON */ 01342 01343 } /* end of opening fourth set of files */ 01344 01345 if (numBasn>=52) { 01346 /*Open the fifth set of files for all of the budgets if we have more than 51 basins */ 01347 /* Indicator region avgs */ 01348 sprintf( modelFileName, "%s/%s/Output/Budget/BIRavg5", OutputPath, ProjName ); 01349 if ( ( BIRavg5 = fopen( modelFileName, "w" ) ) == NULL ) 01350 { printf( "Can't open BIRavg5 file! " ); exit(-1) ;} 01351 /* water budget/massCheck info - units in acre-feet */ 01352 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wacr5", OutputPath, ProjName ); 01353 if ( ( budget_Wacr5 = fopen( modelFileName, "w" ) ) == NULL ) 01354 { printf( "Can't open budg_Wacr5 file! " ); exit(-1) ;} 01355 /* water budget/massCheck info - units in cm height */ 01356 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Wcm5", OutputPath, ProjName ); 01357 if ( ( budget_Wcm5 = fopen( modelFileName, "w" ) ) == NULL ) 01358 {printf( "Can't open budg_Wcm5 file! " ); exit(-1) ;} 01359 /* Phosph budget/massCheck info for all P fractions (units=Mg) */ 01360 sprintf( modelFileName, "%s/%s/Output/Budget/budg_P5", OutputPath, ProjName ); 01361 if ( ( budget_P5 = fopen( modelFileName, "w" ) ) == NULL ) 01362 {printf( "Can't open budg_P5 file! " );exit(-1) ;} 01363 /* Phosph budget/massCheck info for all P fractions (units=mg/m2) */ 01364 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Par5", OutputPath, ProjName ); 01365 if ( ( budget_Par5 = fopen( modelFileName, "w" ) ) == NULL ) 01366 {printf( "Can't open budg_Par5 file! " );exit(-1) ;} 01367 /* Salt budget/massCheck info */ 01368 sprintf( modelFileName, "%s/%s/Output/Budget/budg_S5", OutputPath, ProjName ); 01369 if ( ( budget_S5 = fopen( modelFileName, "w" ) ) == NULL ) 01370 {printf( "Can't open budg_S5 file! " );exit(-1) ;} 01371 01372 if (!ESPmodeON) { 01373 /* Phosph budget/massCheck info for live P fraction */ 01374 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pliv5", OutputPath, ProjName ); 01375 if ( ( budget_Plive5 = fopen( modelFileName, "w" ) ) == NULL ) 01376 {printf( "Can't open budg_Pliv5 file! " );exit(-1) ;} 01377 /* Phosph budget/massCheck info for dead P fraction */ 01378 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pded5", OutputPath, ProjName ); 01379 if ( ( budget_Pdead5 = fopen( modelFileName, "w" ) ) == NULL ) 01380 {printf( "Can't open budg_Pded5 file! " );exit(-1) ;} 01381 /* Phosph budget/massCheck info for water-borne P fraction */ 01382 sprintf( modelFileName, "%s/%s/Output/Budget/budg_Pwat5", OutputPath, ProjName ); 01383 if ( ( budget_Pwat5 = fopen( modelFileName, "w" ) ) == NULL ) 01384 {printf( "Can't open budg_Pwat5 file! " );exit(-1) ;} 01385 }/* end of !ESPmodeON */ 01386 01387 } /* end of opening fifth set of files */ 01388 01389 } /* end of opening all files */ 01390 01391 01392 01393 /********/ 01394 /* Now we need to print the headers to each set(s) of basin files */ 01395 /* First, figure out the number of files sets, and then loop thru that */ 01396 /* there are 13 total basins printed per file (basin 0 is whole system, 01397 not counted in numBasn, but always printed out in first file) */ 01398 if (numBasn>=52) { /* with more than 58 (plus whole-system basin == 59) basins: */ 01399 Fsets=5; /* we have five sets of basin files */ 01400 } 01401 else if (numBasn>=39) { /* with more than 38 (plus whole-system basin == 39) basins: */ 01402 Fsets=4; /* we have four sets of basin files */ 01403 } 01404 else if (numBasn>=26) { /* with more than 25 (plus whole-system basin == 26) basins: */ 01405 Fsets=3; /* we have three sets of basin files */ 01406 } 01407 else if (numBasn>=13) { /* with more than 12 (plus whole-system basin == 13) basins: */ 01408 Fsets=2; /* we have two sets of basin files */ 01409 } 01410 else { 01411 Fsets=1; /* otherwise, just one set of files */ 01412 } 01413 01414 for (Fnum = 1; Fnum <= Fsets; Fnum++) { 01415 01416 if (Fnum == 1) { /* first file set */ 01417 if (Fsets > 1) { 01418 ibasLow = 0; 01419 ibasHigh = 12; 01420 } 01421 else { 01422 ibasLow = 0; 01423 ibasHigh = Min(12,numBasn); 01424 } 01425 } 01426 01427 if (Fnum == 2) { /* second file set */ 01428 if (Fsets > 2) { 01429 ibasLow = 13; 01430 ibasHigh = 25; 01431 } 01432 else { 01433 ibasLow = 13; 01434 ibasHigh = Min(25,numBasn); 01435 } 01436 } 01437 01438 if (Fnum == 3) { /* third file set */ 01439 if (Fsets > 3) { 01440 ibasLow = 26; 01441 ibasHigh = 38; 01442 } 01443 else { 01444 ibasLow = 26; 01445 ibasHigh = Min(38,numBasn); 01446 } 01447 } 01448 01449 if (Fnum == 4) { /* fourth file set */ 01450 if (Fsets > 4) { 01451 ibasLow = 39; 01452 ibasHigh = 51; 01453 } 01454 else { 01455 ibasLow = 39; 01456 ibasHigh = Min(51,numBasn); 01457 } 01458 } 01459 01460 01461 else if (Fnum == 5) { 01462 ibasLow = 52; 01463 ibasHigh = numBasn; 01464 } 01465 01466 /*****/ 01467 /* now print the 4 header lines for all of the budget & BIRavg files */ 01468 01469 /* LINE 1&2: first header line, providing scenario ID; second line is units, etc. */ 01470 /* feb05 added two tabs at end of BIRavg header to accomodate sensitivity parm label & value */ 01471 fprintf ( ((Fnum==5)?(BIRavg5): 01472 ((Fnum==4)?(BIRavg4): 01473 ((Fnum==3)?(BIRavg3): 01474 ((Fnum==2)?(BIRavg2): 01475 (BIRavg1) ) ) ) ), 01476 "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): daily mean attributes. \nUnits = Hydro depths== m, TP surface & pore water==mg/L, TP soil==mg/kg, noncalc&calc periph==gC/m2, mac==kgC/m2, LandElevation= m NGVD'29+DATUM_DISTANCE(6m in v2.3).\n \t\t\t ", &modelName, &modelVers, &SimAlt, &SimModif ); 01477 fprintf ( ((Fnum==5)?(budget_Wacr5): 01478 ((Fnum==4)?(budget_Wacr4): 01479 ((Fnum==3)?(budget_Wacr3): 01480 ((Fnum==2)?(budget_Wacr2): 01481 (budget_Wacr1) ) ) ) ), 01482 "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): water budget and mass balance check. \nUnits = thousands of acre-feet per basin, with error (and cumulative net error) reporting in mm height across basin.\n \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 01483 fprintf ( ((Fnum==5)?(budget_Wcm5): 01484 ((Fnum==4)?(budget_Wcm4): 01485 ((Fnum==3)?(budget_Wcm3): 01486 ((Fnum==2)?(budget_Wcm2): 01487 (budget_Wcm1) ) ) ) ), 01488 "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): water budget and mass balance check. \nUnits = cm per basin, with error (and cumulative net error) reporting in mm height across basin.\n \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 01489 fprintf ( ((Fnum==5)?(budget_S5): 01490 ((Fnum==4)?(budget_S4): 01491 ((Fnum==3)?(budget_S3): 01492 ((Fnum==2)?(budget_S2): 01493 (budget_S1) ) ) ) ), 01494 "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): conservative tracer budget and mass balance check. \nUnits = metric tons (Mg) per basin, with error (and cumulative net error) reporting in ug/m2 in basin.\n \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 01495 fprintf ( ((Fnum==5)?(budget_P5): 01496 ((Fnum==4)?(budget_P4): 01497 ((Fnum==3)?(budget_P3): 01498 ((Fnum==2)?(budget_P2): 01499 (budget_P1) ) ) ) ), 01500 "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): Total P budget and mass balance check for all fractions. \nUnits = metric tons (Mg) per basin, with error (and cumulative net error) reporting in ug/m2 in basin.\n \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 01501 fprintf ( ((Fnum==5)?(budget_Par5): 01502 ((Fnum==4)?(budget_Par4): 01503 ((Fnum==3)?(budget_Par3): 01504 ((Fnum==2)?(budget_Par2): 01505 (budget_Par1) ) ) ) ), 01506 "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): Total P budget and mass balance check for all fractions. \nUnits = mg/m2 in basin, with error (and cumulative net error) reporting in ug/m2 in basin.\n \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 01507 if (!ESPmodeON) { 01508 01509 fprintf ( ((Fnum==5)?(budget_Plive5): 01510 ((Fnum==4)?(budget_Plive4): 01511 ((Fnum==3)?(budget_Plive3): 01512 ((Fnum==2)?(budget_Plive2): 01513 (budget_Plive1) ) ) ) ), 01514 "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): Total P budget and mass balance check for live fraction. \nUnits = mg/m2 in basin, with error (and cumulative net error) ug/m2.\n \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 01515 fprintf ( ((Fnum==5)?(budget_Pdead5): 01516 ((Fnum==4)?(budget_Pdead4): 01517 ((Fnum==3)?(budget_Pdead3): 01518 ((Fnum==2)?(budget_Pdead2): 01519 (budget_Pdead1) ) ) ) ), 01520 "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): Total P budget and mass balance check for dead, non-water-borne fraction. \nUnits = mg/m2 in basin, with error (and cumulative net error) ug/m2.\n \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 01521 fprintf ( ((Fnum==5)?(budget_Pwat5): 01522 ((Fnum==4)?(budget_Pwat4): 01523 ((Fnum==3)?(budget_Pwat3): 01524 ((Fnum==2)?(budget_Pwat2): 01525 (budget_Pwat1) ) ) ) ), 01526 "%s %s %s %s scenario: Basins/Indicator-Regions (BIR): Total P budget and mass balance check for water-borne fraction (some horiz I/O not shown - see budget for all combined fractions). \nUnits = mg/m2 in basin, with error (and cumulative net error) ug/m2.\n \t ", &modelName, &modelVers, &SimAlt, &SimModif ); 01527 } 01528 01529 /* LINE 3: third header line, looping thru basins, providing basin ID and size */ 01530 for (ibas = ibasHigh; ibas >= ibasLow; ibas--) 01531 { 01532 fprintf ( ((Fnum==5)?(BIRavg5): 01533 ((Fnum==4)?(BIRavg4): 01534 ((Fnum==3)?(BIRavg3): 01535 ((Fnum==2)?(BIRavg2): 01536 (BIRavg1) ) ) ) ), 01537 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t", 01538 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01539 fprintf ( ((Fnum==5)?(budget_Wacr5): 01540 ((Fnum==4)?(budget_Wacr4): 01541 ((Fnum==3)?(budget_Wacr3): 01542 ((Fnum==2)?(budget_Wacr2): 01543 (budget_Wacr1) ) ) ) ), 01544 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t", 01545 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01546 fprintf ( ((Fnum==5)?(budget_Wcm5): 01547 ((Fnum==4)?(budget_Wcm4): 01548 ((Fnum==3)?(budget_Wcm3): 01549 ((Fnum==2)?(budget_Wcm2): 01550 (budget_Wcm1) ) ) ) ), 01551 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t", 01552 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01553 fprintf ( ((Fnum==5)?(budget_S5): 01554 ((Fnum==4)?(budget_S4): 01555 ((Fnum==3)?(budget_S3): 01556 ((Fnum==2)?(budget_S2): 01557 (budget_S1) ) ) ) ), 01558 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t \t \t \t \t \t \t", 01559 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01560 if (!ESPmodeON) { 01561 fprintf ( ((Fnum==5)?(budget_P5): 01562 ((Fnum==4)?(budget_P4): 01563 ((Fnum==3)?(budget_P3): 01564 ((Fnum==2)?(budget_P2): 01565 (budget_P1) ) ) ) ), 01566 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t \t \t \t \t \t \t \t", 01567 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01568 fprintf ( ((Fnum==5)?(budget_Par5): 01569 ((Fnum==4)?(budget_Par4): 01570 ((Fnum==3)?(budget_Par3): 01571 ((Fnum==2)?(budget_Par2): 01572 (budget_Par1) ) ) ) ), 01573 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t \t \t \t \t \t \t \t", 01574 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01575 fprintf ( ((Fnum==5)?(budget_Plive5): 01576 ((Fnum==4)?(budget_Plive4): 01577 ((Fnum==3)?(budget_Plive3): 01578 ((Fnum==2)?(budget_Plive2): 01579 (budget_Plive1) ) ) ) ), 01580 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t \t \t \t \t \t \t", 01581 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01582 fprintf ( ((Fnum==5)?(budget_Pdead5): 01583 ((Fnum==4)?(budget_Pdead4): 01584 ((Fnum==3)?(budget_Pdead3): 01585 ((Fnum==2)?(budget_Pdead2): 01586 (budget_Pdead1) ) ) ) ), 01587 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t \t \t \t \t", 01588 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01589 fprintf ( ((Fnum==5)?(budget_Pwat5): 01590 ((Fnum==4)?(budget_Pwat4): 01591 ((Fnum==3)?(budget_Pwat3): 01592 ((Fnum==2)?(budget_Pwat2): 01593 (budget_Pwat1) ) ) ) ), 01594 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t", 01595 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01596 } 01597 01598 else { 01599 fprintf ( ((Fnum==5)?(budget_P5): 01600 ((Fnum==4)?(budget_P4): 01601 ((Fnum==3)?(budget_P3): 01602 ((Fnum==2)?(budget_P2): 01603 (budget_P1) ) ) ) ), 01604 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t", 01605 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01606 fprintf ( ((Fnum==5)?(budget_Par5): 01607 ((Fnum==4)?(budget_Par4): 01608 ((Fnum==3)?(budget_Par3): 01609 ((Fnum==2)?(budget_Par2): 01610 (budget_Par1) ) ) ) ), 01611 " BIR %2d =\t%6.1fmi^2,\t%6.1fkm^2\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t", 01612 ibas,(numCells[ibas]*CELL_SIZE*3.8610039e-7),(numCells[ibas]*CELL_SIZE*1.0e-6) ); 01613 } 01614 } /*end of loop for second header line */ 01615 01616 /* LINE 4: beginning of fourth header line */ 01617 /* feb05 added two tabs prior to "Date" of BIRavg header to accomodate sensitivity parm label & value */ 01618 fprintf ( ((Fnum==5)?(BIRavg5): 01619 ((Fnum==4)?(BIRavg4): 01620 ((Fnum==3)?(BIRavg3): 01621 ((Fnum==2)?(BIRavg2): 01622 (BIRavg1) ) ) ) ), "\nSParm\tSParmValu\t Date\t" ); 01623 fprintf ( ((Fnum==5)?(budget_Wacr5): 01624 ((Fnum==4)?(budget_Wacr4): 01625 ((Fnum==3)?(budget_Wacr3): 01626 ((Fnum==2)?(budget_Wacr2): 01627 (budget_Wacr1) ) ) ) ), "\n Date\t" ); 01628 fprintf ( ((Fnum==5)?(budget_Wcm5): 01629 ((Fnum==4)?(budget_Wcm4): 01630 ((Fnum==3)?(budget_Wcm3): 01631 ((Fnum==2)?(budget_Wcm2): 01632 (budget_Wcm1) ) ) ) ), "\n Date\t" ); 01633 fprintf ( ((Fnum==5)?(budget_S5): 01634 ((Fnum==4)?(budget_S4): 01635 ((Fnum==3)?(budget_S3): 01636 ((Fnum==2)?(budget_S2): 01637 (budget_S1) ) ) ) ), "\n Date\t" ); 01638 fprintf ( ((Fnum==5)?(budget_P5): 01639 ((Fnum==4)?(budget_P4): 01640 ((Fnum==3)?(budget_P3): 01641 ((Fnum==2)?(budget_P2): 01642 (budget_P1) ) ) ) ), "\n Date\t" ); 01643 fprintf ( ((Fnum==5)?(budget_Par5): 01644 ((Fnum==4)?(budget_Par4): 01645 ((Fnum==3)?(budget_Par3): 01646 ((Fnum==2)?(budget_Par2): 01647 (budget_Par1) ) ) ) ), "\n Date\t" ); 01648 if (!ESPmodeON) { 01649 fprintf ( ((Fnum==5)?(budget_Plive5): 01650 ((Fnum==4)?(budget_Plive4): 01651 ((Fnum==3)?(budget_Plive3): 01652 ((Fnum==2)?(budget_Plive2): 01653 (budget_Plive1) ) ) ) ), "\n Date\t" ); 01654 fprintf ( ((Fnum==5)?(budget_Pdead5): 01655 ((Fnum==4)?(budget_Pdead4): 01656 ((Fnum==3)?(budget_Pdead3): 01657 ((Fnum==2)?(budget_Pdead2): 01658 (budget_Pdead1) ) ) ) ), "\n Date\t" ); 01659 fprintf ( ((Fnum==5)?(budget_Pwat5): 01660 ((Fnum==4)?(budget_Pwat4): 01661 ((Fnum==3)?(budget_Pwat3): 01662 ((Fnum==2)?(budget_Pwat2): 01663 (budget_Pwat1) ) ) ) ), "\n Date\t" ); 01664 } 01665 01666 /* LINE 4: remainder of fourth header line, looping thru basins, providing column/variable ID attributes */ 01667 for (ibas = ibasHigh; ibas >= ibasLow; ibas--) 01668 { 01669 01670 fprintf ( ((Fnum==5)?(BIRavg5): 01671 ((Fnum==4)?(BIRavg4): 01672 ((Fnum==3)?(BIRavg3): 01673 ((Fnum==2)?(BIRavg2): 01674 (BIRavg1) ) ) ) ), 01675 " SfWat_%d\t Unsat_%d\t TPsf_%d\t TPpore_%d\t TPsoil_%d\t NCperi_%d\t Cperi_%d\t Mac_%d\t Elev_%d\t", 01676 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01677 fprintf ( ((Fnum==5)?(budget_Wacr5): 01678 ((Fnum==4)?(budget_Wacr4): 01679 ((Fnum==3)?(budget_Wacr3): 01680 ((Fnum==2)?(budget_Wacr2): 01681 (budget_Wacr1) ) ) ) ), 01682 " VolOld_%d\t Rain_%d\t Evap_%d\t Transp_%d\t Rchg_%d\t StrIn_%d\t StrOut_%d\t OvlIn_%d\t OvlOut_%d\t SpgIn_%d\t SpgOut_%d\t GWin_%d\t GWout_%d\t VolTarg_%d\t VolNew_%d\t Err_%d\t SumErr_%d\t InAvg_%d\t OutAvg_%d\t", 01683 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01684 fprintf ( ((Fnum==5)?(budget_Wcm5): 01685 ((Fnum==4)?(budget_Wcm4): 01686 ((Fnum==3)?(budget_Wcm3): 01687 ((Fnum==2)?(budget_Wcm2): 01688 (budget_Wcm1) ) ) ) ), 01689 " VolOld_%d\t Rain_%d\t Evap_%d\t Transp_%d\t Rchg_%d\t StrIn_%d\t StrOut_%d\t OvlIn_%d\t OvlOut_%d\t SpgIn_%d\t SpgOut_%d\t GWin_%d\t GWout_%d\t VolTarg_%d\t VolNew_%d\t Err_%d\t SumErr_%d\t InAvg_%d\t OutAvg_%d\t", 01690 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01691 fprintf ( ((Fnum==5)?(budget_S5): 01692 ((Fnum==4)?(budget_S4): 01693 ((Fnum==3)?(budget_S3): 01694 ((Fnum==2)?(budget_S2): 01695 (budget_S1) ) ) ) ), 01696 " MasOld_%d\t StrIn_%d\t StrOut_%d\t OvlIn_%d\t OvlOut_%d\t SpgIn_%d\t SpgOut_%d\t GWin_%d\t GWout_%d\t MasTarg_%d\t MasNew_%d\t Err_%d\t SumErr_%d\t InAvg_%d\t OutAvg_%d\t", 01697 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01698 if (!ESPmodeON) { 01699 fprintf ( ((Fnum==5)?(budget_P5): 01700 ((Fnum==4)?(budget_P4): 01701 ((Fnum==3)?(budget_P3): 01702 ((Fnum==2)?(budget_P2): 01703 (budget_P1) ) ) ) ), 01704 " MasOld_%d\t Rain_%d\t StrIn_%d\t StrOut_%d\t OvlIn_%d\t OvlOut_%d\t SpgIn_%d\t SpgOut_%d\t GWin_%d\t GWout_%d\t MasTarg_%d\t MasNew_%d\t Err_%d\t SumErr_%d\t InAvg_%d\t OutAvg_%d\t", 01705 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01706 fprintf ( ((Fnum==5)?(budget_Par5): 01707 ((Fnum==4)?(budget_Par4): 01708 ((Fnum==3)?(budget_Par3): 01709 ((Fnum==2)?(budget_Par2): 01710 (budget_Par1) ) ) ) ), 01711 " MasOld_%d\t Rain_%d\t StrIn_%d\t StrOut_%d\t OvlIn_%d\t OvlOut_%d\t SpgIn_%d\t SpgOut_%d\t GWin_%d\t GWout_%d\t MasTarg_%d\t MasNew_%d\t Err_%d\t SumErr_%d\t InAvg_%d\t OutAvg_%d\t", 01712 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01713 fprintf ( ((Fnum==5)?(budget_Plive5): 01714 ((Fnum==4)?(budget_Plive4): 01715 ((Fnum==3)?(budget_Plive3): 01716 ((Fnum==2)?(budget_Plive2): 01717 (budget_Plive1) ) ) ) ), 01718 " MacBio_%d\t CPerBio_%d\t NCPerBio_%d\t MacNPP_%d\t CPerGPP_%d\tNCPerGPP_%d\t MacMort_%d\t CalgMort_%d\t NCalgMort_%d\t MasTarg_%d\t MasNew_%d\t Err_%d\t SumErr_%d\t InAvg_%d\t OutAvg_%d\t", 01719 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01720 fprintf ( ((Fnum==5)?(budget_Pdead5): 01721 ((Fnum==4)?(budget_Pdead4): 01722 ((Fnum==3)?(budget_Pdead3): 01723 ((Fnum==2)?(budget_Pdead2): 01724 (budget_Pdead1) ) ) ) ), 01725 " MasOld_%d\tMac-soil_%d\tPer-soil_%d\t Decomp_%d\tSettl_to_%d\t Sorb_to_%d\t Desorb_%d\t MasTarg_%d\t MasNew_%d\t Err_%d\t SumErr_%d\t InAvg_%d\t OutAvg_%d\t", 01726 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01727 fprintf ( ((Fnum==5)?(budget_Pwat5): 01728 ((Fnum==4)?(budget_Pwat4): 01729 ((Fnum==3)?(budget_Pwat3): 01730 ((Fnum==2)?(budget_Pwat2): 01731 (budget_Pwat1) ) ) ) ), 01732 " MasOld_%d\t P_rain_%d\tSettl_fr_%d\t SfMiner_%d\tSedMiner_%d\t AlgUpt_%d\t MacUpt_%d\t DeSorb_%d\t Sorb_to_%d\t StrIn_%d\t StrOut_%d\t MasTarg_%d\t MasNew_%d\t Err_%d\t SumErr_%d\t InAvg_%d\t OutAvg_%d\t", 01733 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01734 } 01735 else { 01736 fprintf ( ((Fnum==5)?(budget_P5): 01737 ((Fnum==4)?(budget_P4): 01738 ((Fnum==3)?(budget_P3): 01739 ((Fnum==2)?(budget_P2): 01740 (budget_P1) ) ) ) ), 01741 " MasOld_%d\t Rain_%d\t Settl_%d\t StrIn_%d\t StrOut_%d\t OvlIn_%d\t OvlOut_%d\t SpgIn_%d\t SpgOut_%d\t GWin_%d\t GWout_%d\t MasTarg_%d\t MasNew_%d\t Err_%d\t SumErr_%d\t InAvg_%d\t OutAvg_%d\t", 01742 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01743 fprintf ( ((Fnum==5)?(budget_Par5): 01744 ((Fnum==4)?(budget_Par4): 01745 ((Fnum==3)?(budget_Par3): 01746 ((Fnum==2)?(budget_Par2): 01747 (budget_Par1) ) ) ) ), 01748 " MasOld_%d\t Rain_%d\t Settl_%d\t StrIn_%d\t StrOut_%d\t OvlIn_%d\t OvlOut_%d\t SpgIn_%d\t SpgOut_%d\t GWin_%d\t GWout_%d\t MasTarg_%d\t MasNew_%d\t Err_%d\t SumErr_%d\t InAvg_%d\t OutAvg_%d\t", 01749 ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas,ibas); 01750 } 01751 } /* end of loop for third header line */ 01752 01753 } /*end of printing all files' headers */ 01754 01755 01756 } /* end of BIRoutfiles */
|
|
Reset BIR (non-budget) statistics summations to zero.
Definition at line 921 of file BudgStats.c. References BIRavg1, BIRavg2, BIRavg3, BIRavg4, BIRavg5, Cperi_avg, Elev_avg, Mac_avg, NCperi_avg, numBasn, Sfwat_avg, TPpore_avg, TPsf_avg, TPsoil_avg, and Unsat_avg. 00922 { 00923 int ibas; 00924 00925 for (ibas = numBasn; ibas >= 0; ibas--) { 00926 Sfwat_avg[ibas]=Unsat_avg[ibas]=TPsf_avg[ibas]=TPpore_avg[ibas]=TPsoil_avg[ibas]= 00927 NCperi_avg[ibas]=Cperi_avg[ibas]=Mac_avg[ibas]=Elev_avg[ibas]=0.0; 00928 } 00929 fflush (BIRavg1); 00930 if (numBasn>=13) fflush (BIRavg2); 00931 if (numBasn>=26) fflush (BIRavg3); 00932 if (numBasn>=39) fflush (BIRavg4); 00933 if (numBasn>=52) fflush (BIRavg5); 00934 00935 }
|
|
Reset BIR budget summations to zero. For ALL budgets, store the old total volume in array TOT_xxx_OLD and reset any summations and BIRavgs to 0.
Definition at line 943 of file BudgStats.c. References budget_P1, budget_P2, budget_P3, budget_P4, budget_P5, budget_Par1, budget_Par2, budget_Par3, budget_Par4, budget_Par5, budget_Pdead1, budget_Pdead2, budget_Pdead3, budget_Pdead4, budget_Pdead5, budget_Plive1, budget_Plive2, budget_Plive3, budget_Plive4, budget_Plive5, budget_Pwat1, budget_Pwat2, budget_Pwat3, budget_Pwat4, budget_Pwat5, budget_S1, budget_S2, budget_S3, budget_S4, budget_S5, budget_Wacr1, budget_Wacr2, budget_Wacr3, budget_Wacr4, budget_Wacr5, budget_Wcm1, budget_Wcm2, budget_Wcm3, budget_Wcm4, budget_Wcm5, Calg_GPP, Calg_mort, dop_decomp, dop_desorb, dop_macIn, dop_sorbIn, EVAP, floc_decomp, floc_In, mac_mort, mac_NPP, NCalg_GPP, NCalg_mort, numBasn, P, P_Calg, P_CELL, P_DEAD, P_DEAD_CELL, P_DEAD_OLD, P_IN_GW, P_IN_OVL, P_IN_SPG, P_IN_STR, P_LIVE, P_LIVE_CELL, P_LIVE_OLD, P_MAC, P_NCalg, P_OLD, P_OUT_GW, P_OUT_OVL, P_OUT_SPG, P_OUT_STR, P_RAIN, P_settl, P_WAT, P_WAT_CELL, P_WAT_OLD, RAIN, RCHG, S_IN_GW, S_IN_OVL, S_IN_SPG, S_IN_STR, S_OUT_GW, S_OUT_OVL, S_OUT_SPG, S_OUT_STR, SUMGW, SUMSF, SUMUW, TOT_P_CAN, TOT_S, TOT_S_CAN, TOT_S_CELL, TOT_S_OLD, TOT_VOL, TOT_VOL_CAN, TOT_VOL_OLD, TRANSP, VOL_IN_GW, VOL_IN_OVL, VOL_IN_SPG, VOL_IN_STR, VOL_OUT_GW, VOL_OUT_OVL, VOL_OUT_SPG, VOL_OUT_STR, wat_sedMiner, wat_sedUpt, wat_sfMiner, and wat_sfUpt. 00944 { 00945 int ibas; 00946 00947 for (ibas = numBasn; ibas >= 0; ibas--) { 00948 TOT_VOL_OLD[ibas] = TOT_VOL[ibas]; 00949 TOT_S_OLD[ibas] = TOT_S[ibas]; 00950 P_OLD[ibas] = P[ibas]; 00951 if (!ESPmodeON) { 00952 P_LIVE_OLD[ibas] = P_LIVE[ibas]; 00953 P_DEAD_OLD[ibas] = P_DEAD[ibas]; 00954 P_WAT_OLD[ibas] = P_WAT[ibas]; 00955 } 00956 00957 SUMSF[ibas] = SUMGW[ibas] = SUMUW[ibas] = TOT_VOL[ibas] = TOT_VOL_CAN[ibas] = 0.0; 00958 RAIN[ibas] = VOL_IN_STR[ibas] = VOL_IN_OVL[ibas] = VOL_IN_SPG[ibas] = VOL_IN_GW[ibas] = 0.0; 00959 EVAP[ibas] = TRANSP[ibas] = RCHG[ibas] = VOL_OUT_STR[ibas] = VOL_OUT_OVL[ibas] = VOL_OUT_SPG[ibas] = VOL_OUT_GW[ibas] = 0.0; 00960 00961 TOT_S[ibas] = TOT_S_CELL[ibas] = TOT_S_CAN[ibas] = 0.0; 00962 S_IN_STR[ibas] = S_IN_OVL[ibas] = S_IN_SPG[ibas] = S_IN_GW[ibas] = 0.0; 00963 S_OUT_STR[ibas] = S_OUT_OVL[ibas] = S_OUT_SPG[ibas] = S_OUT_GW[ibas] = 0.0; 00964 00965 P[ibas] = P_CELL[ibas] = TOT_P_CAN[ibas] = 0.0; 00966 P_RAIN[ibas] = P_IN_STR[ibas] = P_IN_OVL[ibas] = P_IN_SPG[ibas] = P_IN_GW[ibas] = 0.0; 00967 P_OUT_STR[ibas] = P_OUT_OVL[ibas] = P_OUT_SPG[ibas] = P_OUT_GW[ibas] = 0.0; 00968 00969 P_LIVE[ibas] = P_LIVE_CELL[ibas] = P_MAC[ibas] = P_Calg[ibas] = P_NCalg[ibas] = 0.0; 00970 Calg_GPP[ibas] = NCalg_GPP[ibas] = Calg_mort[ibas] = NCalg_mort[ibas] = 0.0; 00971 mac_NPP[ibas] = mac_mort[ibas] = 0.0; 00972 00973 P_DEAD[ibas] = P_DEAD_CELL[ibas] = 0.0; 00974 dop_macIn[ibas] = dop_sorbIn[ibas] = floc_In[ibas] = 0.0; 00975 dop_decomp[ibas] = dop_desorb[ibas] = floc_decomp[ibas] = 0.0; 00976 00977 P_WAT[ibas] = P_WAT_CELL[ibas] = 0.0; 00978 wat_sfMiner[ibas] = wat_sedMiner[ibas] = wat_sfUpt[ibas] = wat_sedUpt[ibas] = P_settl[ibas] = 0.0; 00979 00980 00981 } 00982 00983 00984 fflush (budget_Wacr1); 00985 if (numBasn>=13) fflush (budget_Wacr2); 00986 if (numBasn>=26) fflush (budget_Wacr3); 00987 if (numBasn>=39) fflush (budget_Wacr4); 00988 if (numBasn>=52) fflush (budget_Wacr5); 00989 00990 fflush (budget_Wcm1); 00991 if (numBasn>=13) fflush (budget_Wcm2); 00992 if (numBasn>=26) fflush (budget_Wcm3); 00993 if (numBasn>=39) fflush (budget_Wcm4); 00994 if (numBasn>=52) fflush (budget_Wcm5); 00995 00996 fflush (budget_S1); 00997 if (numBasn>=13) fflush (budget_S2); 00998 if (numBasn>=26) fflush (budget_S3); 00999 if (numBasn>=39) fflush (budget_S4); 01000 if (numBasn>=52) fflush (budget_S5); 01001 01002 fflush (budget_P1); 01003 if (numBasn>=13) fflush (budget_P2); 01004 if (numBasn>=26) fflush (budget_P3); 01005 if (numBasn>=39) fflush (budget_P4); 01006 if (numBasn>=52) fflush (budget_P5); 01007 01008 fflush (budget_Par1); 01009 if (numBasn>=13) fflush (budget_Par2); 01010 if (numBasn>=26) fflush (budget_Par3); 01011 if (numBasn>=39) fflush (budget_Par4); 01012 if (numBasn>=52) fflush (budget_Par5); 01013 01014 if (!ESPmodeON) { 01015 fflush (budget_Plive1); 01016 if (numBasn>=13) fflush (budget_Plive2); 01017 if (numBasn>=26) fflush (budget_Plive3); 01018 if (numBasn>=39) fflush (budget_Plive4); 01019 if (numBasn>=52) fflush (budget_Plive5); 01020 01021 fflush (budget_Pdead1); 01022 if (numBasn>=13) fflush (budget_Pdead2); 01023 if (numBasn>=26) fflush (budget_Pdead3); 01024 if (numBasn>=39) fflush (budget_Pdead4); 01025 if (numBasn>=52) fflush (budget_Pdead5); 01026 01027 fflush (budget_Pwat1); 01028 if (numBasn>=13) fflush (budget_Pwat2); 01029 if (numBasn>=26) fflush (budget_Pwat3); 01030 if (numBasn>=39) fflush (budget_Pwat4); 01031 if (numBasn>=52) fflush (budget_Pwat5); 01032 } 01033 } /* end of BIRbudg_reset() */
|
|
Zero the arrays holding selected variable averages in cells (after printing)/.
Definition at line 1917 of file BudgStats.c. References C_Peri_mortAvg, C_Peri_nppAvg, C_Peri_PCAvg, C_PeriAvg, C_PeriNutCFAvg, C_PeriRespAvg, ETAvg, EvapAvg, Floc_fr_phBioAvg, LAI_effAvg, mac_nph_PCAvg, Mac_nphBioAvg, Mac_nphMortAvg, Mac_nppAvg, mac_ph_PCAvg, Mac_phBioAvg, Mac_phMortAvg, Mac_totBioAvg, MacNutCfAvg, MacWatCfAvg, Manning_nAvg, NC_Peri_mortAvg, NC_Peri_nppAvg, NC_PeriAvg, NC_PeriNutCFAvg, NC_PeriRespAvg, ON_MAP, PeriAvg, PeriLiteCFAvg, RainAvg, SaltSedAvg, SaltSfAvg, SedElevAvg, SfWatAvg, T, TotHeadAvg, TP_settlAvg, TPSedMinAvg, TPSedUptAvg, TPSedWatAvg, TPSfMinAvg, TPSfUptAvg, TPSfWatAvg, TPSorbAvg, TPtoSOILAvg, TPtoVOLAvg, TranspAvg, UnsatMoistAvg, and UnsatZavg. 01918 { 01919 int ix, iy, cellLoc; 01920 01921 for(ix=1; ix<=s0; ix++) 01922 for(iy=1; iy<=s1; iy++) 01923 if(ON_MAP[cellLoc= T(ix,iy)]) { 01924 TotHeadAvg[cellLoc] = 0.0; 01925 SfWatAvg[cellLoc] = 0.0; 01926 UnsatZavg[cellLoc] = 0.0; 01927 UnsatMoistAvg[cellLoc] = 0.0; 01928 RainAvg[cellLoc] = 0.0; 01929 EvapAvg[cellLoc] = 0.0; 01930 TranspAvg[cellLoc] = 0.0; 01931 ETAvg[cellLoc] = 0.0; 01932 01933 TPSfWatAvg[cellLoc] = 0.0; 01934 TPSfUptAvg[cellLoc] = 0.0; 01935 TPSfMinAvg[cellLoc] = 0.0; 01936 TP_settlAvg[cellLoc] = 0.0; 01937 TPSedWatAvg[cellLoc] = 0.0; 01938 TPSedUptAvg[cellLoc] = 0.0; 01939 TPSedMinAvg[cellLoc] = 0.0; 01940 TPSorbAvg[cellLoc] = 0.0; 01941 TPtoVOLAvg[cellLoc] = 0.0; 01942 TPtoSOILAvg[cellLoc] = 0.0; 01943 01944 SaltSfAvg[cellLoc] = 0.0; 01945 SaltSedAvg[cellLoc] = 0.0; 01946 01947 Floc_fr_phBioAvg[cellLoc] = 0.0; 01948 01949 NC_PeriAvg[cellLoc] = 0.0; 01950 NC_Peri_nppAvg[cellLoc] = 0.0; 01951 NC_Peri_mortAvg[cellLoc] = 0.0; 01952 NC_PeriRespAvg[cellLoc] = 0.0; 01953 NC_PeriNutCFAvg[cellLoc] = 0.0; 01954 C_Peri_PCAvg[cellLoc] = 0.0; 01955 C_PeriAvg[cellLoc] = 0.0; 01956 C_Peri_nppAvg[cellLoc] = 0.0; 01957 C_Peri_mortAvg[cellLoc] = 0.0; 01958 C_PeriRespAvg[cellLoc] = 0.0; 01959 C_PeriNutCFAvg[cellLoc] = 0.0; 01960 C_Peri_PCAvg[cellLoc] = 0.0; 01961 PeriAvg[cellLoc] = 0.0; 01962 PeriLiteCFAvg[cellLoc] = 0.0; 01963 01964 Mac_nphBioAvg[cellLoc] = 0.0; 01965 Mac_phBioAvg[cellLoc] = 0.0; 01966 Mac_totBioAvg[cellLoc] = 0.0; 01967 Mac_nppAvg[cellLoc] = 0.0; 01968 Mac_nphMortAvg[cellLoc] = 0.0; 01969 Mac_phMortAvg[cellLoc] = 0.0; 01970 LAI_effAvg[cellLoc] = 0.0; 01971 Manning_nAvg[cellLoc] = 0.0; 01972 MacNutCfAvg[cellLoc] = 0.0; 01973 MacWatCfAvg[cellLoc] = 0.0; 01974 mac_nph_PCAvg[cellLoc] = 0.0; 01975 mac_ph_PCAvg[cellLoc] = 0.0; 01976 01977 SedElevAvg[cellLoc] = 0.0; 01978 } 01979 } /* end of Cell_reset_avg() */
|
|
Zero the array holding hydroperiod data in cells (after printing).
Definition at line 1902 of file BudgStats.c. References HydPerAnn, ON_MAP, and T. 01903 { 01904 int ix, iy, cellLoc; 01905 01906 for(ix=1; ix<=s0; ix++) 01907 for(iy=1; iy<=s1; iy++) 01908 if(ON_MAP[cellLoc= T(ix,iy)]) { 01909 HydPerAnn[cellLoc] = 0.0; 01910 } 01911 }
|
|
Surface water horizontal flux. This is the alternating direction function that first fluxes water in the E/W direction and then in the N/S direction. It sweeps from left to right, then goes back from right to left, then goes from top to bottom and finally from bottom to top. This alternates every hyd_iter. Surface water model boundary exchanges may only occur across cells designated with designated attribute in the boundary condition map file. The surface water variable is actually updated in the Flux_SWstuff function
Definition at line 107 of file Fluxes.c. References BCondFlow, Flux_SWcells(), Flux_SWstuff(), HYD_MANNINGS_N, ON_MAP, SED_ELEV, SURFACE_WAT, and T. 00109 { 00115 int ix, iy; 00116 float FFlux; 00117 00118 00119 00120 /* check the donor and recipients cells for a) on-map, b) the cell attribute that allows sfwater 00121 boundary flow from the system and c) the attribute that indicates levee presence: 00122 the levee attribute of 1 (bitwise) allows flow to east; 00123 attribute of 2 (bitwise) allows flow to south (levee atts calc'd by WatMgmt.c) 00124 */ 00125 00126 /* as always, x is row, y is column! */ 00127 for(ix=1; ix<=s0; ix++) 00128 { 00129 if (it%2) /* alternate loop directions every other hyd_iter (it) */ 00130 { 00131 for(iy=1; iy<=s1; iy++) /* loop from west to east */ 00132 { 00133 if( ( ON_MAP[T(ix,iy)] && ON_MAP[T(ix,iy+1)] && (int)(ON_MAP[T(ix,iy)]-1) & 1 ) || 00134 BCondFlow[T(ix,iy+1)] == 3 || BCondFlow[T(ix,iy)] == 3 ) 00135 { 00136 FFlux = Flux_SWcells(ix,iy,ix,iy+1,SURFACE_WAT,SED_ELEV,HYD_MANNINGS_N); 00137 /* FFlux units = m */ 00138 if (FFlux != 0.0) 00139 Flux_SWstuff ( ix,iy,ix,iy+1,FFlux,SURFACE_WAT,STUF1,STUF2,STUF3); 00140 00141 } /* endof if */ 00142 } /* end of for */ 00143 } /* end of if */ 00144 00145 00146 else 00147 { 00148 for(iy=s1; iy>=1; iy--) /* loop from east to west */ 00149 if( ( ON_MAP[T(ix,iy)] && ON_MAP[T(ix,iy-1)] && (int)(ON_MAP[T(ix,iy-1)]-1) & 1 ) || 00150 BCondFlow[T(ix,iy-1)] == 3 || BCondFlow[T(ix,iy)] == 3 ) 00151 { 00152 FFlux = Flux_SWcells(ix,iy-1,ix,iy,SURFACE_WAT,SED_ELEV,HYD_MANNINGS_N); 00153 /* FFlux units = m */ 00154 if (FFlux != 0.0) 00155 Flux_SWstuff ( ix,iy-1,ix,iy,FFlux,SURFACE_WAT,STUF1,STUF2,STUF3); 00156 00157 } /* end of if */ 00158 } /* end of else */ 00159 } 00160 00161 for(iy=1; iy<=s1; iy++) 00162 { 00163 if (it%2) /* alternate loop directions every other hyd_iter (it) */ 00164 { 00165 for(ix=1; ix<=s0; ix++) /* loop from north to south */ 00166 if( ( ON_MAP[T(ix,iy)] && ON_MAP[T(ix+1,iy)] && (int)(ON_MAP[T(ix,iy)]-1) & 2 ) || 00167 BCondFlow[T(ix+1,iy)] == 3 || BCondFlow[T(ix,iy)] == 3 ) 00168 { 00169 FFlux = Flux_SWcells(ix,iy,ix+1,iy,SURFACE_WAT,SED_ELEV,HYD_MANNINGS_N); 00170 /* FFlux units = m */ 00171 if (FFlux != 0.0) 00172 Flux_SWstuff ( ix,iy,ix+1,iy,FFlux,SURFACE_WAT,STUF1,STUF2,STUF3); 00173 } 00174 } 00175 00176 00177 else 00178 { 00179 for(ix=s0; ix>=1; ix--) /* loop from south to north */ 00180 if( ( ON_MAP[T(ix,iy)] && ON_MAP[T(ix-1,iy)] && (int)(ON_MAP[T(ix-1,iy)]-1) & 2 ) || 00181 BCondFlow[T(ix-1,iy)] == 3 || BCondFlow[T(ix,iy)] == 3 ) 00182 { 00183 00184 FFlux = Flux_SWcells(ix-1,iy,ix,iy,SURFACE_WAT,SED_ELEV,HYD_MANNINGS_N); 00185 /* FFlux units = m */ 00186 if (FFlux != 0.0) 00187 Flux_SWstuff ( ix-1,iy,ix,iy,FFlux,SURFACE_WAT,STUF1,STUF2,STUF3); 00188 00189 } /* end of if */ 00190 } /* end of else */ 00191 } /* end of for */ 00192 00193 } /* end of function */
|
Here is the call graph for this function:
|
Groundwater fluxing routine. This is the alternating direction function that first fluxes water in the E/W direction and then in the N/S direction. It sweeps from left to right, then goes back from right to left, then goes from top to bottom and finally from bottom to top. This alternates every iteration. Water is fluxed with mass conservation, allowing outflow from (no inflow to) the model system.
Definition at line 632 of file Fluxes.c. References BCondFlow, Flux_GWcells(), ON_MAP, and T. 00637 { 00638 int ix, iy; /* ix is row, iy is col! */ 00639 /* we only check the donor cell for on-map, allowing losses from the system */ 00640 for(ix=1; ix<=s0; ix++) 00641 { 00642 if (it%2) { /* alternate loop directions every other iteration (it = int(hyd_iter-1)/2 ) */ 00643 for(iy=1; iy<=s1; iy++) /* loop from west to east */ 00644 /* allow boundary flow if donor cell is marked 4 or 9 */ 00645 if (( ON_MAP[T(ix,iy)] && ON_MAP[T(ix,iy+1)]) || 00646 ((BCondFlow[T(ix,iy+1)]+1) % 5 == 0) || ((BCondFlow[T(ix,iy)]+1) % 5 == 0) ) 00647 { 00648 Flux_GWcells(ix,iy,ix,iy+1,SatWat, Unsat, SfWat, rate, poros, sp_yield, elev, 00649 gwSTUF1, gwSTUF2, gwSTUF3, swSTUF1, swSTUF2, swSTUF3); 00650 } 00651 } 00652 00653 else { 00654 for(iy=s1; iy>=1; iy--) /* loop from east to west */ 00655 /* allow boundary flow if donor cell is marked 4 or 9 */ 00656 if (( ON_MAP[T(ix,iy)] && ON_MAP[T(ix,iy-1)]) || 00657 ((BCondFlow[T(ix,iy-1)]+1) % 5 == 0) || ((BCondFlow[T(ix,iy)]+1) % 5 == 0) ) 00658 { 00659 00660 Flux_GWcells(ix,iy,ix,iy-1,SatWat, Unsat, SfWat, rate, poros, sp_yield, elev, 00661 gwSTUF1, gwSTUF2, gwSTUF3, swSTUF1, swSTUF2, swSTUF3); 00662 } 00663 } 00664 } 00665 00666 for(iy=1; iy<=s1; iy++) 00667 { 00668 if (it%2) { /* alternate loop directions every other iteration (it = int(hyd_iter-1)/2 ) */ 00669 for(ix=1; ix<=s0; ix++) /* loop from north to south */ 00670 /* allow boundary flow if donor cell is marked 4 or 9 */ 00671 if (( ON_MAP[T(ix,iy)] && ON_MAP[T(ix+1,iy)]) || 00672 ((BCondFlow[T(ix+1,iy)]+1) % 5 == 0) || ((BCondFlow[T(ix,iy)]+1) % 5 == 0) ) 00673 { 00674 00675 Flux_GWcells(ix,iy,ix+1,iy,SatWat, Unsat, SfWat, rate, poros, sp_yield, elev, 00676 gwSTUF1, gwSTUF2, gwSTUF3, swSTUF1, swSTUF2, swSTUF3); 00677 } 00678 } 00679 else { 00680 for(ix=s0; ix>=1; ix--) /* loop from south to north */ 00681 /* allow boundary flow if donor cell is marked 4 or 9 */ 00682 if (( ON_MAP[T(ix,iy)] && ON_MAP[T(ix-1,iy)]) || 00683 ((BCondFlow[T(ix-1,iy)]+1) % 5 == 0) || ((BCondFlow[T(ix,iy)]+1) % 5 == 0) ) 00684 { 00685 00686 Flux_GWcells(ix,iy,ix-1,iy,SatWat, Unsat, SfWat, rate, poros, sp_yield, elev, 00687 gwSTUF1, gwSTUF2, gwSTUF3, swSTUF1, swSTUF2, swSTUF3); 00688 } 00689 } 00690 } 00691 00692 }
|
Here is the call graph for this function:
|
Read the input data file to get a habitat-specfic parameter array. This gets an array of the targeted parameter, a value for each of (usually) multiple habitats.
Definition at line 268 of file Serial.c. References dFile, EOS, get_Nth_parm(), gHabChar, goto_index(), habNumTot, match_Sparm(), MAX_NHAB, modelFileName, ModelPath, msgStr, ProgAttr, ProgExec, ProjName, prog_attr::S_ParmVal, Scip(), TAB, usrErr(), and WriteMsg(). Referenced by ReadHabParms(). 00269 { 00270 int hIndex, end=0; 00271 FILE* parmFile; 00272 float* fTmp; 00273 char lline[2001], *line; 00274 int pLoc = -1; 00275 int foundParm= False; 00276 char parmNameHead[30]; 00277 char modelFileName[300]; 00278 char HabParmFile[300]; 00279 char *fileAppend; 00280 extern ProgAttr *ProgExec; 00281 00282 00283 if ( (fTmp = (float*) malloc( MAX_NHAB * sizeof(float) ) ) == NULL) { 00284 sprintf(msgStr, "Failed to allocate memory for HabParm array.\n ") ; 00285 usrErr(msgStr); 00286 exit( -2 ) ; 00287 }; 00288 fTmp[0] = 0.0; 00289 00290 fileAppend = match_Sparm( s_parm_name, s_parm_relval, parmName); 00291 sprintf(HabParmFile,"HabParms_%s",fileAppend); 00292 sprintf(modelFileName,"%s/%s/Data/%s",ModelPath,ProjName,HabParmFile); 00293 parmFile = fopen(modelFileName,"r"); 00294 if(parmFile==NULL) {fprintf(stdout,"\nERROR: Unable to open dBase file %s\n",modelFileName); exit(-1); } 00295 00296 fgets(lline, 2000, parmFile); /* skip 1st header line */ 00297 fgets(lline, 2000, parmFile); /* read 2nd header line with column names */ 00298 line=lline; 00299 00300 while (!foundParm) 00301 { 00302 sscanf( line,"%s",&parmNameHead); 00303 if (strcmp(parmName,parmNameHead) ==0) foundParm = True; 00304 pLoc++; 00305 if (*line == EOS || *line == EOL) { 00306 sprintf(msgStr,"ERROR: Could not find header tag of %s in HabParms dbase file.", parmName); 00307 usrErr(msgStr); 00308 exit(-1); 00309 } 00310 line = Scip( line, TAB ); 00311 } 00312 00313 sprintf(msgStr,"Parameter group: %s",parmName); 00314 fflush(dFile); 00315 WriteMsg(msgStr,1); 00316 for( hIndex = 1; hIndex < MAX_NHAB; hIndex++) { 00317 goto_index (parmFile, gHabChar, hIndex); 00318 fTmp[hIndex] = get_Nth_parm( parmFile, pLoc, &end, hIndex ); 00319 if(end) break; 00320 } 00321 fclose(parmFile); 00322 habNumTot = hIndex-1; 00323 00324 fflush(dFile); 00325 /* TODO: this HARDCODES into the BIR (BIRavg) model output file ONLY, 00326 the incorrect impression of running sensitivity on a single habitat ID 00327 (hab 2 = sawgrass plain, ELMv2.4) */ 00328 if (strcmp(s_parm_name,parmName) == 0) ProgExec->S_ParmVal = fTmp[2]; 00329 return fTmp; 00330 }
|
Here is the call graph for this function:
|
Read the input data file to get a global parameter. This gets the single global value of the targeted parameter.
Definition at line 372 of file Serial.c. References Exit(), match_Sparm(), modelFileName, ModelPath, msgStr, ProgAttr, ProgExec, ProjName, prog_attr::S_ParmVal, scan_forward(), usrErr(), and WriteMsg(). Referenced by ReadGlobalParms(). 00373 { 00374 int test; 00375 char modelFileName[300]; 00376 FILE *parmFile; 00377 float parmVal; 00378 char parmNameHead[30]; 00379 extern ProgAttr *ProgExec; 00380 00381 00382 char GlobalParmFile[50]; 00383 char *fileAppend; 00384 00385 fileAppend = match_Sparm( s_parm_name, s_parm_relval, parmName); 00386 sprintf(GlobalParmFile,"GlobalParms_%s",fileAppend); 00387 sprintf(modelFileName,"%s/%s/Data/%s",ModelPath,ProjName,GlobalParmFile); 00388 00389 parmFile = fopen(modelFileName,"r"); 00390 if(parmFile==NULL) { 00391 sprintf(msgStr,"ERROR, can't open data file %s",modelFileName); 00392 usrErr(msgStr); 00393 Exit(0); 00394 } 00395 00396 sprintf(parmNameHead,"%s=", parmName); 00397 scan_forward(parmFile,parmNameHead); 00398 if ( (test = fscanf(parmFile,"%f",&parmVal) ) <= 0 ) { 00399 sprintf(msgStr,"ERROR in reading %s from %s; see Driver0.out debug file.", parmName, modelFileName); 00400 usrErr(msgStr); 00401 Exit(0); 00402 } 00403 sprintf(msgStr,"%s %f\n",parmNameHead, parmVal); 00404 WriteMsg(msgStr,1); 00405 00406 fclose(parmFile); 00407 if (strcmp(s_parm_name,parmName) == 0) ProgExec->S_ParmVal = parmVal; 00408 return parmVal; 00409 }
|
Here is the call graph for this function:
|
stage (depth) data array Definition at line 30 of file stage_inp.c. References applicationStruct::dataELM, applicationStruct::day, debug, elm_wmm_map, initDataStruct(), mapGrids(), ModelPath, msgStr, printGridMap(), processData(), ProjName, applicationStruct::recRead, returnData(), s1, SimTime, stage_binfilename, stage_struct, T, simTime::TIME, and usrErr(). Referenced by cell_dyn1(). 00031 { 00032 00033 int i,j,k; 00034 int success = 1, fail = -1; 00035 int stat = success; 00036 char gridmapfilename[135]; 00037 00038 if(SimTime.TIME==0) { 00039 /* elm_OG_map is data structure containing the mapping attributes at two scales */ 00040 elm_wmm_map = elm_OG_map; 00041 00042 if(elm_wmm_map == NULL) { 00043 sprintf(msgStr, "Mapping grids and setting up stage data..."); 00044 usrErr (msgStr); 00045 00046 sprintf(gridmapfilename, "%s%s/Data/gridmapping.txt", ModelPath, ProjName ); 00047 stat = mapGrids(gridmapfilename); 00048 elm_wmm_map = elm_OG_map; 00049 } 00050 00051 if(debug > 4) { 00052 printGridMap(); 00053 sprintf(msgStr,"stage_data_wmm==> Finished mapping grids"); 00054 usrErr (msgStr); 00055 } 00056 00057 sprintf(stage_binfilename, "%s%s/Data/BoundCond_stage.BIN", ModelPath, ProjName ); 00058 /* initializing data structures, move pointer to initial date (gridmap.c) */ 00059 stat = initDataStruct(stage_binfilename,&stage_struct); 00060 00061 if(debug > 4) { 00062 /*printELM2Grid_io(); */ 00063 /*drawELM2Grid_io(); */ 00064 sprintf(msgStr,"stage_data_wmm==> Finished initializing"); 00065 usrErr (msgStr); 00066 } 00067 00068 } /* end of SimTime.TIME=0 */ 00069 00070 00071 if(stage_struct.day >= stage_struct.recRead) { /* process the data in batch */ 00072 sprintf(msgStr,"Processing batch of stage data..."); 00073 usrErr (msgStr); 00074 stat = processData(stage_binfilename,&stage_struct); 00075 00076 if(debug > 4 ) { 00077 /*printBatchData(stageWMM,gridio_batch_len,widCnt);*/ /* TODO: remove this printBatchData function when sure is no longer needed */ 00078 sprintf(msgStr,"stage_data_wmm==> Finished processing data"); 00079 usrErr (msgStr); 00080 } 00081 } /* end of if */ 00082 00083 00084 if(stage_struct.day < stage_struct.recRead) { /* pass the data day by day */ 00085 returnData(stageSME,&stage_struct); 00086 00087 for(i = 0; i < s0; i++) { 00088 for(j = 0; j < s1; j++) { 00089 k = i*s1+j; 00090 stageSME[T((i+1),(j+1))] = stage_struct.dataELM[k] * conv_ftTOm; /* convert data from feet to meters */ 00091 } 00092 } 00093 00094 if(debug > 4) { 00095 sprintf(msgStr,"stage_data_wmm==> Finished returning data"); 00096 usrErr (msgStr); 00097 } 00098 00099 } /* end of if */ 00100 00101 return success; 00102 }
|
Here is the call graph for this function:
|
rainfall data array Definition at line 26 of file rain_inp.c. References applicationStruct::dataELM, applicationStruct::day, debug, elm_wmm_map, initDataStruct(), mapGrids(), ModelPath, msgStr, printGridMap(), processData(), ProjName, rain_binfilename, rain_struct, applicationStruct::recRead, returnData(), s1, SimTime, T, simTime::TIME, and usrErr(). 00027 { 00028 00029 int i,j,k; 00030 int success = 1, fail = -1; 00031 int stat = success; 00032 char gridmapfilename[135]; 00033 00034 if(SimTime.TIME==0) { 00035 00036 // cleanUp(*elm_wmm_map, rainSME); 00037 00038 /* elm_OG_map is data structure containing the mapping attributes at two scales */ 00039 elm_wmm_map = elm_OG_map; 00040 00041 if(elm_wmm_map == NULL) { 00042 sprintf(msgStr, "Mapping grids and setting up rain data..."); 00043 usrErr (msgStr); 00044 00045 sprintf(gridmapfilename, "%s%s/Data/gridmapping.txt", ModelPath, ProjName ); 00046 stat = mapGrids(gridmapfilename); 00047 elm_wmm_map = elm_OG_map; 00048 } 00049 00050 if(debug > 4) { 00051 printGridMap(); 00052 sprintf(msgStr,"rain_data_wmm==> Finished mapping grids"); 00053 usrErr (msgStr); 00054 } 00055 00056 sprintf(rain_binfilename, "%s%s/Data/rain.BIN", ModelPath, ProjName ); 00057 /* initializing data structures, move pointer to initial date (gridmap.c) */ 00058 stat = initDataStruct(rain_binfilename,&rain_struct); 00059 00060 if(debug > 4) { 00061 /* printELM2Grid_io(); */ 00062 /*drawELM2Grid_io(); */ 00063 sprintf(msgStr,"rain_data_wmm==> Finished initializing"); 00064 usrErr (msgStr); 00065 } 00066 00067 } /* end of SimTime.TIME=0 */ 00068 00069 00070 if(rain_struct.day >= rain_struct.recRead) { /* process the data in batch */ 00071 sprintf(msgStr,"Processing batch of rain data..."); 00072 usrErr (msgStr); 00073 stat = processData(rain_binfilename,&rain_struct); 00074 00075 if(debug > 4 ) { 00076 /*printBatchData(rainWMM,gridio_batch_len,widCnt);*/ /* TODO: remove this printBatchData function when sure is no longer needed */ 00077 sprintf(msgStr,"rain_data_wmm==> Finished processing data"); 00078 usrErr (msgStr); 00079 } 00080 } /* end of if */ 00081 00082 00083 if (rain_struct.day < rain_struct.recRead) { /* pass the data day by day */ 00084 returnData(rainSME,&rain_struct); 00085 /* change the unit here */ 00086 for(i = 0; i < s0; i++) { 00087 for(j = 0; j < s1; j++) { 00088 k = i*s1+j; 00089 rainSME[T((i+1),(j+1))] = rain_struct.dataELM[k] * conv_inTOtenths_mm; /* convert data from inches to tenths of mm */ 00090 } 00091 } 00092 00093 if(debug > 4) { 00094 sprintf(msgStr,"rain_data_wmm==> Finished returning data"); 00095 usrErr (msgStr); 00096 } 00097 00098 } /* end of if */ 00099 00100 return success; 00101 }
|
Here is the call graph for this function:
|
potential ET data array Definition at line 30 of file evap_inp.c. References applicationStruct::dataELM, applicationStruct::day, debug, elm_wmm_map, evap_binfilename, evap_struct, initDataStruct(), mapGrids(), ModelPath, msgStr, printGridMap(), processData(), ProjName, applicationStruct::recRead, returnData(), s1, SimTime, T, simTime::TIME, and usrErr(). Referenced by cell_dyn1(). 00031 { 00032 00033 int i,j,k; 00034 int success = 1, fail = -1; 00035 int stat = success; 00036 char gridmapfilename[135]; 00037 00038 if(SimTime.TIME==0) { 00039 /* elm_OG_map is data structure containing the mapping attributes at two scales */ 00040 elm_wmm_map = elm_OG_map; 00041 00042 if(elm_wmm_map == NULL) { 00043 sprintf(msgStr, "Mapping grids and setting up pET data..."); 00044 usrErr (msgStr); 00045 00046 sprintf(gridmapfilename, "%s%s/Data/gridmapping.txt", ModelPath, ProjName ); 00047 stat = mapGrids(gridmapfilename); 00048 elm_wmm_map = elm_OG_map; 00049 } 00050 00051 if(debug > 4) { 00052 printGridMap(); 00053 sprintf(msgStr,"evap_data_wmm==> Finished mapping grids"); 00054 usrErr (msgStr); 00055 } 00056 00057 sprintf(evap_binfilename, "%s%s/Data/ETp.BIN", ModelPath, ProjName ); 00058 /* initializing data structures, move pointer to initial date (gridmap.c) */ 00059 stat = initDataStruct(evap_binfilename,&evap_struct); 00060 00061 if(debug > 4) { 00062 /*printELM2Grid_io(); */ 00063 /*drawELM2Grid_io(); */ 00064 sprintf(msgStr,"evap_data_wmm==> Finished initializing"); 00065 usrErr (msgStr); 00066 } 00067 00068 } /* end of SimTime.TIME=0 */ 00069 00070 00071 if(evap_struct.day >= evap_struct.recRead) { /* process the data in batch */ 00072 sprintf(msgStr,"Processing batch of pET data..."); 00073 usrErr (msgStr); 00074 stat = processData(evap_binfilename,&evap_struct); 00075 00076 if(debug > 4 ) { 00077 /*printBatchData(evapWMM,gridio_batch_len,widCnt);*/ /* TODO: remove this printBatchData function when sure is no longer needed */ 00078 sprintf(msgStr,"evap_data_wmm==> Finished processing data"); 00079 usrErr (msgStr); 00080 } 00081 } /* end of if */ 00082 00083 00084 if(evap_struct.day < evap_struct.recRead) { /* pass the data day by day */ 00085 returnData(evapSME,&evap_struct); 00086 00087 for(i = 0; i < s0; i++) { 00088 for(j = 0; j < s1; j++) { 00089 k = i*s1+j; 00090 evapSME[T((i+1),(j+1))] = evap_struct.dataELM[k] * conv_inTOtenths_mm; /* convert data from inches to tenths of mm */ 00091 } 00092 } 00093 00094 if(debug > 4) { 00095 sprintf(msgStr,"evap_data_wmm==> Finished returning data"); 00096 usrErr (msgStr); 00097 } 00098 00099 } /* end of if */ 00100 00101 return success; 00102 }
|
Here is the call graph for this function:
|
A "julian" day counter within a 365 day "year" Definition at line 27 of file unitmod.h. Referenced by cell_dyn1(), and CellAvg(). |
|
Definition at line 45 of file unitmod.h. Referenced by cell_dyn1(). |
|
|
|
Definition at line 45 of file unitmod.h. Referenced by cell_dyn1(). |
|
|
|
Definition at line 45 of file unitmod.h. Referenced by cell_dyn1(). |
|
Definition at line 45 of file unitmod.h. Referenced by cell_dyn1(). |
|
Definition at line 45 of file unitmod.h. Referenced by cell_dyn1(). |
|
Definition at line 45 of file unitmod.h. Referenced by cell_dyn1(). |
|
Definition at line 45 of file unitmod.h. Referenced by cell_dyn1(). |
|
Definition at line 45 of file unitmod.h. Referenced by cell_dyn1(). |
|
Definition at line 45 of file unitmod.h. Referenced by cell_dyn1(). |
|
Definition at line 49 of file unitmod.h. Referenced by Disp_Calc(). |
|
Initial value: { {0.0000000,0.0000000},{0.1000000,0.0200000},{0.2000000,0.0400000},{0.3000000,0.0700000}, {0.4000000,0.1250000},{0.5000000,0.2150000},{0.6000000,0.3450000},{0.7000000,0.5750000}, {0.8000000,0.8550000},{0.9000000,0.9850000},{1.0000000,1.0000000} } Definition at line 53 of file unitmod.h. Referenced by graph7(). |
|
Initial value: { {0.0000000,0.0050000},{0.1000000,0.0100000},{0.2000000,0.0400000},{0.3000000,0.1000000}, {0.4000000,0.2800000},{0.5000000,0.7150000},{0.6000000,0.8650000},{0.7000000,0.9350000}, {0.8000000,0.9750000},{0.9000000,0.9950000},{1.0000000,1.0000000} } Definition at line 57 of file unitmod.h. Referenced by graph8(). |
|
The outstep interval (in Model.outList input file) used to denote output intervals of 1-calendar-month instead of selectable-julian-day Definition at line 28 of file driver_utilities.h. Referenced by readViewParms(). |
|
Basin/Indicator Region data Definition at line 30 of file budgstats.h. |
|
Basin/Indicator Region data Definition at line 31 of file budgstats.h. |
|
boolean flag indicating water management mode Definition at line 31 of file generic_driver.h. Referenced by get_parmf(). |
|
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(). |
|
boolean flag indicating habitat succession mode Definition at line 32 of file generic_driver.h. Referenced by cell_dyn1(), and get_parmf(). |
|
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(). |
|
base pathname for all model output (user input) Definition at line 38 of file driver_utilities.h. |
|
Definition at line 36 of file driver_utilities.h. |