Ecological Landscape Modeling: Models Pages

globals.h File Reference

Header file for global data/functions. More...

#include <ctype.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

Include dependency graph for globals.h:

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

Go to the source code of this file.

Data Structures

struct  prog_attr
struct  simTime
struct  pTSeries
struct  pTSeriesList
struct  rPoint
struct  rPointList
struct  outVar_struct
struct  basndef
struct  point3D
struct  point2D
struct  scale1
struct  scale2
struct  viewParm
struct  seriesParm
struct  nodenv

Defines

#define VOIDP   void*
#define HDF   0
#define HDF4   0
#define NCDF3   1
#define UNIX   1
#define H_OPSYS   UNIX
#define kMAX   0
#define kMIN   1
#define kMAXMIN   2
#define kSUM   3
#define kAVE   4
#define kSUMCUM   5
#define kAVECUM   6
#define MAX_PTSERIES   8000
#define MAX_TS_FILES   50
#define MAX_MSG_SIZE   1200
#define ISARRAY   0x8000
#define PMASK2   0x0200
#define PMASK1   0x0100
#define kCArgDepth   10
#define kCArgWidth   50
#define EOL   '\n'
#define EOS   '\0'
#define TAB   '\t'
#define POUND   ((UCHAR)0x23)
#define True   1
#define False   0
#define CASE   0
#define NOCASE   1
#define BEG   0
#define END   1
#define DT   dt
#define T(x, y)   ((int)((x)*(s1+2)+(y)))
#define sec_per_day   86400.0
#define PI   3.1415927
#define wetEndMon   9
#define wetEndDay   30
#define dryEndMon   4
#define dryEndDay   30
#define Abs(x)   (((x)>=0) ? (x) : -(x))
#define Cos(x)   cos((double)x)
#define Sin(x)   sin((double)x)
#define Tan(x)   tan((double)x)
#define Arctan(x)   atan((double)x)
#define Exp(x)   exp((double)x)
#define Max(x, y)   (((x)>(y))?(x):(y))
#define Min(x, y)   (((y)>(x))?(x):(y))
#define ramp(x)   (((x)>0)?(x):0)
#define sgn(x)   (((x)>=0) ? 1.0 : -1.0)
#define conv_mgTOg   1.0e-3
#define conv_gTOkg   1.0e-3
#define conv_mgTOkg   1.0e-6
#define conv_kgTO_Mg   1.0e-3
#define conv_mgTOug   1.0e3
#define conv_gTOmg   1.0e3
#define conv_kgTOg   1.0e3
#define conv_kgTOmg   1.0e6
#define conv_inTOtenths_mm   254.0
#define conv_ftTOm   0.3048
#define conv_mTOcm   100.0
#define conv_cmTOmm   10.0
#define conv_mTOkm   0.001
#define conv_northing_NAD27toNAD83   203.8
#define conv_easting_NAD27toNAD83   21.3
#define MAX_NHAB   255
#define MAX_SECTOR   30

Typedefs

typedef int BOOL
typedef FILE * STREAM
typedef char * STRING
typedef unsigned char UCHAR
typedef unsigned char byte
typedef unsigned int UINT
typedef unsigned short USHORT
typedef long SLONG
typedef unsigned long ULONG
typedef struct prog_attr ProgAttr
typedef struct pTSeries PTSeries
typedef struct pTSeriesList PTSeriesList
typedef struct rPoint RPoint
typedef struct rPointList RPointList
typedef struct basndef basnDef
typedef struct point3D Point3D
typedef struct point2D Point2D
typedef struct scale1 Scale1
typedef struct scale2 Scale2
typedef struct viewParm ViewParm
typedef struct seriesParm SeriesParm

Functions

void WriteMsg (const char *msg, int wh)
 Send a message to a debug file or to the console.
void usrErr (const char *dString)
 Send a message to the console.
void usrErr0 (const char *dString)
 Send a message to the console.

Variables

