[Next Section]
[Previous Section]
[Table of Contents]
Full Equations (FEQ) Model for the Solution of the Full, Dynamic Equations of Motion for One-Dimensional Unsteady Flow in Open Channels and Through
Control Structures
U.S. GEOLOGICAL SURVEY WATER-RESOURCES INVESTIGATIONS REPORT 96-4240
APPENDIX 3: Input-Output Unit Number Selection
FEQ has been operational long enough that some components predate
recent developments in operating
systems. In the past, some versions of Fortran and some operating
systems required that an input or output operation in a computer
program must be associated with a file on a hard disk using a unit
number. Thus, the user had to specify an explicit unit number in
order to associate the file on the hard disk with the proper point
of input or output in the Fortran program. In addition, it was
not possible to reference a file name as such in Fortran
programming in the past. Therefore, the intermediary of a unit
number had to be applied.
As a consequence, a considerable history of input streams was
developed for FEQ that required explicit unit numbers. These
numbers continue to be supported in FEQ to maintain consistency
with past use even though the use of unit numbers is no longer
required in the current Fortran compilers and operating
systems. As time permits and demand dictates, the old usage of
unit numbers will be replaced with new usage that applies the
more flexible facilities available on current operating
systems. In the interim, the following guidelines for choosing
unit numbers are offered.
-
Each operating system/language combination has a unique
upper limit for unit numbers. In some cases, this is 99,
but it may be larger or smaller than this value. The
purpose of MUNIT in the INCLUDE file ARSIZE.PRM is to set
this level so that the input can be checked in FEQ
computations to make sure that the specified unit numbers
are not too large for the operating system.
-
Fortran programming has defined standard unit numbers since
the early beginnings, in the 1960's. Unit 5 was defined as
a standard input, unit 6 as standard output to a line
printer, and unit 7 was defined as output to a standard card
punch. Card punches are not used anymore, and line printers
are rarely used at this time. However, unit numbers 6 and 7
may have special significance for a given compiler of the
Fortran programming language. Thus, these numbers should
not be used for anything other than their original intent.
Compilation and operation system difficulties may result if
these unit numbers are applied in a nonstandard manner.
-
Command-line arguments are used in FEQ. A command line is
the line following the DOS prompt on a DOS machine and the
UNIX prompt on a UNIX machine. This is the line where words
and strings of symbols are typed to tell the computer what
actions should be done (the line where commands are issued
to the computer). The first item included on a command line
is the command. Items that follow the command, usually
separated from the command and from each other by one or
more spaces, are called command-line arguments. Two
arguments are required with each a file name in FEQ
simulation. The first argument is the name of the file that
contains the input to FEQ as defined in the Input
Description for the Full Equations model (section 13). This
is the standard input file. The second argument is the name
of the file that contains the items that are computed in the
course of a simulation. This is the standard output file.
An example command line for FEQ is FEQ FEQ.IN FEQ.OUT, where
FEQ.IN is the name of the standard input file and FEQ.OUT is
the name of the standard output file. The names for the
standard input and output file are selected by the user and
can be any valid name available in the operating system. As
many as 64 characters may be used for the specification of
the file name in FEQ. Therefore, a path can be included
with the name.
-
Two standard unit numbers that relate the standard input and
standard output files for FEQ are defined in a file
STDUN.PRM, which may be retrieved electronically as
described in section 1.1. These are the unit numbers that
are equivalent in concept to unit numbers 5 and 6 in
traditional Fortran. The Fortran parameter STD5 defines the
unit number to use for processing the standard input file.
The Fortran parameter STD6 defines the number to use for
processing the standard output file. These parameters are 5
and 6, respectively, by default for DOS systems, but they
need not have those values. Any valid values that the user
selects may be used. Once selected, however, the unit
numbers cannot be used for another purpose in the input to
FEQ.
-
The Fortran-defined unit designation for writing to the
display screen is used in FEQ. The unit field in an output
statement in Fortran is given as an asterisk to denote
output to the display screen. This means that an output to
the standard output unit, STD6, will appear in the standard
output file, whereas an output to a unit designated by an
asterisk is to the display screen. This is the result on
DOS systems. Some UNIX systems, however, define the
asterisk unit differently. On these UNIX systems, the
asterisk unit is associated with the standard output unit,
6. If this also is the unit used for the standard output
file, then no text is written to the display screen and all
text appears in the standard output file. Thus, to write to
the display screen when running under UNIX, STD6 should not
be given the number 6. Also, the standard unit number 5 is
often associated with the keyboard in some UNIX systems.
Therefore, STD5 and STD6 should not have the values of 5 and
6 under UNIX, but should be given some other numbers before
the program is compiled. Values of 3 and 4 have been used
in the past and have worked. On UNIX systems, unit numbers
5, 6, and 7 should be avoided because they may have a
special meaning.
-
Aside from the standard unit numbers specified for STD5 and
STD6 and the traditional standard unit numbers of 5, 6, and
7, the user may select the unit numbers. This choice is
limited only by the following constraints:
(A) the same unit number should not be used more than once
in any context other than the input of files containing
function tables, and
(B) a unit number larger than the maximum value set by
parameter MUNIT in INCLUDE file ARSIZE.PRM at the time the
program was compiled should not be used.
The units that have been referenced in FEQ simulation are
monitored, and any duplicate reference results in an error.
-
The reuse of a unit number when processing files that
contain function tables is allowed because these files are
all processed in sequence and are processed completely
before any other files referenced in the standard input to
FEQ are processed. Use of a standard unit number for this
purpose is recommended; unit number 15 is commonly applied
for the unit number for processing each file containing
function tables.
-
Standard numbers are recommended for files that appear in a
common context. This would include the special-output file,
the diffuse time-series file, and the files used to save and
restore the state of the model. These numbers could all be
less than some reasonable limit, such as 15. Then, numbers
larger than 15 but no more than MUNIT are available for use
in accessing point time-series files for input or output.
The use of standard ranges will help avoid errors.
[Next Section]
[Previous Section]
[Table of Contents]