ebook img

Microcomputer Programs for Groundwater Studies PDF

261 Pages·1987·3.343 MB·iii-v, I\261
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Microcomputer Programs for Groundwater Studies

MICROCOMPUTIR PROGRAMS fOR GRoUNDWAIIR BIUDIIB DAVID CLARKE 20 Musgrave Street, Crystal Brook, S.A. 5523(Australia) ELSEVIER Amsterdam - Oxford - New York - Tokyo 1987 ELSEVIER SCIENCE PUBLISHERS B.V. SaraBurgerhartstraat 25 P.O. Box 211, 1000AE Amsterdam,TheNetherlands Distributorsforthe UnitedStatesand Canada: ELSEVIER SCIENCE PUBLISHING COMPANY INC. 52, VanderbiltAvenue NewYork,N.Y. 10017,U.S.A. ISBN 0-444-42793-7 (Vol.30) ISBN 0-444-41669-2 (Series) ©ElsevierScience Publishers B.V., 1987 All rights reserved. No part of this publication may be reproduced, stored ina retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or other wise, without the priorwrittenpermissionof the publisher, ElsevierSciencePublishers B.V./Science& Technology Division, P.O. Box330,1000AH Amsterdam,The Netherlands. Special regulations for readers in the USA - This publication hasbeen registered with theCopyright Clearance Center Inc. (CCC), Salem, Massachusetts. Information can beobtainedfrom the CCCabout conditons under which photocopies of parts of this publication may be made in the USA. All other copyright questions, including photocopying outside of the USA,should bereferred to the publisher. Printed in The Netherlands Appreciation I must thank my former boss, Michael Cobb, for the encouragement that he give me in developing the programs that preceded these. Peter Pavy drew the line drawings that I found too difficult. His draw- ings are the professional looking ones. Thankyou Peter. Thanks are also due to my employer, The South Australian Department of Mines and Energy, for putting in a position where the writing of the me program, and then the book, became the obvious course of action. I'm grateful to Carl McElwee, M. Cobb, and Munir A. Butt of the Kansas (USA) Geological Survey for the Fortran program on which is based the solution of the Leaky Well function in this work. Paul van der Heijde of the International Groundwater Modelling Center (Indiana, USA) offered very welcome encouragement in the earlier stages of the writing. Collin Hazel of the Queensland (Aust.) Water Resources Commission produced the description that allowed the writing of program for the Modified Sternberg Analysis in this book. More than any other, I thank my wife, Denece, a patient and under- standing computer widow, for her encouragement and help. Disclaimer While the programs in this book are given in the belief that they will give correct results if' they are used as instructed, no responsibility is assumed by the author or publisher for any errors, mistakes, misrepresent- or ations that may occur from the use of these programs, and no compensation can be given fbr any damages or whatever their cause. losses % Introduction 1.1 Introduction The primary aims of' this book are to provide a selection of subroutines and programs with as wide and as basic as possible an application to ground water science, and to explain their uperation. Readers familiar with micro computer programming may apply the programs given here to their ownwork, perhaps incorporating them as subroutines into larger, more specialized programs; and those unfamiliar with programming can use the programs as they are listed. The programs in this book are in no way a substitute for knowledge and experience in groundwater science. The aim is more to make complex procedures readily available to the practising hydrogeologist. Several procedures that are described in this book are not confined to groundwater in their application, but have been found to have a number of uses in groundwater. This is a practical book, written to solve real-life problems, overheads have therefore been kept to a minimum. The derivation of equations and functions are not described here, equations are taken from other sources and used here. For those readers Who want to check on derivations, references are given. The first programs to be described are functions usable as subroutines in practical applications. These are then used to solve typical groundwater problems. More functions and procedures are introduced, and applied in generally more involved groundwater situations as the reader progresses into the book. Aprogram to produce a disk file from discharge test data, and to analyse those data, is given later, as well as a program to graph the data. An analytical model of changes in the piezometric surface due to a number of discharging or recharging wells is included. Most of the programs can be used with any set of consistent units. Where units are specified, they are metric (normally metres and days are the primary units used, although in order to follow common practice, minutes are used in discharge test analysis). The programs are designed to be run with little prior instruction. Prompts given by the computer should give sufficient information about what is required for the user to get right through a particular program with no more than an occasional reference to the written instructions. 1. THE USE OF MICROCOMPUTERS IN GROUNDWATER SCIENCE. Any complicated mathematical task not only can, but should be done by a computer if one is available because of the fallibility of humans in solving arithmetic operations. As well as almost never making arithmetical errors, computers are much qUicker in any arithmetical operation. (Programmers do make errors, as many as anyone else, but once the errors in a program have been found and removed, they will not recur.) I believe that a complex mathematical operation should be done manually only so that the person using it can fully understand it. Thenceforth it should be computerised. I.2 In~roduction The computer is a tool which has recently become available for our use. It should be used in any situation where it offers the best available method of achieving the desired result. 2. APPLICATION OF NUMERICAL/ANALYTICAL METHODS TO GROUNDWATER PROBLEMS. Geology in general, and hydrogeology especially, often involves applying numerical values to naturally occurring systems. ego An age to a rock form ation, a transmissivity to an aquifer. While in physics quantities may be known to high degrees of accuracy, hydrogeology uses approximations and generalizations. It is often not possible, or even desirable, to be totally accurate. ego The age of which part of the formation? - The transmissivity of which part of the aquifer, and in which direction? Answers will be required for these questions at times, but usually an approximate answer for the whole unit is all that is needed. The moment one applies a mathematical equation (ie. a model) to a ground water problem, even if that equation is as simple a Darcy's law (Bouwer, 1978), some simplifying assumptions must be made. Some common assumptions are; 1/ The porous medium is homogeneous. 2/ The piezometers used to monitor the system give values that are representative of a significant cross-section of the system rather than of just one point. 3/ Vertical flow within the aquifer is negligible. 4/ The aquifer is fully confined. 5/ The aquifer is of infinite extent. In reality these assumptions are very often not justified. If unjllstified simplifying assumptions are applied to a complex real world situation in order to obtain information on that system, then it foll~s that the information so obtained will at best be approximate. Only in an ideal (and therefore nonexistent) groundwater system will our methods of mathematical analysis give completely accurate answers. Hydrogeology is not, cannot be, an exact science. The skill of the competent and experienced hydrogeologist rests largely in his/her ability to make meaningful generalizations and approximations, and in knowing how far these can be pushed before errors become so great as to invalidate any conclusions that he/she may make. These arguments must be borne in mind in using the programs in this book. There seems to be a tendency among some people to take any numbers produced by a computer to be absolutely correct. There is a saying in computer science; "rubbish in - rubbish out". Youcannot expect the output of your computer to be better than it's input. In many cases errors in data will be magnified, and results will be less accurate than input. If all this sounds pessimistic and defeatist, then it is time for a note of optimism. Very often the bulk properties of an aquifer can be approximated by average figures in such a way as to produce a reasonable simulation of the behaviour of that aquifer under given conditions of Introduction 1.3 recharge or discharge. I've seen discharge test results from many wells that indicated an aquifer that behaved very similarly to an ideal infinite, confined, homogeneous, isotropic aquifer, at least for the duration of the test. In summary, I would like to make two suggestions. 1/ Don't expect five figure accuracy when using these programs to evaluate some aquifer parameter, often one figure, or even order of magnitude values may be both useful and the best that can be expected. 2/ Perhaps mathematical rigour should take second place to seat of the pants empiricism at times? 3. THE BASIC COMPUTER LANGUAGE AS USED IN THIS BOOK. Basic is universally used as the first language of microcomputers. It's greatest advantages over other languages are it's capability to interact with the programmer, and it's ease of debugging. It's greatest disadvantage is it's lack of any enforced structure. Anystructure in a Basic program is present due to a conscious effort from the programmer. There are a number of versions of Basic that have been implemented in modern microcomputers. In most cases they vary only in which key words are recognised. The form of Basic used here will suit most micros other than the cheap, games orientated machines. Most of these programs could be readily rewritten to run on a more limited Basic, but it was thought likely that readers interested in serious use of microcomputers would have access to machines with a good version of Basic. ~. GETTING STARTED. I will assume that you knowhow to setup your computer, this book is not the place for that sort of instruction. Nor is this the place for detailed instructions on the use of the Basic interpreter, you may find that you will have to refer to your Basic manual, especially if you decide to type the programs in from the listings in the book. 1/ Load your Basic interpreter. In most cases this will involve making sure that you have a disk with Basic on it in the computer, and then typing "Basic", or perhaps "Gwbasic", then pressing the enter key. 2/ If you have the programs on disk, put that disk in the computer and type 'Load"filename'" (the double quotes are required) where filename is the name as it appears in this book. Your computer may require either '/bas', or '.bas' to be appended to filename, inside the quotes. 3/ If you want to type in the program, do so now, following the directions in your Basic manual. Before switching off the computer, take care to save the program to disk; or at least save Whatever part of the program that you type in in one session. ~I Type the word "run", and press enter. Now the program will take control. 51 If you are using an IBM or compatible, you can at any time temporarily delay the program execution by holding down the 'Ctrl' key, and at the same time pressing 'Num Lock'. Other computers may have other methods 1.4 Introduction of achieving the same result. Pressing any key will then resume execution of the program, and the display and printout should not be affected. 6/ Again, if you are using an IBM or compatible, if you want to stop the program and return to the Basic command level at any time, hold down 'Ctrl' and press 'Break'. This allows you to interact with the computer at any time in a program, perhaps to check the contents of variables. Typing 'cont' and pressing the Enter key will resume program execution, but in this case the display will be affected. 7/ All the programs in this book are designed to terminate at the end of their particular function, or when instructed to by the operator. At that time you will be returned to the Basic command level. 5. THE PROGRAMS ON DISK. To avoid the tedious job of typing the programs in from the listings, you may purchase them on a thirteen centimetre double sided floppy disk for (Australian) $100 from the author at Clarke Computer Services, 20 Musgrave St., Crystal Brook, S.A., Australia, 5523. The disk is in a format compatible with an IBM PC. The programs will run on many other computers, and it may be possible to have the disk put into a format compatible with your computer, especially if it is either a MS DOS machine, or a CP/M machine, however, this will incur an additional cost. The programs detailed in this book total some 10 000 lines of code or more. I have no doubt that, even after many, many, hours of testing and improving, there are still some bugs to be found, and many improvements that could be made. Therefore I intend to make the latest versions of the programs available on a second disk for a price around (Aust.) $25. (This being for those who have purchased the original. Others could, of course, have both for $125.) The prices are subject to change without notice, and do not include postage and packing. If any errors are found in any of the programs after the time that this book goes to print, those errors will be corrected in the programs on disk, and details given in a file named "READ.ME" on the disk. The programs on the distribution disk are in ASCII format for greater compatibility. This will cause them to be relatively slow to load. After loading each program into Basic from the distribution disk, save it to another disk in your own computers condensed form. (This is the default mode that your computer will use unless instructed otherwise.) Do not use the distribution disk for general work, after copying the programs from it onto another disk, put it away in a safe place. The programs will load from your copies more quickly than from the distribution disk; unless you make copies using a Dos command rather than with Basic. 6. REFERENCE Bouwer, H., (1978). Groundwater Hydrology. McGraw-Hill Kogakusha, Ltd. 480 pp. Functions 1.1 Chapter 1 Over the last sixty years several functions have been developed that have proved to have wide and fundamental importance in groundwater science. Functions like the Gausian Error Function have been found to have more limited use. Computer programs yielding solutions to some of these are described in this chapter. Although these programs do not solve any practical problems alone, later chapters will show that they can be put to use in a number of field applications. 1. THE WELL FUNCTION Theis (1935) adapted an equation from heat flow theory to describe the lowering of the piezometric surface on pumping from a well fully penetrating a confined aquifer. His equation (used in a form suitable for giving answers in field applications in the next chapter) includes an integral with the solution: 2 3 u u W(u) = -0.577216 -In u + u +--- (1.1) 2 21 3 31 The variables W(u) and u will be defined in chapter 2. It is quite possible to evaluate this equation by programming it directly into a microcomputer, but there are several disadvantages. The larger the value of u, the more terms must be included. With u greater than about 10 to 15, (quite common in real cases, as the distance from the discharging well to the point of observation becomes large) some of these terms are very large although the well function itself is very small. This is a classic case where round-off error due to addition or subtraction can arise, (see Appendix II). Also, when more than a few of the terms must be considered, the method becomes slow. There is a better method. Huntoon (1980) described the use of two polynomial approximations which gave values sufficiently close to be quite acceptable for most, if not all, field applications. for 0<=u<=1 W(u) -In u + Co (1.2) and for 1<=u< infinity W(u) (1.3) u u e 1.2 Functions where C =-0.57721566, co = 0.99999193, 1 C =-0.24991055, 2 C = 0.05519968, 3 C =-0.00976004, 4 C = 0.00107857, 5 C 0.250621, 6 C 2.334733, 7 C 1.681534, 8 C 3.330657, 9 -7 and the error in (1.2) is less than plus or minus 2x10 ,and in (1.3) is -5 u less than plus or minus 5x10 I(ue). 1.1. Program WELLFUNC WELLFUNC uses these approximations to solve the Well Equation. Several techniques have been employed to improve speed in this program. While not strictly required here (execution passes through the body of the program once only) maximum speed will later be needed when this program is used as a subroutine of more involved procedures, and is called many times during program execution. Note in the program listing later in this chapter that numerical constants are not used within the equations, the exponentiation function has been avoided, and at the same time the number of multiplications have been kept to a minimum. (See Appendix B for an explanation). This is probably a good time to make a few comments on programming style (See also Appendix C). It is not enough that a program should do the job it is designed to do, it should also be as clear and as easily understandable as possible. It should be' clear, not only so that people new to it can understand it, but clarity makes it much easier for the author himself (or herself) to come back at some later date and modify it. Aprogram is more easily understood if it is structured. This program has ten distinct parts. 11 The program name (in line 1). Followed by the date of the last modification. 21 An initialization section (lines 10 to 90), including a preliminary print statement. In this case it tells people what the program does, and gives them some indication that something is happening while the computer is loading the variables. (The faster computers will not show any significant delay.) 31 Program control (lines 200 to 280). This part could be thought of as being in overall command of the program, it controls the sequence of the major program operations by calling various subroutines with clearly defined functions. Program flow should be relatively easily understood by studying the control 'section. 41 The part of the program that actually does the work of coming up with the answer (lines 2500 to 2550). In this case there is only one part to it, in more complex programs this section will call other subroutines as well Functions 1.3 as itself being larger. It is not at all uncommon for this, the heart of the program, to make up a small part of the total. The other parts of the program could perhaps be thought of as worker bees, and this the queen bee. The rest of the program exists to prepare the data and environment for the queen; it feeds the queen, and takes away the products of the queen. 5/ Input section (lines 7000 to 7020). Very simple in this case, and could have been included in program control, but in other cases well worth an extra subroutine. 6/ Video output section (lines 7250 to 7270). Again, very simple in this case. 7/ A section to load the values into the variables (lines 8600 to 8650). 8/ An error message informing the user that he or she has made an invalid entry (lines 9000 to 9020). In a larger program, this could be called from a number of places. 9/ The end statement (line 9999). For the sake of consistency, and understandability, it is worth having a single end statement, and at the end of the main body of the program is the most logical location. It is probably also a good idea to have only one return statement from a subroutine. Generally both of these practices have been followed in this book. Note that by keeping line numbers below 10000, five figure line numbers are avoided, with consequently less typing in the debugging stage. The operation of this program, as far as the user is concerned, is very simple. When the program is run the uer will be asked to enter a value of u. (It is usual practice to represent the function input as u, and output as W(u)). After typing the number and pressing the <RETURN> key, (which is alternately labelled ENTER, NEW LINE, or END LINE on various computers) the value of the function will be given. The user may then enter another value of u, or terminate the program. The program has been checked against published tables of values for the -15 well function for values of u raning from 10 up to nine. In all tests the values given by the program agreed exactly with the published figures, which were of three or four significant figures. 1.2. Program verification Some values are given below so that users may check the operation of the program. u W(u) 1E-15 33.96 1E-10 <'2.45 1E-4 8.633 1E-2 4.038 0.1 1.823 1 0.2194 5 1.148E-3 9 1.245E-5

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.