int SensiOn
struct simTime SimTime
char msgStr [MAX_MSG_SIZE]
float dt
float sfstep
float gwstep
float canstep
int hyd_iter
unsigned char * ON_MAP
float CELL_SIZE
float celWid
float sq_celWid
int s0
int s1
int debug
int dynERRORnum
int isPTSL
int isModExperim


Detailed Description

Header file for global data/functions.

This defines or declares variables & functions that are global to the model.

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

The Everglades Landscape Model (ELM).
last updated: Sep 2007

Definition in file globals.h.


Define Documentation

#define VOIDP   void*

Definition at line 201 of file globals.h.

Referenced by nalloc().

#define HDF   0

boolean flag to indicate use of (compile/link to) NCSA's Hierarchical Data Format, outdated version 3. NOTE: June 2008 (v2.8.2): do not define HDF to true until until the code is updated in Serial.c for printing to text-window - that code needs to be updated to HDF4 before it will compile and be used

Definition at line 203 of file globals.h.

#define HDF4   0

boolean flag to indicate use of (compile/link to) version 4 of NCSA's Hierarchical Data Format. NOTE: June 2008 (v2.8.2): HDF4 libs and includes not provided as part of ELM distribution, so this should always be false for distributions of ELM

Definition at line 209 of file globals.h.

Referenced by write_map_file().

#define NCDF3   1

boolean flag to indicate use of (compile/link to) version 3 (3.6.2, June 2008) of Unidata's NetCDF (Network Common Data Form). NOTE: June 2008 (v2.8.2): NCDF3 libs and includes not provided as part of ELM distribution, so this should always be false for distributions of ELM. User must download netcdf libs and includes, test them using some other software such as ncview, then set this define NCDF3 to "true" (1), and edit the ELM's Driver.make makefile to point to the paths to the new libs & includes, compile and run the ELM with netcdf capabilities

Definition at line 212 of file globals.h.

Referenced by write_map_file().

#define UNIX   1

(unused) UNIX boolean flag to indicate a unix operating system.

Definition at line 218 of file globals.h.

Referenced by Canal_Network_Init(), PTSL_ReadLists(), Read_schedule(), ReadChanStruct(), readOutlist(), ReadStructFlow_PtSer(), ReadStructTP_PtSer(), ReadStructTS_PtSer(), ReadStructures(), and write_map_file().

#define H_OPSYS   UNIX

define the operating system as UNIX NOTE: ELM is always in unix (used to run on Macintosh transputers) - code using this can be removed

Definition at line 219 of file globals.h.

Referenced by Canal_Network_Init(), PTSL_ReadLists(), Read_schedule(), ReadChanStruct(), readOutlist(), ReadStructFlow_PtSer(), ReadStructTP_PtSer(), ReadStructTS_PtSer(), ReadStructures(), and write_map_file().

#define kMAX   0

only used in case stmt in Combine (Serial.c)

Definition at line 222 of file globals.h.

Referenced by Combine().

#define kMIN   1

only used in case stmt in Combine (Serial.c)

Definition at line 223 of file globals.h.

Referenced by Combine().

#define kMAXMIN   2

only used in case stmt in Combine (Serial.c)

Definition at line 224 of file globals.h.

Referenced by calc_maxmin(), and Combine().

#define kSUM   3

only used in case stmt in Combine (Serial.c)

Definition at line 225 of file globals.h.

Referenced by Combine(), and print_loc_ave().

#define kAVE   4

only used in case stmt in Combine (Serial.c)

Definition at line 226 of file globals.h.

Referenced by Combine(), and print_loc_ave().

#define kSUMCUM   5

only used in case stmt in Combine (Serial.c)

Definition at line 227 of file globals.h.

Referenced by Combine(), and print_loc_ave().

#define kAVECUM   6

only used in case stmt in Combine (Serial.c)

Definition at line 228 of file globals.h.

Referenced by Combine(), and print_loc_ave().

#define MAX_PTSERIES   8000

maximum number of grid cells for Point Time Series output

Definition at line 231 of file globals.h.

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

#define MAX_TS_FILES   50

max # files (=variables) for writing Point Time Series output

Definition at line 232 of file globals.h.

