June 5, 1997 Branch-Network Dynamic Flow Model BRANCH - Version: 4.3 1997/06/05 TRKPLOT - Version: 4.1 1997/03/05 SETDIMEN - Version: 4.1 1997/06/05 For assistance, enhancement requests, or bug reports contact the Hydrologic Analysis Software Support Team via email at h2osoft@usgs.gov. See the file doc\branch.txt for descriptions, references, and additional contacts for this software. Instructions for installation, execution, and testing are provided below. This version of BRANCH is packaged for use on personal computers using the DOS operating system. The installation procedures and the compiled version of BRANCH must be run using either DOS directly or a DOS window within Microsoft Windows, Windows 95, or Windows NT. TABLE OF CONTENTS A. DISTRIBUTION PACKAGES B. EXTRACTING FILES C. COMPILING D. INSTALLING E. RUNNING THE SOFTWARE F. TESTING A. DISTRIBUTION PACKAGES BRANCH is distributed as a package that contains the simulation model (branch) software, a software dimensioning program (setdimen), a post- processor program (trkplot), data sets, and information files. The software is available either uncompiled (source code), compiled only, or compiled plus source code. The following self-extracting DOS distribution files are currently available. brn4_3.exe - Compiled using Lahey Fortran 90 with source code brn4_3b.exe - Compiled using Lahey Fortran 90 (binaries only) brn4_3s.exe - Source code only See the file doc\brnupdt.pdf or doc\brnupdt.ps for the input specifications. Included in directory branch4.2\doc is a Portable Document Format (PDF) version and PostScript version of the BRANCH input specifications (brnupdt.pdf and brnupdt.ps). The PDF file is readable and printable on various computer platforms using Acrobat Reader from Adobe. The Acrobat Reader is freely available from the following World Wide Web sites: http://www.adobe.com/ http://www.shareware.com/ and by File Transfer Protocol (FTP) from the following site: ftp.adobe.com (path: /pub/adobe/acrobat) B. EXTRACTING FILES For whichever BRANCH distribution file that you have acquired, brn4_3.exe, brn4_3b.exe, or brn4_3s.exe, the directory branch4.3 is created (or overwritten) when the files are extracted. If the branch4.3 directory already exists, you may want to delete or rename it before extracting the files. The following are the steps to extract the files from a distribution file. Note, replace with the drive letter where you want to install BRANCH and optionally replace [directory] with the name of a directory on that drive: 1. If you are not in the directory where the distribution file is located, go there. For example (if already on the C disk drive): cd c:\wrdapp 2. Extract the files using the command: brn4_3 -d -o :\[directory] Substitute "brn4_3b" or "brn4_3s" for "brn4_3" if you are installing the executable-code-only or source-code-only distributions, respectively. Note, be sure to include the -d (restore directory structure) and -o (overwrite existing files) options and ":\" in the command. Examples are: brn4_3 -d -o c:\ brn4_3 -d -o c:\wrdapp The following directory structure will be created (the contents of each directory are shown to the right): branch4.3 ; copy of this readme file `-----bin ; compiled executables and Lahey error file `-----doc ; documentation files `-----src ; makefile and source code `-----test ; batch files to run verification tests `-----data ; standard data sets used in verification tests Notes: a) The bin directory is not included in the brn4_3s.exe distribution file (it is created during compilation). b) The executable is not included in the brn4_3s.exe distribution file. c) The source code is not included in the brn4_3b.exe distribution file. d) It is recommended that no user files are kept in the branch4.3 directory structure. If you do plan to put files in the branch4.3 directory structure, do so only by creating subdirectories of branch4.3. e) Brackets "[xxx]" are used to indicate optional arguments to commands. C. COMPILING The source code is provided in the brn4_3.exe and brn4_3s.exe distribution file so that users can generate the executables themselves. No support can be provided for users generating their own versions of the software. In general, the requirements are a Fortran compiler, utility library libutl6.0 (which includes screen prompting, device independent graphics, and Time-Dependent Data Base routines), partial CalComp graphics software, optional Watershed Data Management library (lib3.1) and NetCDF software, and a minimal level of knowledge of the compiler and the DOS operating system. As provided, the makefile and source code are optimized for use on a Pentium personal computer using the Lahey Fortran 90 compiler and Lahey supplied make program. The BRANCH program graphics are written using CalComp calls; the LIBUTL library includes routines to resolve some of these CalComp calls. Other CalComp calls (PLOTS, PLOT, NEWPEN, and FACTOR) must be provided by the user. The Lahey graph90 library contains these calls. The LIBUTL library also includes routines that translate CalComp calls to INTERACTOR calls. The makefile is coded to use the CalComp to INTERACTOR graphics library. If another CalComp library is available, BRANCH and the makefile could easily be modified to use it, rather than the default configuration. There are three options for data base support: TDDB, WDM, and (or) NetCDF. The TDDS data base routines are included in the libutl6.0 distributions. The WDM data base routines are included in the lib3.1 distributions. The model can produce NetCDF formatted files, but if this is desired, you will need the NetCDF libraries when compiling the software. The executable (branch) provided supports TDDB data base; it does not support NetCDF output. (See the USGS World Wide Web page at http://h2o.usgs.gov/software/ for information on TDDS and WDM.) To generate a new executable, do the following: 1. Change directory to the source directory: cd branch4.3\src 2. Modify the beginning of the file named makefile to correctly specify system-dependent variables: LibDir Top-level directory for LIBUTL software PlotObjs Object file for including or not including graphics INTDIR Path to Interacter libraries (required for WDM version) GRAPHLIB Graphics libraries ANNLIB Top-level directory for WDM software NetDir Top-level directory for NetCDF libraries CDFLib Pathname of NetCDF library (optional) CDFObjs set to either cdfout.o or cdfoutdm.o FFLAGS Fortran compiler flags FC Fortran compiler name LINKER Fortran linker name LNKFLGS Fortran linker flags OS Flag for operating system dependent include files 3. Use the make program to initiate compilation of the source code and installation of the software: make [BINDIR=directory_for_executable] See the Installing instructions below for an explanation of BINDIR. The make will: a. create the directory branch4.3\bin if it does not exist, b. compile the source code, c. place the executables (branch.exe, trkplot.exe, and setdimen.exe ) in branch4.3\bin, and d. place a copy of the executables in BINDIR if specified. D: INSTALLING To make the BRANCH program accessible from any directory, the directory containing the executable should be included in the PATH environment variable. For example, you could add a line similar to the following to the AUTOEXEC.BAT file: PATH=%PATH%;C:\branch4.3\bin Note, substitute the appropriate drive letter and pathname if not C:\ as shown above. As an alternative, the BRANCH executable can be installed in a directory already included in the PATH environment variable. The makefile (input instructions to the Lahey make program--located in branch4.3\src) contains instructions to optionally place a copy of the executable contained in branch4.3\bin in a specified directory. Use the following two commands to do this: cd branch_source_directory make install BINDIR=directory_for_executable For example: cd C:\branch4.3\src make install BINDIR=C:\wrdapp\bin Note, the makefile may need to be modified to be used with make programs other than the Lahey make program. E. RUNNING THE SOFTWARE **System Requirements** - 386-based or higher personal computer with math co-processor - 6 MB application RAM - 8 MB hard disk space BRANCH has been compiled using the Lahey Fortran 90 extended memory compiler version 3.00f. The file "LF90.EER" (from the Lahey compiler) located in branch4.3\bin contains error messages. If an error occurs, this file is used to print error messages if the branch4.3\bin directory is included in the PATH environment variable; if LF90.ERR cannot be found, the error will only be identified by number. After BRANCH is properly installed in a directory that is included in your PATH, the program is initiated using the command: branch. BRANCH requires that the names of files be assigned. The files that were last used with BRANCH in the current directory are retained in a "master" file for subsequent use. Input files may be pre-coded or portions of one file can be modified interactively during a BRANCH session. The BRANCH master file must be maintained in an order specific to the model. It may be manually edited only if the order of records and column positions within the file are retained. The model writes the master file after all files for a particular simulation have been designated. The following is an example master file: Input computation controls : ../data/branch4.ctl Output printed flow results : branch4.prt Input cross-sectional data : ../data/potomac.geo Input initial-condition data: ../data/potomac.ici Input TDDS station reference: Input/Output TDDS data base : Output initial conditions : branch4.ico Output for TRKPLOT input : Output digital plots : branch4.plt Output instantaneous volumes: branch4.ivo Output cumulative volumes : branch4.cvo Output instantaneous flows : Output map-formatted flows : Output flows for BLTM input : Output user-table results : F. TESTING Test data sets are provided to verify that the program is correctly installed and running on the system. The tests may also be looked at as examples of how to use the program. The directory branch4.3\test contains batch files to run the tests. The directory branch4.3\data contains the input data and expected results for each test. Run the tests in the branch4.3\test directory using the command: test After the tests are completed, the results can be compared to the expected results. If all has gone well, the only differences will be due to different processing times or pathnames. To clean-up after the tests, type the command: clean The tests are described in the table below. Test is the test number, program is the program used to run the test, and the usage column indicates how a file is used, with i for input, o for output, and i/o for both input and output. test program description of test and files file name & usage ---- ------- --------------------------------- ----------------- 1 branch Sacramento-Freeport model, create master file, all input in single file, output option 0, tabular function of eta demonstrated. program-control data branch1.ctl i responses to program prompts tst1 i printed results branch1.prt o 2 branch Sacramento-Freeport model, TWRI page 36 example, metric output, single file input, computed versus measured discharge, compare to figures 18 and 19 in TWRI. program-control data branch2.ctl i responses to program prompts go i printed results branch2.prt o 3 branch Sacramento-Freeport model, TWRI page 38 example, metric output, input split in two file, .ctl and .geo, compare to figure 20 in TWRI. program-control data branch3.ctl i geometry data branch3.geo i responses to program prompts go i printed results branch3.prt o 4 branch Potomac River model, 25 branches and 25 junctions, wind input, input split into three files-- .ctl, .geo, and .ici, constant nodal flow, 10 external boundaries-- 2 time-series 8 constant. Creates plot of computed discharge. At end of simulation outputs terminal conditions in same format as .ici. program-control data branch4.ctl i Identification and init conditions potomac.ici i geometry data potomac.geo i responses to program prompts go i Ident. and ending conditions branch4.ico o instantaneous flow volumes branch4.ivo o cumulative flow volumes branch4.cvo o printed results branch4.prt o 5 branch Potomac River model, 25 branches and 25 junctions, wind input, input split into three files-- .ctl, .geo, and .ici, constant nodal flow, 10 external boundaries-- 2 time-series 8 constant. Computes paths for 7 conservative particles. program-control data branch5.ctl i Identification and init conditions potomac.ici i geometry data potomac.geo i responses to program prompts go i binary file of particle paths branch5.pto o printed results branch5.prt o trkplot Execute particle-track plotting program, using branch5.pto as input. program-control data trkplot5.ctl i particle path file from test 5 branch5.pto i responses to program prompts go i printed results trkplot5.prt o 6 branch Potomac River model, 25 branches and 25 junctions, wind input, input split into three files-- .ctl, .geo, and .ici, constant nodal flow, 10 external boundaries-- 2 time-series 8 constant. Computes locations for 40 conservative particles along 4 different paths through river (10 particles in each path). program-control data branch6.ctl i branch id and initial conditions branch6.ici i geometry data potomac.geo i responses to program prompts go i binary file of particle paths branch6.pto o printed results branch6.prt o trkplot Execute particle-track plotting program, using branch6.pto as input. program-control data trkplot6.ctl i particle path from test 6 branch6.pto i responses to program prompts go i printed results trkplot6.prt o * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Good Luck! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *