|
|
|
Qual2e99, A Water Basin Modeling Package
Charles R. Nippert Abstract Modeling stream water quality is an important aspect of environmental simulation. A popular simulation that is used in this area is the QUAL2E package originally distributed by the EPA. This paper describes an enhanced version of the model, QUAL2E99, which features a convenient graphical user interface, sensitivity analysis and Monte Carlo simulation add-ons. In addition, the original source code has been translated into C++. The resulting program runs under Windows 95, 97. The program can be downloaded at the authors web-site: www2.wdieder.edu/~crn0001
Introduction The QUAL2E model is a comprehensive, easy to use stream water quality model that was originally promulgated by the EPA. The model can simulate up to 16 stream constituents:
The model is applicable to dendritic (tree structured) streams that can be assumed to be well mixed over narrow regions. It is limited, however, to time periods in which the liquid flows are essentially constant. It can operate in either a steady state or dynamic mode (although the steady state mode is recommended for Monte Carlo and sensitivity studies). Results from the QUAL2E99 translation have been compared to results from the original executable distributed by the EPA to verify the accuracy of the translation.
Background and Description The QUAL2E model of water quality has gone through many revisions since the earliest mainframe version was first written in Fortran in the early 70s. In the early 1970 s F.D. Maasch and Associates developed the original QUAL-I model for the Texas Water Development Board. Water Resource Engineers converted this program to QUAL-II by water resource engineers in 1972. The enhanced version was converted to QUAL2E. In the mid 1990s, the EPA placed the FORTRAN source code on the Internet. Since then a variety of workers have developed modifications. At that time, the FORTRAN source code was translated into C++ and a new user interface was written at Widener University. The model was translated into C++ to allow for future transport to other platforms. Also this translation allowed the use of a popular and powerful compiler (Borland C Builder). One notable lack in the code released by the EPA was the sensitivity and Monte Carlo simulation package (UNCAS). Neither the code nor the executable for this portion of the package were released over the Internet. Therefore, it was decided to rewrite these units from scratch. Since then, the EPA has also distributed an enhanced version of QUAL2E, called QUAL2E for Windows. This paper deals with the Widener version of QUAL2E (available at www2.widener.edu/~crn0001). QUAL2E 99 is composed of two separate modules; the first module used for developing a simulation and running a single instance of the simulation. The second module is used for sensitivity and Monte Carlo simulation.
How to Use QUAL2E99 QUAL2E99 runs under the Windows 95, 98 operating systems and is available from the authors web site (http://www2.widenere.edu/crn0001). It is contained in a zip file complete with installation routines and help file documentation. To install the program, copy the contents of the zip file to a temporary directory and run the setup program. The setup program adds icons to the program list and builds an association with the extension *.wqu for the QUAL2E99. The startup program does not add an association for *.dat (the extension used by the original QUAL2E program because that extension is also used by other applications. An important feature of QUAL2E99 is the graphical user interface that makes it easy to setup and visualize the stream model. The QUALE series models divide a basin into stretches of stream that have uniform hydraulic characteristics. These stretches are known as "Reaches". Each reach is further subdivided into computational elements of equal length throughout the basin known as "elements". Within each element, conditions are assumed to be uniform. Thus, the QUAL2E model of a stream can be approximated as a series of uniformly mixed continuous stirred tank reactors as shown in Figure 1 (next page). A water basin model is composed of 3 basic units:
These units can be used as building blocks to create complex dendritic (tree shaped) basins. Figure 1
Note that the lengths of the reaches are the length of a standard element (which is user defined) and the number of elements in the reach. The zip file comes with several demonstration files. The QUAL2E program can read data files prepared by some other versions of the program. Time did not permit testing all versions of the QUAL2E to see which have formats that QUAL2E99 can read. Within any reach there can be a point source or sink at any element. Point sources represent discharges, such as an industrial discharge, into the basin while point sinks represent a water leaving the basin (such as a municipal water supply). The Graphical User Interface (GUI) allows the images of these blocks to be easily created and positioned on the screen so that a schematic of a water basin is created (Figure 2 next page). The overall organization of the GUI is similar to software, such as HiSys, used in chemical process design. To create a basin model you must first determine from your data the size of an element and the organization of the basin model. Then create the basin in QUAL2E99. After opening the program, click anywhere on the green field, a pop-up menu box opens. Click the unit you wish to create. When creating headwaters and reaches, a dialog box appears that allows you to enter a name for the unit and the number of elements in the unit. You will be able to enter properties for these units once the flow diagram for the basin is constructed. To draw a connection between any two units, click on one of the blocks you want to connect and select "connect" from the pop up menu. Then click on the second block. A line will appear between the two blocks. Add blocks until the basin is complete. As indicated in figure 1, any reach can accept water from up to two up stream blocks. All the streams must end in a single "Last" block, (shown in the lower center of Figure 2). Figure 2 Screen shot of a basin model in QUAL2E99
The user can examine or enter data for any reach by clicking on a reach and selecting "Reach data". Clicking anywhere on the screen and selecting "Basin data" from the pop up menu calls up a dialog that allows data for the basin conditions to be entered or examined. Once a basin has been created, the user can have the QUAL2E program perform the calculations associated. The zip file provides a choice of two calculation her the original executable distributed by the EPA or the executable created when the original code was translated to C++ (the C++ version allows more reaches and headwaters (50 vs. 25 reaches). Both calculations are performed by a separate executable that is called from the GUI. The basin model is automatically saved because the computational complexity of the model prevents the program from verifying that the calculation executable will run without crashing. Results from the C++ version can be read from the GUI. Graphical results of a variety of values are available as shown in Figure 3. The horizontal axis represents the reaches and their elements. Users can select headwaters and reaches to include in the the plot. Two values can be placed on the same plot. Tables of numerical data are saved as ASCII files that can be read by a word processor. Notepad is the default processor, however the user can select any word processor because the larger data files created in more complex basins may be too large for Notepad. Fig. 3.
Use of sensitivity program Sensitivity and Monte Carlo analyses are frequently used in water basin analysis to determine After a basin model has been successfully run, sensitivity analysis and Monte Carlo simulations can be made performed by a separate package the uses the C++ version of QUAL2E. UNCAS performed this feature was in the original QUAL2E model. The new version of the software also uses a separate program. The first step is to create a sensitivity analysis file (a *.sen file) that links to the .wqu file containing the basin model. The user can do this done by selecting the File/New option from the menu bar. The dialog will look like Fig. 4
Fig. 4
The user can select either sensitivity analysis (which adjusts variables by a fixed percentage) or Monte Carlo analysis for which user selected variables are picked following wither a preprogrammed distribution (uniform or truncated normal). Additionally, the user has the option of entering a distribution curve (as shown in figure 5) Figure 5
The user can also indicate the specific elements and groups of values for which output is monitored. Results of this package are written to files in ASCII format and can be viewed with any standard word processor.
Summary This paper has focused on the user interface of QUAL2E99. QUAL2E99 is a simple to use expansion of an existing water basin model useful for predicting contaminant levels. The package is intended to be a simple to use expansion of earlier computer programs. References:
|
|