#define MAX_MSG_SIZE   1200

maximum size of msg (message) string for messages to console or debug file

Definition at line 233 of file globals.h.

#define ISARRAY   0x8000

Definition at line 235 of file globals.h.

Referenced by readViewParms().

#define PMASK2   0x0200

Definition at line 236 of file globals.h.

Referenced by getPrecision(), and setPrecision().

#define PMASK1   0x0100

Definition at line 237 of file globals.h.

Referenced by getPrecision(), and setPrecision().

#define kCArgDepth   10

Sizes array of arguments to parse the output configuration file

Definition at line 239 of file globals.h.

Referenced by parse_packet().

#define kCArgWidth   50

Sizes array of arguments to parse the output configuration file

Definition at line 240 of file globals.h.

Referenced by parse_packet().

#define EOL   '\n'

Definition at line 243 of file globals.h.

Referenced by get_hab_parm(), and Read_schedule().

#define EOS   '\0'

Definition at line 244 of file globals.h.

Referenced by get_hab_parm(), Read_schedule(), Scip(), and Wrdcmp().

#define TAB   '\t'

#define POUND   ((UCHAR)0x23)

Definition at line 246 of file globals.h.

#define True   1

#define False   0

Definition at line 248 of file globals.h.

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

#define CASE   0

Definition at line 249 of file globals.h.

Referenced by write_map_file().

#define NOCASE   1

Definition at line 250 of file globals.h.

Referenced by check_for().

#define BEG   0

Definition at line 251 of file globals.h.

Referenced by check_for().

#define END   1

Definition at line 252 of file globals.h.

Referenced by write_map_file().

#define DT   dt

allow upper case definition of dt (primary model delta-time time step (d) )

Definition at line 254 of file globals.h.

Referenced by BIRbudg_print(), BIRbudg_sum(), BIRstats_hydro_print(), BIRstats_print(), BIRstats_sum(), cell_dyn1(), cell_dyn10(), cell_dyn12(), cell_dyn13(), cell_dyn2(), cell_dyn4(), cell_dyn7(), cell_dyn8(), cell_dyn9(), CellAvg(), and init_eqns().

#define T ( x,
 )     ((int)((x)*(s1+2)+(y)))

#define sec_per_day   86400.0

seconds per day, used in Manning's eqn

Definition at line 256 of file globals.h.

Referenced by Channel_configure(), and get_parmf().

#define PI   3.1415927

Definition at line 257 of file globals.h.

Referenced by cell_dyn1(), and init_eqns().

#define wetEndMon   9

gregorian-calendar month of end of wet season

Definition at line 258 of file globals.h.

Referenced by track_time().

#define wetEndDay   30

gregorian-calendar day of end of wet season

Definition at line 259 of file globals.h.

Referenced by track_time().

#define dryEndMon   4

gregorian-calendar month of end of dry season

Definition at line 260 of file globals.h.

Referenced by track_time().

#define dryEndDay   30

gregorian-calendar day of end of dry season

Definition at line 261 of file globals.h.

Referenced by track_time().

#define Abs (  )     (((x)>=0) ? (x) : -(x))

#define Cos (  )     cos((double)x)

Definition at line 264 of file globals.h.

Referenced by cell_dyn1(), and init_eqns().

#define Sin (  )     sin((double)x)

Definition at line 265 of file globals.h.

Referenced by cell_dyn1(), and init_eqns().

#define Tan (  )     tan((double)x)

Definition at line 266 of file globals.h.

Referenced by cell_dyn1(), and init_eqns().

#define Arctan (  )     atan((double)x)

Definition at line 267 of file globals.h.

Referenced by cell_dyn1(), and init_eqns().

#define Exp (  )     exp((double)x)

#define Max ( x,
 )     (((x)>(y))?(x):(y))

#define Min ( x,
 )     (((y)>(x))?(x):(y))

#define ramp (  )     (((x)>0)?(x):0)

#define sgn (  )     (((x)>=0) ? 1.0 : -1.0)

Definition at line 272 of file globals.h.

