Internals

This section gives an overview of the data structure used in Asynch and mostly intended for the project maintainers.

struct

This is the main structure that holds the state of the server and associated data structures for a simulation.

Public Members

MPI_Comm AsynchSolver::comm

COMM on which the solver works.

int AsynchSolver::np

Number of procs in the comm.

int AsynchSolver::my_rank

This processes rank in the comm (varies by proc)

ErrorData *AsynchSolver::errors_tol

Object for global error data.

GlobalVars *AsynchSolver::globals

Global information.

Link *AsynchSolver::sys

Network of links.

RKMethod **AsynchSolver::AllMethods

List of RK methods.

TransData *AsynchSolver::my_data

Data for communication between procs.

short int *AsynchSolver::getting

List of data links to get information about.

int *AsynchSolver::assignments

Link with sys location i is assigned to proc assignments[i].

unsigned int *AsynchSolver::my_sys

Location in sys of links assigned to this proc.

unsigned int AsynchSolver::my_N

Number of links in sys assigned to this proc.

unsigned int AsynchSolver::N

Number of links in sys.

unsigned int AsynchSolver::nummethods

Number of methods in AllMethods.

unsigned int AsynchSolver::my_save_size

Number of links assigned to this proc in save_list.

unsigned int AsynchSolver::save_size

Number of links in save_list.

unsigned int *AsynchSolver::save_list

List of link ids to print data.

unsigned int **AsynchSolver::id_to_loc

Lookup table to convert from ids to sys locations.

TempStorage *AsynchSolver::workspace

Temporary workspace.

char AsynchSolver::rkdfilename[ASYNCH_MAX_PATH_LENGTH]

Filename for .rkd file.

FILE *AsynchSolver::outputfile

File handle for outputing temporary data.

FILE *AsynchSolver::peakfile

File handle for the peakflow data.

ConnData AsynchSolver::db_connections[ASYNCH_MAX_DB_CONNECTIONS]

Database connection information.

Forcing AsynchSolver::forcings[ASYNCH_MAX_DB_CONNECTIONS-ASYNCH_DB_LOC_FORCING_START]

Forcing information.

struct

Structure to contain all data that is global to the river system.

Public Members

unsigned short int GlobalVars::type

Index for the model used.

double GlobalVars::maxtime

Integrate up to this time (duration)

double GlobalVars::t_0

Initial time to start integration.

unsigned int GlobalVars::start_time

Unix start time.

unsigned int GlobalVars::end_time

Unix end time.

unsigned short int GlobalVars::method

RK method to use (if it is the same for all links)

unsigned short int GlobalVars::max_s

The largest number of internal stages of any RK method used !!!! Is this needed? !!!!

unsigned short int GlobalVars::max_parents

The largest number of parents any link has.

int GlobalVars::iter_limit

If a link has >= iter_limit of steps stored, no new computations occur.

int GlobalVars::max_transfer_steps

Maximum number of steps to communicate at once between processes.

unsigned int GlobalVars::discont_size

Size of discont, discont_send, discont_order_send at each link.

unsigned int GlobalVars::max_localorder

Max local order of implemented numerical methods.

unsigned short int GlobalVars::uses_dam

1 if this type can use dams, 0 else

VEC GlobalVars::global_params

List of global parameters.

unsigned int GlobalVars::params_size

Size of params at each link without a dam.

unsigned int GlobalVars::dam_params_size

Size of params at each link with a dam.

unsigned int GlobalVars::disk_params

Number of parameters to read from disk.

unsigned int GlobalVars::area_idx

Index of upstream area (A_i) in params.

unsigned int GlobalVars::areah_idx

Index of hillslope area (A_h) in params.

unsigned short int GlobalVars::init_flag

0 if reading .ini file, 1 if reading .uini file, 2 if reading .rec file

unsigned short int GlobalVars::rvr_flag

0 if reading .rvr file, 1 if using database

unsigned short int GlobalVars::prm_flag

0 if reading .prm file, 1 if using database

double GlobalVars::print_time

Each link will write state every print_time minutes. -1 uses a formula.

unsigned short int GlobalVars::print_par_flag

0 to use specified name for output files, 1 to add parameters

unsigned short int GlobalVars::dam_flag

0 if not using .dam file, 1 if using

unsigned short int GlobalVars::hydrosave_flag

0 if not saving hydrographs, 1 if saving

unsigned short int GlobalVars::peaksave_flag

0 if not saving peak flows, 1 if saving

char *GlobalVars::peakfilename

Filename for .pea file.

unsigned int GlobalVars::outletlink

For database: holds the link id of the outlet. Use 0 if reading entire database.

unsigned int GlobalVars::string_size

Size of filename buffers.

unsigned int GlobalVars::query_size

Size of database query buffers.

unsigned short int GlobalVars::convertarea_flag

1 if hillslope and upstream areas are converted from km^2 to m^2, 0 if not

double GlobalVars::discont_tol

The error tolerance to use for locating discontinuities.

unsigned int GlobalVars::min_error_tolerances

The minimum number of error tolerances needed at every link. Used for uniform error tolerances.

double GlobalVars::dump_time

Each link states will dump every dump_time minutes.

unsigned int GlobalVars::num_states_for_printing

Number of states used for printing.

unsigned int GlobalVars::num_print

Number of outputs.

unsigned int *GlobalVars::print_indices

List of indices in solution vectors where data is written to output (size is num_states_for_printing)

struct

Structure to hold information about an PostgreSQL database.

Public Members

PGconn *ConnData::conn

Connection to a database.

char ConnData::connectinfo[ASYNCH_MAX_CONNSTRING_LENGTH]

Connection information for a database.

char ConnData::query[ASYNCH_MAX_QUERY_LENGTH]

Buffer space for making queries.

unsigned int ConnData::time_offset

Added to the integration time to get the actual unix time.

struct

Holds the error estimation information for a link.

See Hairer, E. and Norsett, S.P. and Wanner, G., Solving Ordinary Differential Equations I, Nonstiff Problems.

Public Members

double ErrorData::facmax

Parameter for error estimation.

double ErrorData::facmin

Parameter for error estimation.

double ErrorData::fac

Parameter for error estimation.

VEC ErrorData::abstol

Absolute tolerance.

VEC ErrorData::reltol

Relative tolerance.

VEC ErrorData::abstol_dense

Absolute tolerance for dense output.

VEC ErrorData::reltol_dense

Relative tolerance for dense output.

struct

This structure holds all the data for a forcing in the river system.

Public Members

unsigned int Forcing::raindb_start_time

This is the unix time corresponding to the local intergrator time 0.

unsigned int Forcing::good_timestamp

A timestamp in the db where a forcing actually exists.

unsigned int Forcing::next_timestamp

Holds the next timestep to use for pulling data.

unsigned int Forcing::lastused_first_file

The value of first_file when the GetPasses routine was last called. 0 if never set.

unsigned int Forcing::lastused_last_file

The value of last_file when the GetPasses routine was last called. 0 if never set.

unsigned int Forcing::number_timesteps

The number of times which feature a forcing at some link.