Internals

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

struct AsynchSolver

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

Public Members

MPI_Comm comm

COMM on which the solver works.

int np

Number of procs in the comm.

int my_rank

This processes rank in the comm (varies by proc)

ErrorData *errors_tol

Object for global error data.

GlobalVars *globals

Global information.

Link *sys

Network of links.

RKMethod **AllMethods

List of RK methods.

TransData *my_data

Data for communication between procs.

short int *getting

List of data links to get information about.

int *assignments

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

unsigned int *my_sys

Location in sys of links assigned to this proc.

unsigned int my_N

Number of links in sys assigned to this proc.

unsigned int N

Number of links in sys.

unsigned int nummethods

Number of methods in AllMethods.

unsigned int my_save_size

Number of links assigned to this proc in save_list.

unsigned int save_size

Number of links in save_list.

unsigned int *save_list

List of link ids to print data.

unsigned int **id_to_loc

Lookup table to convert from ids to sys locations.

TempStorage *workspace

Temporary workspace.

char rkdfilename[ASYNCH_MAX_PATH_LENGTH]

Filename for .rkd file.

FILE *outputfile

File handle for outputing temporary data.

FILE *peakfile

File handle for the peakflow data.

char peakfilename[ASYNCH_MAX_PATH_LENGTH]

Filename for .pea file.

ConnData db_connections[ASYNCH_MAX_DB_CONNECTIONS]

Database connection information.

Forcing forcings[ASYNCH_MAX_DB_CONNECTIONS-ASYNCH_DB_LOC_FORCING_START]

Forcing information.

struct GlobalVars

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

Public Members

unsigned short int type

Index for the model used.

double maxtime

Integrate up to this time (duration) [minutes].

double t_0

Initial time to start integration.

double t

Current time of integration.

time_t begin_time

Unix begin time.

time_t end_time

Unix end time.

unsigned short int method

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

unsigned short int max_s

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

unsigned short int max_parents

The largest number of parents any link has.

int iter_limit

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

int max_transfer_steps

Maximum number of steps to communicate at once between processes.

unsigned int discont_size

Size of discont, discont_send, discont_order_send at each link.

unsigned int max_localorder

Max local order of implemented numerical methods.

unsigned short int uses_dam

1 if this type can use dams, 0 else

VEC global_params

List of global parameters.

unsigned int params_size

Size of params at each link without a dam.

unsigned int dam_params_size

Size of params at each link with a dam.

unsigned int disk_params

Number of parameters to read from disk.

unsigned int area_idx

Index of upstream area (A_i) in params.

unsigned int areah_idx

Index of hillslope area (A_h) in params.

unsigned short int init_flag

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

unsigned short int rvr_flag

0 if reading .rvr file, 1 if using database

unsigned short int prm_flag

0 if reading .prm file, 1 if using database

double print_time

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

unsigned short int print_par_flag

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

unsigned short int dam_flag

0 if not using .dam file, 1 if using

unsigned short int hydrosave_flag

0 if not saving hydrographs, 1 if saving

unsigned short int peaksave_flag

0 if not saving peak flows, 1 if saving

char *peakfilename

Filename for .pea file.

unsigned int outletlink

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

unsigned int string_size

Size of filename buffers.

unsigned int query_size

Size of database query buffers.

unsigned short int convertarea_flag

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

double discont_tol

The error tolerance to use for locating discontinuities.

unsigned int min_error_tolerances

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

double dump_time

Each link states will dump every dump_time minutes.

unsigned int num_states_for_printing

Number of states used for printing.

unsigned int num_outputs

Number of outputs.

unsigned int *print_indices

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

struct ConnData

Structure to hold information about an PostgreSQL database.

Public Members

PGconn *conn

Connection to a database.

char connectinfo[ASYNCH_MAX_CONNSTRING_LENGTH]

Connection information for a database.

char query[ASYNCH_MAX_QUERY_LENGTH]

Buffer space for making queries.

unsigned int time_offset

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

struct ErrorData

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 facmax

Parameter for error estimation.

double facmin

Parameter for error estimation.

double fac

Parameter for error estimation.

VEC abstol

Absolute tolerance.

VEC reltol

Relative tolerance.

VEC abstol_dense

Absolute tolerance for dense output.

VEC reltol_dense

Relative tolerance for dense output.

struct Forcing

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

Public Members

unsigned int raindb_start_time

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

unsigned int good_timestamp

A timestamp in the db where a forcing actually exists.

unsigned int next_timestamp

Holds the next timestep to use for pulling data.

unsigned int lastused_first_file

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

unsigned int lastused_last_file

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

unsigned int number_timesteps

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