Referenced by f_Manning(), and FluxChannel().

#define conv_mgTOg   1.0e-3

conversion from mg to g

Definition at line 274 of file globals.h.

Referenced by init_eqns().

#define conv_gTOkg   1.0e-3

conversion from g to kg

Definition at line 275 of file globals.h.

Referenced by BIRbudg_sum().

#define conv_mgTOkg   1.0e-6

conversion from mg to kg

Definition at line 276 of file globals.h.

Referenced by init_eqns().

#define conv_kgTO_Mg   1.0e-3

conversion from kilograms to Megagrams

Definition at line 277 of file globals.h.

Referenced by BIRbudg_print().

#define conv_mgTOug   1.0e3

conversion from milligrams to micrograms

Definition at line 279 of file globals.h.

Referenced by BIRbudg_print().

#define conv_gTOmg   1.0e3

conversion from g to mg

Definition at line 280 of file globals.h.

Referenced by cell_dyn9(), and init_eqns().

#define conv_kgTOg   1.0e3

conversion from kg to g

Definition at line 281 of file globals.h.

Referenced by cell_dyn12(), cell_dyn13(), cell_dyn2(), cell_dyn4(), cell_dyn8(), cell_dyn9(), and init_eqns().

#define conv_kgTOmg   1.0e6

conversion from kg to mg

Definition at line 282 of file globals.h.

Referenced by BIRinit(), cell_dyn12(), cell_dyn2(), cell_dyn4(), cell_dyn8(), HabSwitch(), and ReadModExperimParms().

#define conv_inTOtenths_mm   254.0

conversion from inches to tenths of a mm

Definition at line 284 of file globals.h.

Referenced by evap_data_wmm(), and rain_data_wmm().

#define conv_ftTOm   0.3048

conversion from feet to meters

Definition at line 285 of file globals.h.

Referenced by stage_data_wmm().

#define conv_mTOcm   100.0

conversion from meters to cm

Definition at line 287 of file globals.h.

Referenced by BIRinit().

#define conv_cmTOmm   10.0

conversion from cm to mm

Definition at line 288 of file globals.h.

Referenced by BIRbudg_print().

#define conv_mTOkm   0.001

conversion from m to km

Definition at line 289 of file globals.h.

#define conv_northing_NAD27toNAD83   203.8

add to UTM (zone 17) NAD27 to get NAD83 (m), northing coordinates

Definition at line 292 of file globals.h.

Referenced by read_header().

#define conv_easting_NAD27toNAD83   21.3

add to UTM (zone 17) NAD27 to get NAD83 (m), easting coordinates

Definition at line 293 of file globals.h.

Referenced by read_header().

#define MAX_NHAB   255

maximum number of habitat (HAB) types

Definition at line 295 of file globals.h.

Referenced by get_hab_parm(), and HabSwitch().

#define MAX_SECTOR   30

maximum number of cell_dyn sectors (ecological modules)

Definition at line 296 of file globals.h.


Typedef Documentation

typedef int BOOL

Definition at line 35 of file globals.h.

typedef FILE* STREAM

Definition at line 36 of file globals.h.

typedef char* STRING

Definition at line 37 of file globals.h.

typedef unsigned char UCHAR

Definition at line 38 of file globals.h.

typedef unsigned char byte

Definition at line 39 of file globals.h.

typedef unsigned int UINT

Definition at line 40 of file globals.h.

typedef unsigned short USHORT

Definition at line 41 of file globals.h.

typedef long SLONG

Definition at line 42 of file globals.h.

typedef unsigned long ULONG

Definition at line 43 of file globals.h.

typedef struct prog_attr ProgAttr

Program attributes, with info on a the type of simulation run(s) within an execution of main program.

This is used for standard runs, sensitivity analyses, and others (e.g., stochastic processes) in future

typedef struct pTSeries PTSeries

Point time series spatial interpolation: unused ELMv2.3 (last used in v2.1)

typedef struct pTSeriesList PTSeriesList

Point time series spatial interpolation: unused ELMv2.3 (last used in v2.1)

