





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of the history and development of computing systems, focusing on the concepts of mechanization of arithmetic and stored programs. It also introduces fortran as a high-level programming language and discusses its applications in hydrologic modeling. Topics such as acronyms, computing system development, software, fortran development, and fortran applications.
Typology: Study notes
1 / 9
This page cannot be seen from the preview
Don't miss anything!






Introduction to Computing and Basic Fortran
1. Miscellaneous Knowledge and Acronyms (primarily compiled from Nyhoff and Leestma [1996])
1.1. Acronyms
1.2. Development of Computing Systems
1.3. Terms
Hardware
Software
1.4. Development of Fortran
declaration statements executable statements END
The END statement informs the compiler that there are no further Fortran statements to compile.
Statements Statements form the basis of any Fortran program, and may contain from 0 to 132 characters (a statement may be blank; the use of blank statements is encouraged to make a program more readable by separating logical sections.) Earlier versions of Fortran insisted that certain parts of a statement start in certain columns; Fortran 90 has no such restriction.
All statements, except the assignment statement (e.g., BALANCE = 1000), start with a keyword. Some keywords may be END, PRINT, PROGRAM, and REAL. Generally, there will be one statement per line. However, multiple statements may appear on a line if they are separated by semi-colons. For the sake of clarity, this is recommended only with very short assignments, such as
A = 1; B = 1; C = 1
Continuation Long statements may continue over several lines. In Fortran 90, if a statement is too long to fit on a line, it will be continued on the next line if the last non-blank character in it is an ampersand (&):
A = 174.6 * & (T! 1981.2) ** 3
Continuation is normally to the first character in the next non-comment line. However, if the first non-blank character of the continuation line is &, continuation is to the first character after the &. In this way a token (tokens are the units, such as identifier/variable name, assignment or arithmetic operators, or integer constants, that are recognized and analyzed by a compiler to generate an object program) may be split over two lines, although this is not recommended, since it makes the code less easy to read.
An & at the end of a comment line will not continue the comment, since the & is construed as part of the comment.
In FORTRAN 77, the continuation of a line is indicated by a non-zero, non-blank character in the sixth column.
Comments Any characters following an exclamation mark (!) (except in a character string) are commentary, and are ignored by the compiler. An entire line may be a comment, if started with “C” or “*”or “!” in FORTRAN and with “!” in Fortran 90. A blank line is also interpreted as comment. Comments should be used liberally to improve readability.
2.2. Data Type
The concept of a data type is fundamental in Fortran 90. A data type consists of a set of data values (e.g., the whole numbers), a means of denoting those values (e.g., !2, 0, 999), and a set of operations (e.g., arithmetic, logic) that are allowed on them. The Fortran 90 standard requires five intrinsic or built-in data
types, which are divided into two classes. The numeric types are integer, real and complex. The non-numeric types are character and logical.
Associated with each data type are various kinds, defined depending on the number of bits available for storage, so that, for example, there might be two kinds of integer: short and long. In addition to the intrinsic data types, you may define your own derived data types, each with their own set of values and operations.
2.3. Names and Vairables
In Fortran, names indicate memory locations. In FORTRAN 77, names consist of no more than six (6) alphanumeric characters and must start with a letter. In Fortran 90, names can consist of between 1 and 31 alphanumeric characters and still must start with a letter. The alphanumeric characters are the 26 letters, the 10 digits, and the underscore (_). Names are case insensitive, except in the case of character strings. A name in a program must be unique.
A variable is a memory location whose value may be changed during execution of a program. A variable’s name is constructed following the aforementioned rules. A variable has a type that determines the type of number it may hold, as specified in a type declaration, e.g.,
INTEGER : : X REAL : : INTEREST CHARACTER : : LETTER REAL : : A = 1
2.4. An Example of Numeric Expression
Refer to the following numeric expression
U * T! G / 2 * T ** 2
It is a formula combining constants, variables and functions (e.g., exponential) using numeric intrinsic operators. It specifies a rule for computing a value (vertical distance, in this case). Since it only computes a single value it is a scalar numeric expression. There are five numeric intrinsic operators, ** for exponentiation, highest precedence; * for multiplication, / for division, lower precedence; + for addition, and ! for subtraction, lowest precedence. Typing blanks on either side of operators will make expressions more readable.
An operator with two operands, as in A + B, is called a binary or dyadic operator. When an operator appears with only one operand, as in !Z, it is called unary or monadic. The order in which operations in an expression are carried out is determined by the precedence of the operators, except that parentheses () always have the highest precedence. Since multiplication has a higher precedence than addition, this means, for example, that 1 + 2 * 3 is evaluated as 7, while (1 + 2) * 3 is evaluated as 9. Note also that !3 ** 2 evaluates to !9, not 9.
When operators with the same precedence occur in the same expression, they are with one exception always evaluated from left to right, so 1 / 2 * A is evaluated as (1 / 2) * A and not 1 / (2 * A). The exception to the precedence rules is that in an expression of the form
A ** B ** C
This means that there might be loss of precision. For example, assuming N is integer, and X and Y are real:
N = 10. / 3 (value of N is 3) X = 10 / 3 (value of X is 3.0) Y = 10 / 3. (value of Y is 3.33333)
The danger of performing integer divisions inadvertently cannot be stressed too much. For example, you might want to average two marks which happen to be integers M1 and M2. The most natural statement to write is
FINAL = (M1 + M2) / 2
but this operation loses the decimal part of the average. It is always safer to write constants as reals if real arithmetic is what you want:
FINAL = (M1 + M2) / 2.
References
Anderson, M.P., and W.W. Woessner, Applied Groundwater Modeling: Simulation of Flow and Advective Transport , Academic Press, San Diego, 1992. Beven, K.J., R. Lamb, P. Quinn, R. Romanowicz, and J. Freer, TOPMODEL, in Computer Models of Watershed Hydrology , edited by V.P. Singh, p. 627–668, 1995. Chapman, S.J., 1998, Fortran 90/95 for Scientists and Engineers , McGraw-Hill, Boston. Donigian, A.S., Jr., B.R. Bicknell, and J.C. Imhoff, Hydrologic Simulation Program - Fortran (HSPF), in Computer Models of Watershed Hydrology , edited by V.P. Singh, p. 395–442, 1995. Flerchinger, G.N., and K.E. Saxton, Simultaneous heat and water model of a freezing snow-residue-soil system I. Theory and development, Trans. ASAE. 32, 565–571, 1989. Hahn, B.D., Fortran 90 for Scientist and Engineers , Butterworth-Heinemann, Woburn, MA, 1994. Harbaugh, A.W., E.R. Banta, M.C. Hill, and M.G. McDonald, MODFLOW-2000, the US Geological Survey modular ground-water model—User guide to modularization concepts and the ground-water flow process: US Geol. Surv. Open-File Rep. 00-92 , 121 p., 2000. Knisel, W.G. (ed.), GLEAMS manual, ver. 2.10, UGA-CPES-BAED Pub. 5 , Univ. Georgia, Coastal Plain Experiment Station, Tifton, GA, 1993. Kramer, J.H., and S.J. Cullen, Review of vadose zone flow and transport models, Handbook of Vadose Zone Characterization & Monitoring , edited by L.G. Wilson, L.G. Everett and S.J. Cullen, Lewis Publishers, Boca Raton,
Leavesley, G.H., and L.G. Stannard, The Precipitation-Runoff Modeling System - PRMS, in Computer Models of Watershed Hydrology , edited by V.P. Singh, p. 281–310, 1995. Morris, C. (ed.), Academic Press Dictionary of Science and Technology , Academic Press, San Diego, 1992. Nyhoff, L., and S. Leestma, FORTRAN 77 for Engineers and Scientists , 4 th^ ed., Prentice Hall, Upper Saddle River, 1996. Singh, V.P. (ed.), Computer Models of Watershed Hydrology , Water Resources Publications, Highlands Ranch, 1995. The Fortran Company, Information, Source: URL , accessed in January,
Wanielista, M., R. Kersten, and R. Eaglin, Hydrology: Water Quantity and Quality Control , 2 nd^ ed., John Wiley & Sons, Inc., New York, 1997.
Lab 4 Assignment
1. Make connections ( 3.5 pts )
(1) John Backus (2) byte (3) John von Neumann (4) UNIX (5) CPU (6) ROM (7) Fortran (A) a premier operating system (B) central processing unit (C) a high-level language (D) computer memory unit (E) read-only memory (F) designer of Fortran language (G) developer of the scheme to use internally stored commands
2. Are the following names valid or invalid? Why? ( 4 pts )
X X+Y R2D SHADOW FAX Pay_day 2A ENDOFTHEMONTH OBI-WAN
3. Decide which of the following constants are not written in standard Fortran. ( 2.5 pts )
(A) 9, (B). (C) 3.57*E (D) 1.23E (E) 3,57E! 2
4. Evaluate the following numeric expressions by hand and with a calculator if needed. Then, write a simple Fortran code to verify your result for any chosen case. The given values for the individual variables are A = 2, B = 3, C = 5 (reals); and I = 2, J = 3 (integers) ( 7.5 pts )
A * B + C A * (B + C) B / C * A B / (C * A) A / I / J A * B ** I / A ** J * 2 C + (B / A) ** 3 / B * 2