typedef struct rPoint RPoint

Point time series spatial interpolation: unused ELMv2.3 (last used in v2.1)

typedef struct rPointList RPointList

Point time series spatial interpolation: unused ELMv2.3 (last used in v2.1)

typedef struct basndef basnDef

Basin/Indicator-Region attributes

typedef struct point3D Point3D

Point time series output, point attributes

typedef struct point2D Point2D

The grid location of a point

typedef struct scale1 Scale1

Model output configuration, scaling data

typedef struct scale2 Scale2

Model output configuration, scaling data (unused currently)

typedef struct viewParm ViewParm

Model output configuration data

typedef struct seriesParm SeriesParm

Point time series output configuration data


Function Documentation

void WriteMsg ( const char *  msg,
int  wh 
)

Send a message to a debug file or to the console.

Depending on when this function is called, messages are sent to one of two debug-related files, or to the console. During initial model set-up, the first (Driver0.out) debug-info file is used to print confirmation information on items such as init/end dates of simulation, the model parameter values that were read, etc. During later access to this function while the model is iterating, the second (Driver1.out) file is opened and accessed here, followed by the X'th for multi-run sensitivity analyses.

Parameters:
msg A string message for printing
wh Unused

Definition at line 1519 of file Driver_Utilities.c.

References Driver_outfile.

Referenced by cell_dyn1(), cell_dyn12(), cell_dyn2(), cell_dyn7(), cell_dyn8(), cell_dyn9(), Combine(), flowCalc_CanCan(), flowCalc_CanCel(), flowCalc_CelCan(), flowData_CanCan(), flowData_CanCel(), flowData_CelCan(), flowData_CelCel(), Flux_GWcells(), Flux_SWstuff(), FluxChannel(), get_global_parm(), get_hab_parm(), get_modexperim_parm(), get_Nth_parm(), get_parmf(), HabSwitch_Init(), main(), make_more_points(), print_point(), PTS_SetFields(), PTSL_ReadLists(), read_map_dims(), read_map_file(), read_model_parameters(), Read_schedule(), ReadModExperimParms(), readOutlist(), ReadStructures(), readViewParms(), SensiParm_list(), setup_grid(), write_map_file(), and write_output().

01519                                        {
01520   wh = 1;
01521   if(Driver_outfile) fprintf(Driver_outfile,"%s\n",msg);
01522   else fprintf(stdout,"%s\n",msg);
01523   fflush(stdout);
01524 }

void usrErr ( const char *  dString  ) 

void usrErr0 ( const char *  dString  ) 

Send a message to the console.

The message text is not followed by a line feed.

Parameters:
dString A string message to print

Definition at line 1530 of file Driver_Utilities.c.

Referenced by alloc_mem_stats(), alloc_memory(), horizFlow(), init_dynam_data(), init_eqns(), init_static_data(), main(), PtInterp_read(), rain_data_wmm(), read_model_parameters(), ReadModExperimParms(), ReadStructFlow_PtSer(), ReadStructTP_PtSer(), ReadStructTS_PtSer(), reinitBIR(), and reinitCanals().

01531 {
01532   fprintf(stderr,"%s", dString); 
01533   fflush(stderr);
01534 }


Variable Documentation

int SensiOn

boolean flag to signifiy sensitivity analysis is on/off

Definition at line 55 of file globals.h.

Referenced by get_parmf(), main(), Run_Canal_Network(), and track_time().

struct simTime SimTime

char msgStr[MAX_MSG_SIZE]

float dt

Variables associated with the model time and time steps

dt primary model delta-time time step (d)
sfstep time step (d) for horizontal surface water flows
gwstep time step (d) for horizontal ground water flows
canstep time step (d) for horizontal canal water flows

Definition at line 307 of file globals.h.

Referenced by get_parmf(), and track_time().

float sfstep

Definition at line 307 of file globals.h.

Referenced by Flux_SWstuff(), and get_parmf().

float gwstep

Definition at line 307 of file globals.h.

Referenced by Flux_GWcells(), and get_parmf().

float canstep

int hyd_iter

max number of horiz iterations per model primary (vertical) time step (dt)

Definition at line 308 of file globals.h.

Referenced by get_parmf(), horizFlow(), and Run_Canal_Network().

unsigned char* ON_MAP

float CELL_SIZE

Variables associated with the grid cell size

CELL_SIZE square grid cell size, m^2
celWid cell width, m
sq_celWid square root of cell width, m

Definition at line 317 of file globals.h.

Referenced by BIRbudg_sum(), BIRinit(), BIRoutfiles(), BIRstats_sum(), cell_dyn10(), cell_dyn12(), cell_dyn13(), cell_dyn2(), cell_dyn4(), cell_dyn7(), cell_dyn8(), cell_dyn9(), flowCalc_CanCel(), flowCalc_CelCel(), flowData_CanCan(), flowData_CanCel(), flowData_CelCan(), flowData_CelCel(), Flux_GWcells(), Flux_SWstuff(), FluxChannel(), get_parmf(), and init_eqns().

float celWid

float sq_celWid

Definition at line 317 of file globals.h.

Referenced by get_parmf().

int s0

int s1

int debug

debug Value (0 - 5) indicates the debug level for warning/error checking & writing to console and debug files.

At debug >=0 (i.e., always), print critical ERROR violations to DriverX.out (for X'th simulation run) debug file. An increasing amount of information is printed with increasing debug level:

  • debug =0 Echo short console info on iteration# etc, print critical error/warning info. USE WITH CAUTION.
  • debug =1 Report mis-configured basin flows. Currently same level as debug=2.
  • debug =2 DEFAULT for general use, more warnings etc.
  • debug =3 Echo long console output, prints additional (non-critical) errors/warnings to DriverX.out (for X'th simulation run) file
  • debug =4 Prints details of cell vertical and/or horizontal flux data, and details of indiv canal fluxes, to DriverX.out (for X'th simulation run)
  • debug =5 Prints grid_map information, and prints to another canal debugging file for special purposes

Definition at line 332 of file globals.h.

Referenced by Canal_Network_Init(), cell_dyn1(), cell_dyn12(), cell_dyn2(), cell_dyn7(), cell_dyn8(), cell_dyn9(), evap_data_wmm(), flowCalc_CanCan(), flowCalc_CanCel(), flowData_CanCan(), flowData_CanCel(), flowData_CelCan(), flowData_CelCel(), Flux_GWcells(), Flux_SWstuff(), FluxChannel(), get_Nth_parm(), get_parmf(), getCombineIndex(), main(), make_more_points(), print_point(), PTS_SetFields(), PTSL_ReadLists(), quick_look(), rain_data_wmm(), read_map_dims(), read_map_file(), readMap(), readSeriesCol(), readViewParms(), returnData(), Run_Canal_Network(), stage_data_wmm(), write_map_file(), and write_output().

A counter of the cumulative number of ERRORS in dynamic calculations - used to abort (after allowing enough to understand problem)

Definition at line 333 of file globals.h.

Referenced by cell_dyn12(), cell_dyn2(), cell_dyn7(), cell_dyn8(), cell_dyn9(), flowCalc_CanCan(), flowCalc_CanCel(), flowCalc_CelCan(), flowData_CanCan(), flowData_CanCel(), flowData_CelCan(), flowData_CelCel(), Flux_GWcells(), Flux_SWstuff(), FluxChannel(), and main().

int isPTSL

TRUE means use PoinT data to generate on-the-fly time series of interpolated maps of meteorological inputs; FALSE means use gridIO SFWMD data

Definition at line 336 of file globals.h.

Referenced by cell_dyn1(), and main().

TRUE means use parameters for special model experiments; FALSE means that parameter file is not read, and the parameters are defaulted to have no effect on simulation

Definition at line 337 of file globals.h.

Referenced by Flux_GWcells(), Flux_SWcells(), main(), and ReadModExperimParms().


Generated on Sat Jan 7 14:04:31 2012 for ELM source code by  doxygen 1.5.6