A GRAPHICAL KERNEL SYSTEM (GKS) VERSION OF COMPUTER PROGRAM MODPATH-PLOT FOR DISPLAYING PATH LINES GENERATED FROM THE U.S. GEOLOGICAL SURVEY THREE- DIMENSIONAL GROUND-WATER FLOW MODEL by David W. Pollock U.S. GEOLOGICAL SURVEY Open File Report 89-622 Reston, Virginia 1990
54
Embed
A GRAPHICAL KERNEL SYSTEM (GKS) VERSION OF …This report describes a new version of the particle tracking graphics program MODPATH-PLOT that uses the Graphical Kernel System (GKS)
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
A GRAPHICAL KERNEL SYSTEM (GKS) VERSION OF COMPUTER PROGRAM MODPATH-PLOT FOR DISPLAYING PATH LINES GENERATED FROM THE U.S. GEOLOGICAL SURVEY THREE- DIMENSIONAL GROUND-WATER FLOW MODEL
by David W. Pollock
U.S. GEOLOGICAL SURVEY
Open File Report 89-622
Reston, Virginia 1990
DEPARTMENT OF THE INTERIOR
MANUEL LUJAN, JR., Secretary
U. S. GEOLOGICAL SURVEY
Dallas L. Peck, Director
For additional information write to:
i>»avia w. roiiock U. S. Geological Survey 411 National Center Reston, VA 22092 (703) 648-5007
This report can be purchased from:
U. S. Geological SurveyBooks and Open-File Report SectionFederal Center, Box 25425Denver, CO 80225(303)236-7476
11
Preface
This report describes a new version of the particle tracking graphics program
MODPATH-PLOT that uses the Graphical Kernel System (GKS) graphics standard. The
user is requested to notify the originating office of any errors found in this report or in the
computer programs. Updates may occasionally be made to both the report and the computer
program. Users who wish to be added to the mailing list to receive updates, if any, may
send a request to the following address:
David W. Pollock U.S. Geological Survey Office of Ground Water
411 National CenterReston, VA 22092
The FORTRAN source code for the computer program is available at cost of
Appendix Listing of Computer Code.........................................................9
A GRAPHICAL KERNEL SYSTEM (GKS) VERSION OF COMPUTER PROGRAMMODPATH-PLOT FOR DISPLAYING PATH LINES GENERATED FROMTHE U.S. GEOLOGICAL SURVEY MODULAR THREE-DIMENSIONAL
GROUND-WATER FLOW MODEL
by
David W. Pollock
Abstract
The computer program MODPATH-PLOT graphically displays results generated by
the three-dimensional particle tracking program MODPATH. A new version of the
computer program MODPATH-PLOT has been developed that uses the Graphical Kernel
System (GKS) to generate graphical output The Graphical Kernel System is a set of
standardized graphics functions adopted by the American National Standards Institute
(ANSI). GKS functions are widely available and can be obtained from many sources. The
use of GKS in MODPATH-PLOT improves the program's portability between computers
and makes the program accessible to a much broader cross section of ground-water
hydrologists. The computer programs MODPATH and MODPATH-PLOT are described in
U.S. Geological Survey Open File Report 89-381, tided "Documentation of computer
programs to compute and display path lines using results from the U.S. Geological Survey
modular three-dimensional finite-difference ground-water flow model" by David W.
Pollock.
Introduction
A particle tracking post-processing package (Pollock, 1989) was developed to
cc . three-dimensional path lines from output generated from steady-stai~ .u^uLtauu*
using the U.S. Geological Survey modular three-dimensional finite-difference ground-
water flow model (McDonald and Harbaugh, 1988). The particle tracking post-processing
package consists of two computer programs: (1) MODPATH, which calculates path lines,
and (2) MODPATH-PLOT, which presents results graphically. The graphics program,
MODPATH-PLOT, was originally developed for use with the DISSPLA1 graphics
subroutine library (Computer Associates, 1981). A new version of the graphics program
has been developed that uses GKS graphics subroutines. The Graphical Kernel System is a
set of standardized graphics functions adopted by the American National Standards Institute
(American National Standards Institute, 1985). GKS software is available from a variety of
software vendors and for most computers. As a result, the program is now available to a
broader group of ground water hydrologists, especially those using small personal
computers.
The primary reason for converting to a GKS-based program was to make the
computer program as independent as possible of specific graphics software packages. Most
changes to MODPATH-PLOT simply involved a one-to-one replacement of calls to
DISSPLA subroutines with calls to standard GKS subroutines performing the identical
function. However, some of the changes designed to improve the program's "portability"
resulted in minor changes in interactive input and data files. This report describes only
those aspects of the program that differ from the original version of MODPATH-PLOT.
For a complete description of the computer program, the reader is referred to the
documentation provided in the original report (Pollock, 1989).
Changes to Input and Output
Graphical devices
In the original version of MODPATH-PLOT, the choices for graphical output
device were expJ^tjy specified in the program source code. Adding or deleting graphical
devices to the menu displayed on the computer monitor required that the FORTRAN source
code be modified. The GKS version of MODPATH-PLOT was changed to allow the
program to accommodate a wide variety of graphical output devices without the need to
1 The use of trade and firm names in this report is for identification purposes only and does not constitute endorsement by the U.S. Geological Survey.
modify the FORTRAN source code. The GKS version of MODPATH-PLOT requires an
additional data file that contains information about the graphical output devices that are
available. The new data file must be named "DEVICE.DAT". The information in
DEVICEJDAT is used to generate a customized menu from which the user can select a
graphical output device. The file is of format-free structure and contains one line of data for
each graphical output device that will appear in the menu, up to a maximum of 10 output
devices. Each line contains the following information in the order shown: (1) graphical
device type, (2) output medium, and (3) character string prompt to be displayed in the
menu. These items are defined as:
(1) graphical device type an integer corresponding to a graphical devicesupported by the GKS software package. Device type numbers for a given device are specific to the GKS package that is used.
(2) output medium an integer equal to 0 or 1. If the graphical device is ahard copy device (printer or plotter), this parameter should be set equal to 1. If the graphical device is a computer display monitor, it should be set equal to 0.
(3) character string prompt -- a character string placed in single quotes. Thestring will appear next to one of the choices in the menu.
If DEVICE.DAT contains:
1 0 'COMPUTER CONSOLE 16 1 'PRINTER'7 1 'PLOTTER'
the following menu would be displayed on the monitor
ENTER i. PE OF GRAPHICS OUTPUT DEVICE:1 = COMPUTER CONSOLE2 = PRINTER3 = PLOTTER
Entering the number "2" would select item 2 from the menu and cause graphical device type
6 to be opened by the GKS package. Because the program requires a graphical output
device of some kind, the file DEVICE.DAT must contain information for at least one
device. If it does not, a message to that effect is written to the monitor and program
execution is terminated. If DEVICEJDAT contains information for only one device, that
device is nominated automatically and no prompt is written to the screen. DEVICEJDAT is
opened to FORTRAN unit 98. The unit number can be changed in the main program, if
necessary.
Plot scaling
The original version of MODPATH-PLOT determined a plot scale that would result
in the largest possible plot for the device. The user was then allowed to change the plot
scale interactively. The GKS version of MODPATH-PLOT handles plot scaling somewhat
differendy. When using hard copy output devices such as plotters and printers a user may
want to specify the scale to be used in order to produce a plot of a certain size. On video
display monitors the goal generally is to make the plot as large as possible. If the chosen
device is a video display monitor, the GKS version of MODPATH-PLOT determines a
scale that will produce the largest possible plot for that device, and the user is not given an
opportunity to adjust the scale of the plot interactively. In that case, no information is
printed to the screen concerning plot scaling. If the chosen device is a hard copy device, the
program computes the plot scale and then allows the user to adjust the scale interactively,
just as in the original version of the program. The program uses the information supplied in
DEVICE.DAT to determine if the graphical device is a display monitor or a hard copy unit
Log file
The GKS version of the program produces an additional output file named
"GKS .LOG". This file is required by GKS to log error messages. Information about the
the type of graphical device being used is recorded in this file. It also contains any error
messages generated by GKS during execution. If desired, the source code can be modified
to write additional information to GKS .LOG. If GKS .LOG does not already exist, a file
named GKS.LOG is generated automatically by MODPATH-PLOT. The file is opened on
FORTRAN unit number 99. The unit number can be changed in the main program, if
necessary.
Program Portability
The GKS standard allows software developers some latitude in implementing
graphics subroutines. That fact, combined with the variability in hardware and operating
system requirements of individual computers, means that some customizing of the source
code is usually necessary. In developing the GKS version of MODPATH-PLOT, an effort
was made to anticipate the types of changes that might be necessary. The program was
designed so that those changes could be implemented as easily as possible.
Provision for short integers
Some GKS packages (especially those designed for small computers) require that
integers passed to the GKS subroutines be short (2 byte) integers rather than standard long
(4 byte) integers. However, in MODPATH-PLOT, some integers must be long integers.
To accommodate both requirements, those integers in MODPATH-PLOT that must be long
integers are explicitly declared using the INTEGER*4 statement. That allows the program
to be compiled using short integer as the default, if necessary. When the program is
compiled with long integer as the default, all integers are treated as long integers. The use
of explicit INTEGER*4 declarations is not standard FORTRAN 77 (ANSI, 1978),
however nearly all compilers support INTEGER*4 as an extension to FORTRAN 77.
If MODPATH-PLOT is compiled using the short integer default option, the
maximum number of particles cannot exceed 16,000 (eve~ ^ough the master array may be
dimensioned large enough to accommodate more than 16,000 particles). To allow for this
possibility, an integer variable "LIMIT' is defined in the main program. If "LIMIT = 1",
the maximum number of particles is not allowed to exceed 16,000. If "LIMIT = 0", the
maximum number of particles is allowed to be as large as can be accommodated by the size
of the master array. If the GKS package requires short integers, LIMIT must be set to 1.
Otherwise, LIMIT should be set to 0.
Terminating graphics mode
GKS packages differ in the way the graphics system is closed at the end of the
program. Some GKS packages clear the monitor immediately, causing the plot to be erased
from the monitor as soon as it is complete. Other GKS packages automatically wait for
some input at the keyboard from the user (usually a carriage return) before closing the
graphics system. In order to accommodate both types of packages, an integer variable
"NWATT" is set in the main program. When "NWATT = 1", the program is forced to wait
for the user to enter a carriage return before calling the GKS subroutine that closes the
graphics system. That allows the plot to remain undisturbed on the monitor for as long as
desired. When "NWATT = 0" the program does not pause before calling the GKS close
routines. If the GKS package erases the monitor or overwrites the plot with unwanted text
without waiting for a response from the user, NWAIT should be set equal to 1. If the GKS
package automatically waits for a response before erasing the monitor, NWATT should be
set to 0. A trial run of the program usually is necessary to determine which setting is
appropriate for a given combination of GKS package and computer.
Program testing
The GKS version has been tested with two GKS software packages on two types
of computers:
1. PRIME computer using ISSCO-GKS (Computer Associates, 1985).
2. IBM-compatible personal computers using GSS*GKS (Graphic Software Systems, 1985).
ISSCO-GKS on the PRIME computer requires that LIMIT = 0 and NWATT = 0.
GSS*GKS for IBM-compatible personal computers requires that LIMIT = 1 and that
NWATT = 1. The program must be compiled using short integer as the default condition
when GSS*GKS is used.
These results are presented only to illustrate the types of changes that may be
necessary when customizing MODPATH-PLOT for a specific GKS package. Other GKS
packages and other computers may require different combinations of settings or, possibly,
additional changes to the program. The version of the code that accompanies this report sets
NWAIT=1 andLIMTT=l. These flags will need to be changed for certain combinations of
GKS packages and computers.
Summary
The GKS version of MODPATH-PLOT can be used with a wide variety of GKS
software packages on a range of computers. This report only describes changes in the GKS
version of MODPATH-PLOT. Readers are referred to the original documentation for a
complete description of the theory and the use of computer programs MODPATH and
MODPATH-PLOT. Although the program was designed to be independent of hardware
and the choice of GKS software, some minor changes are usually required to customize the
program to a specific GKS package on a specific computer.
References
American National Standards Institute, 1978, Programming Language FORTRAN, ANSI, X3.9-1978, chs. 1-18.
American National Standards Institute, 1985, Computer Graphics Graphical Kernel System (GKS) functional description, ANSI X3.124-1985,106 p.
Computer Associates, 1981, DISSPLA, (Display Integrated Software System and Plotting LAnguage) User's Manual.
Computer Associates, 1985, ISSCO-GKS command reference guide, 60 p.
McDonald, M.G. and A.W. Harbaugh, 1988, A modular three-dimensional finite- difference ground-water flow model, U.S. Geological Survey Techniques of Water Resources Investigations, Book 6, chapter Al, 586 p.
Pollock, David W., 1989, Documentation of computer programs to compute and display pathlines using results from the U.S. Geological Survey modular three-dimensional finite-difference ground-water flow model, U.S. Geological Survey Open File Report 89-381,188 p.
8
Appendix - Listing of Computer Code
IMPORTANT -- This version of the code sets NWAIT=1 and LIMIT=1. These flags will need to be reset for some combinations of GKS software and computers.
MODPATH-PLOT (GKS version)programmed by David W. Pollock
Plotting program for results from the particle tracking programMODPATH. This version of MODPATH-PLOT uses the Graphical KernelSystem (GKS) graphics subroutines. It is a modification of theoriginal version documented in Open File Report 89-381 that usedthe DISSPLA graphics subroutine library. Supplemental documentationfor this GKS version is available in Open File Report 89-622.**********************************************************************
_ 13 T T^ T lUTC* W C TfMfl MAGTITD &DORV QV f*Hi W^11 TM^"1 'PHI? WlTVT1 *FUf^ CTK TITMlJ'WI'C ______KJliUlrlJjWolVjri MAO 1 CjK AKKAI O I UnANolWLi ±D.SL JN&Al 1 WVJ O l/\ HjPuIjW 1 0
M&fflr cnDP TU^T T ITlttA TO CPT IPf^n^T Tf\ TUP T PW^TU fttP TUP & HD'D&V _____rOAIVcj oUKCj InAJ. JjCjJNA Xo o£j 1 c*UUAij iV-' J.nCj JjCjJNuin VJr ln£j A AlvKAI
c tC GKS Version 1.0 March 1, 1990 tQ**************1r********************************************************^
C tC DRIVER tC tC THIS ROUTINE CONTROLS THE OVERALL SEQUENCE OF OPERATIONS AND tC HANDLES MOST OF THE INTERACTIVE I/O #C tQ***********************************************************************^
C tSUBROUTINE DRIVER (IBOUND,XMX,XMN,DELR,YMX,YMN,DELC,ZBOT,ZTOP, t1DELZ,ZMX,ZMN,HEAD,LAYCON,NCON,DELZCB,IBUFF,IUNIT,IBYZ,IBXZ, t2NCOL,NROW,NLAY,NZDIM,NUNIT,NCBL,IGRID,II,12,13,14,I7,NPART, t3NPART2,IZPART,NWAIT,IUGKS,IDDEV) #
C fDIMENSION LAYCON(NLAY),NCON(NLAY),DELR(NCOL),DELC(NROW),DELZ(NLAY)t1,DELZCB(NLAY),XMX(NCOL),YMX(NROW),ZTOP(NZDIM),ZBOT(NZDIM), t2HEAD(NCOL,NROW,NLAY),IBOUND(NCOL,NROW,NLAY),XMN(NCOL),YMN(NROW),4IUNIT(NUNIT),IBUFF(NCOL,NROW,NLAY),ZMN(NLAY) ,SZMX(NLAY),IBYZ(NROW,NLAY),IBXZ(NCOL,NLAY),IZPART(NPART2)
WRITE (*,*)'ENTER THE TYPE OF GRAPH:' WRITE (*,*) ' 1 «= FLOW LINE PLOT'
2 = MAP VIEW OF STARTING LOCATIONS (FORWARD TRACKIff
3 - MAP VIEW OF FINAL LOCATIONS (FORWARD TRACKING)!t
4 = MAP VIEW OF FINAL LOCATIONS (BACKWARD TRACKING!t
5 - TIME SERIES PLOT' tt
WRITE (*,*)'
ING) 'WRITE (*,*) '
1'WRITE (*,*)'
1) '
WRITE (*,*) 'READ (*,*) ITYPEIVIEW=1LAYER=1IF(ITYPE.EQ.1.0R.ITYPE.EQ.5) THENWRITE (*,*)'WHAT IS THE ORIENTATION OF THE PLOT ?'WRITE (*,*)' 1 = MAP VIEW'
IPROJ-0ELSE IF(IVIEW.EQ.3.AND.NROW.EQ.l) THENIIPRJ=1IROW=1IPROJ-0END IFIF(IIPRJ.EQ.O) THENWRITE (*,*)'WHAT DATA SHODLD BE PLOTTED ?'WRITE (*,*)' 0 - PLOT ALL DATA BY PROJECTION ONTO THE 2D SLICEIF(IVIEW.EQ.l) THENWRITE (*,*)' 1 - PLOT ONLY THE DATA WITHIN THE LAYER CORRESPONDI ING TO THE 2D SLICE 1READ (*,*) IPROJLAYER=1IF(IPROJ.GT.O) THENWRITE (*,*)'ALONG WHAT LAYER SHODLD THE 2D SLICE BE TAKEN ?'READ (*,*) LAYEREND IFELSE IF (IVIEW.EQ.2) THENWRITE (*,*) 1 - PLOT ONLY THE DATA WITHIN THE COLUMN CORRESPOND 1ING TO THE CROSS SECTION 1READ (*,*) IPROJWRITE (*,*) ENTER THE COLUMN ALONG WHICH CROSS SECTION IS TAKEN: 1READ (*,*) JCOLELSE IF (IVIEW.EQ.3) THENWRITE (*,*) 1 - PLOT ONLY THE DATA WITHIN THE ROW CORRESPONDING
1 TO THE CROSS SECTION 1READ (*,*) IPROJWRITE (*,*)'ALONG WHAT ROW SHOULD THE CROSS SECTION BE TAKENREAD (*,*) IROWEND IFEND IFEND IFIF(ITYPE.EQ.l) THENWRITE (*,*)'WERE THE FLOWLINES GENERATED BY FORWARD OR BACKWARD TR 1ACKING ?'WRITE (*,*)' 0 - FORWARD'WRITE (*,*)' 1 - BACKWARD'READ (*,*) IDIRIF (IDIR.EQ.O) THENMES- 'DO YOU WANT TO SKIP OVER PATH LINES THAT DISC0 " 1"^1 |mwp }
1 ?'
CALL YESNO (MES,ISKIP)END IFMES- 'DO YOU WANT TO PLOT POINTS AT SPECIFIED TIME INTERVALS ?'CALL YESNO (MES,IPTS)MES- 'DO YOU WANT TO STOP DRAWING PATH LINES AT A SPECIFIED TIME?'CALL YESNO (MES,IANS)TMAX- l.OE+30IF (IANS.EQ.1) THENWRITE (*,*)1'ENTER: THE TIME, AND A FACTOR FOR CONVERTING TO UNITS USED IN THE* 1 MODEL' *
READ (*,*) TMAX,UCFACTMAX- 1.00001*TMAX*UCFACEND IFEND IF
5010 FORMAT(A)IPLOT=0IFaTYPE.EQ.3.0R.ITYPE.EQ.4) THENMES~ 'DO YOU WANT TO PLOT ONLY THOSE POINTS THAT TERMINATE IN ONE 1SPECIFIC ZONE ?'CALL YESNO (MES,IANS)IF(IANS.EQ.l) THENWRITE (*,*) 'ENTER THE ZONE CODE:'READ (*,*) IPLOTEND IFEND IFWRITE (*,*) 'ENTER NAME OF ENDPOINT FILE (<CR>-"ENDPOINT 11 ) : 'READ (*,5010) FNAMEIF (FNAME.EQ.' ') FNAME='ENDPOINT'IUCF=I3CALL OPNFIL (13,FNAME,1,17,0,1)IF(ITYPE.EQ.l) THENWRITE (*,*)'ENTER NAME OF PATHLINE FILE «CR>~nPATHLINE"):'READ (*,501Q) FNAMEIF (FNAME.EQ. 1 ') FNAME='PATHLINE'IUL=I2CALL OPNFIL (12,FNAME,1,17,0,1)CALL COUNTP (I3,NPART)END IFIF(ITYPE.EQ.S) THENWRITE (*,*)'ENTER NAME OF TIMESERIES FILE (<CR>="TIMESERS"):'READ (*,5010) FNAMEIF (FNAME.EQ.' ') FNAME='TIMESERS'CALL OPNFIL (14,FNAME,1,17,0,1)WRITE (*,*)'HOW MANY TIME STEPS DO YOU WANT TO PLOT ?'WRITE (*,*)' (YOU MAY PLOT UP TO 50 TIME STEPS)'WRITE (*,*)' (TO PLOT ALL OF THE TIME STEPS, ENTER A NEGATIVE NUM 1BER)'READ (*,*) NPSTPSIF(NPSTPS.GT.O) THENWRITE (*,*)'ENTER THE TIME STEP NUMBERS THAT YOU WANT TO PLOT:'READ (*,*) (ISPLOT(N),N-1,NPSTPS)END IFEND IF
CMES='DO YOU WANT THE PLOT TO INCLUDE THE ENTIRE GRID ?'CALL YESNO (MES,IALL)IF(IVIEW.EQ.l) THENJMIN=1JMAX=NCOLIMIN=1IMAX=NROWIF (IALL.EQ.O) THENWRITE (*,*)'ENTER GRID COORDINATES:'WRITE (*,*)' MINIMUM COLUMN VALUE, MAXIMUM COLUMN VALUE'READ (*,*) JMIN,JMAXIF (JMAX.LT.I.OR.JMAX.GT.NCOL) JMAX-NCOLWRITE (*,*)' MINIMUM ROW VALUE, MAXIMUM ROW VALUE'READ (*,*) IMIN,IMAXIF (IMAX.LT.l.OR.IMAX.GT.NROW) IMAX-NROWEND IFXMIN- XMN(JMIN)XMAX= XMX(JMAX)YMIN= YMN(IMAX)YMAX= YMX(IMIN)
WRITE (*,*) 'ENTER THE LAYER NUMBER:' # B02570READ (*,*) NLAYER # B02580WRITE (*,*) 'ENTER THE NEW ZONE CODE:' t B02590READ (*,*) NDM B02600DO 50 I-1,NROW B02610DO 50 J-1,NCOL B02620ITEMP-IBOUND(J,I,NLAYER) B02630IF(ITEMP.NE.O) THEN B02640IBOUND(J,I,NLAYER)-NOM B02650 IF(ITEMP.LT.O) IBODND(J,I,NLAYER)- -IBOUND(J,I,NLAYER) B02660END IF B02670
50 CONTINUE B02680ELSE IF (IANS.EQ.2) THEN B02690WRITE (*,*) 'ENTER THE CELL INDICES: J I K' # B02700READ (*,*) J,I,K # B02710WRITE (*,*) 'ENTER THE NEW ZONE CODE:' # B02720READ (*,*) NUM # B02730ITEMP-IBOUND(J,I,K) # B02740IF(ITEMP.NE.O) THEN # B02750IBOUND(J,I,K)-NDM # B02760 IF(ITEMP.LT.O) IBOOND(J,I,K)- -IBOUND(J,I,K) # B02770END IF # B02780ELSE IF (IANS.EQ.3) THEN # B02790WRITE (*,*) 'ENTER THE BOUNDARIES OF THE BLOCK OF CELLS:' # B02800WRITE (*,*) ' MIN COLUMN, MAX COLUMN, MIN ROW, MAX ROW, MIN LAY* B028101ER, MAX LAYER' # B02820READ (*,*) JJ1,JJ2,II1,II2,KK1,KK2 # B02830IF (JJ2.LT.1.0R.JJ2.GT.NCOL) JJ2-NCOL # B02840IF (II2.LT.1.0R.II2.GT.NROW) II2-NROW # B02850IF (KK2.LT.1.0R.KK2.GT.NLAY) KK2=NLAY # B02860WRITE (*,*) 'ENTER THE NEW ZONE CODE:' # B02870READ (*,*) NUM # B02880DO 60 K-KK1,KK2 # B02890DO 60 1=111,112 # B02900DO 60 J-JJ1,JJ2 # B02910ITEMP-IBOUND(J,I,K) # B02920IF(ITEMP.NE.O) THEN # B02930IBODND(J,I,K)-NDM # B02940 IF(ITEMP.LT.O) IBOUND(J,I,K)- -IBOUND(J,I,K) # B02950END IF # B02960
60 CONTINUE # B02970END IF f B02980 MES= 'DO YOU WANT TO CHANGE SOME MORE ZONE CODES ?' # B02990CALL YESNO (MES,IANS) # B03000IF (IANS.EQ.1) GO TO 40 # B03010END IF # B03020END IF # B03030
C # B03040MES= 'DO YOU WANT A COLOR PLOT ?' # B03050CALL YESNO (MES,IANS) f B03060NCLR- -1 # B03070IF (IANS.EQ.O.AND. T " ~-EQ.l) THEN # B03080 WRITE (*,*)'WHAT TYPL or LINE PATTERNS SHOOLD BE DSED ?' # B03090 WRITE (*,*)' 0 - CYCLE THROOGH LINE PATTERNS (SOLID, DASH, DOT) 1 * B03100 WRITE (*,*)' 1 - USE A SINGLE LINE PATTERN FOR ALL PATH LINES 1 # B03110READ (*,*) NNN # B03120IF(NNN.EQ.O) THEN # B03130NCLR- -4 #803140ELSE # B03150WRITE (*,*)'ENTER THE LINE PATTERN:' # B03160WRITE (*,*)' 1 - SOLID 1 # B03170WRITE (*,*)' 2 - DASHED' # B03180WRITE (*,*)' 3 - DOTTED' # B03190READ (*,*) NNN # B03200
15
IF(NNN.LT.1.OR.NNN.GT.3) NNN=1NCLR= -NNNEND IFELSE IF(IANS.EQ.l) THENWRITE (*,*)'HOW SHOULD COLORS BE CHOSEN FOR DIFFERENT DATA GROUPS
1?'
WRITE (*,*)' 0 - CYCLE THROUGH COLORS'WRITE (*,*)' 1 - ALL LINES AND (OR) DATA POINTS PLOTTED IN ONE 1COLOR'READ (*,*) NCLRIF(NCLR.GT.O) THENWRITE (*,*)'ENTER THE COLOR:'WRITE (*,*)' 1 = BLACK/WHITE'WRITE (*,*)' 2 - RED 1WRITE (*,*)' 3 - GREEN'WRITE (*,*)' 4 - BLUE'READ (*,*) NCLRIF(NCLR.LT.1.0R.NCLR.GT.4) NCLR=1END IFEND IF
MES= 'DRAW THE PAGE BORDER ?' CALL YESNO (MES,IBRDR)
OPEN GKS LOG/ERR FILECALL OPNFIL (IUGKS,'GKS.LOG',4,17,0, 3)
DETERMINE IF DEVICE HAS COLORDETERMIN DIMENSIONS OF DEVICE C SET PAGE SIZE
CALL GQCF(MODEL,IERR,NCOLI,ICOLA,NPCI)CALL GQDSP(MODEL,IERDSP,IDCUN,RXM,RYM,NPIXX,NPIXY)WRITE (IUGKS,9005) MODEL
9005 FORMAT('OUTPUT DEVICE MODEL -',19) IF (ICOLA.EQ.l) THEN WRITE (IUGKS,*) 'COLOR DEVICE' ELSE IF (ICOLA.EQ.O) THEN WRITE (IUGKS,*) 'MONOCHROME DEVICE' END IFIF(IDCUN.EQ.O) THENWRITE (IUGKS,*) 'DEVICE COORDINATES ARE IN METERS.' WRITE (IUGKS,9006) RXM,RYM
9006 FORMAT('SCREEN DIMENSIONS IN METERS:'/I 1 X DIMENSION -',F9.6,' Y DIMENSION -',F9.6)ELSE IF (IDCUN.EQ.l) THENWRITE (IUGKS,*) 'DEVICE COORDINJ"^ ARE IN ARBITRARY SCREEN COORDI 1NATES.'WRITE (IUGKS,9007) RXM,RYM
9007 FORMAT('SCREEN DIMENSIONS IN DEVICE COORDINATES:'/ 1' X DIMENSION -',F10.3,' Y DIMENSION -',F10.3) END IF WRITE (IUGKS,9008) NPIXX,NPIXY
9008 FORMAT(I7,' PIXELS IN X DIRECTION'/ 117,' PIXELS IN Y DIRECTION')CNVICH-39.3701
C IF DEVICE COORDINATES ARE IN METERS, CONVERT PAGE SIZE TO INCHESIF(IDCUN.EQ.O) THENPLONG=RXM*CNVICH
PSHORT=RYM*CNVICHC OTHERWISE, SET PAGE DIMENSIONS TO THEIR DIMENSIONS IN THE C DEVICE COORDINATES RETURNED BY THE GKS QDERY.
ELSEPLONG=RXMPSHORT=RYMEND IF
C IF DEVICE HAS COLOR, SET THE COLORS TO RED, GREEN, AND BLUEIF (ICOLA.EQ.l) THENCALL GSCR(MODEL,2,1.0,0.0,0.0)CALL GSCR(MODEL,3,0.0,1.0, 0.0)CALL GSCR(MODEL,4,0.0,0.0,1.0>END IF
C DETERMINE THE SIZE OF THE PLOT, AND SET SCALING FACTORS.IF(IVIEW.EQ.l) THENCALL SCPLOT (PLONG,PL,PSHORT,PS,IPAGE,XMIN,XMAX, YMIN,YMAX,XL, 1XR,YB,YT,JUNITS,KIND)ELSE IF(IVIEW.EQ.2) THENCALL SCPLOT (PLONG,PL,PSHORT,PS,IPAGE,YMIN,YMAX, ZMIN,ZMAX,XL, 1XR,YB,YT,JUNITS,KIND)ELSE IF(IVIEW.EQ.3) THENCALL SCPLOT (PLONG,PL,PSHORT,PS,IPAGE,XMIN,XMAX, ZMIN,ZMAX,XL, 1XR,YB,YT,JUNITS,KIND)END IF
C ADD SPACE FOR A BORDER AROUND THE ACTIVE DRAWING RECTANGLE FOR THE C PLOT. TITLE AND SCALE BAR WILL BE PUT IN THE BORDER REGION AT BOTTOM C OF PAGE.
WCDC= (XR-XD/PLXLL-XL-0.068*WCDC*PLONGXRR-XR+0.068*WCDC*PLONGYBB=YB-0.176*WCDC*PSHORTYTT=YT+0.118*WCDC*PSHORTWRITE (IDGKS,*) 'COORDINATES OF DEVICE IN WORLD COORDINATES: 1WRITE(IUGKS,9001) XLL,YBB,XRR,YTT
9001 FORMATC (XLEFT, Y BOTTOM) = (MPE12.5, 1 , > ,E12.5, 1 )'/ 1' (X RIGHT, Y TOP) = (',£12.5,' , I ,E12.5,') 1 )WRITE (IDGKS,*) 'COORDINATES OF THE ACTIVE PLOT RECTANGLE (WC): WRITE(IDGKS,9001) XL,YB,XR,YT
C SET SIZE OF ATIVE PLOT WINDOW IN WORLD COORDINATES (WC)SIZEX=XRR-XLLSIZEY=YTT-YBBSIZE=SIZEXIF(SIZEY.GT.SIZEX) SIZE=SIZEYCALL GSWN(1,XLL,XRR,YBB,YTT)XNC=SIZEX/SIZEYNC-SIZEY/SIZE
C SET GLOBAL VIEWPORT IN NORMALIZED TRANSFORMED COORDINATES (NTC)CALL GSVP(1,0.,XNC,0.,YNC)
C SET WORKSTATION WINDOW SIZE (NTC)CALL GSWKWN(l,0.,XNC,0. r YNC)
C SET WORKSTATION VIEWPORT IN DEVICE COORDINATES (DC)CALL GSWKVP(1,0.,RXM,0., RYM)CALL GSELNT(l)CALL GSASF(LASF)
C SET TEXT FONT AND CHARACTER EXPANSION FACTORCALL GSTXFP(1,1)CALL GSCHXP(L)
C END OF ROUTINE C C GKS Version 1.0 March 1, 1990
t******************************i r********
CC EZONESCC THIS ROUTINE READS THE ENDPOINT FILE TO GET THE ZONE CODESC FOR THE INITIAL AND FINAL PARTICLE LOCATIONS. IT PUTS THE ZONEC CODES IN THE ARRAY "IZPART"C
C #C GKS Version 1.0 March 1, 1990 #^***********************************************************************^C #C YESNO #C *C THIS ROUTINE PRINTS QUESTION PROMPT REQUIRING Y OR N ANSWER. Y AND N #C ARE CONVERTED TO NUMERICAL 0 AND 1 RESPONSE #C *c** ********** ************************** ******************************** ****$C *
SUBROUTINE YESNO(MES,IANS) # CHARACTER*79 MES # CHARACTER*! IA # CHARACTER*10 ANSWR #
10 WRITE(*,5000) MES # WRITE(*,*) t Y - YES; N OR <CR> - NO ] # READ(*, (A10)') ANSWR #
5000 FORMAT(IX,A79) # IA= ' ' *
DO 20 N=l,10 # IF (ANSWR(N:N).NE.' ') THEN # IA= ANSWR(N:N) # GO TO 30 # END IF #
20 CONTINUE #30 CONTINUE t
IANS= -1 t IF(IA.EQ.'Y 1 .OR.IA.EQ.'y') IANS=1 t IFdA.EQ.'N'.OR.IA.EQ.'n'.OR.IA.EQ. ' ) IANS-0 t IF(IANS.EQ.-l) GO TO 10 t RETURN END
C END OF ROUTINE
CC GKS Version 1.0 March 1, 1990C***********************************************************************
CC DGRIDCC THIS ROUTINE DRAWS THE GRIDCQ***********************************************************************
C GKS Version 1.0 March 1, 1990£**********************************************************************
CC SCPLOTCC THIS ROUTINE DETERMINES THE SIZE OF THE PLOT AND COMPOTES THE SCALEC OF THE PLOTC£******************************************** ************************
5000
10
5010
SUBROUTINE SCPLOT (PLONG,PL,PSHORT,PS,IPAGE,XMIN,XMAX,YMIN,YMAX, 1XL,XR,YB,YT,JUNITS,KIND) CHARACTER*?9 MES IPAGE=1IF (KIND.NE.O) THENWRITE (*,*)'WHAT ARE THE UNITS OF DISTANCE IN THE MODEL ?' WRITE (*,*)' 1 - FEET 1 WRITE (*,*)' 2 - METERS' READ (*,*) JUNITS ELSE JUNITS=1 END IFUNITS=12.0 t IF(JUNITS.EQ.2) UNITS=39.0 t PL=(1.0-0.136)*PLONG # PS=(1.0-0.294)*PSHORT XLNG=XMAX-XMIN YLNG=YMAX-YMIN
R=YLNG/XLNGPSPL=PS/PLIF(R.LE.PSPL) THENSCA=XLNG*UNITS/PL t YLNG=PSPL*XLNG t
ELSE t SCA=YLNG*UNITS/PS t XLNG=YLNG/PSPL t
END IF t SCMAX=SCA t IF (KIND.NE.O) THEN t WRITE (*,5000) SCMAX t FORMAT(' MAXIMUM SIZE PLOT IS AT SCALE OF (1:',F11.0, ) ) MES= 'IS THIS SCALE ACCEPTABLE ?' CALL YESNO(MES,IANS) ELSE IANS=1 END IFIF(IANS.EQ.O) THEN WRITE (*,*)'ENTER NEW SCALE (1:M)' t WRITE (*,*)' ENTER: M' t READ (*,*) SCA # IF(SCA.LT.SCMAX) THEN t WRITE (*,5010) SCMAX # FORMAT(' VALUE OF M MUST BE LARGER THAN ',F11.0) t
GO TO 10 # END IF t XLNG=XLNG*SCA/SCMAX t YLNG=YLNG*SCA/SCMAX t END IF t XL= ((XMAX+XMIN) 12. ) - XLNG/2.0 t XR= XL + XLNG t YB= ((YMAX+YMIN)/2.) - YLNG/2.0 t YT= YB +YLNG t CALL GCLRWK (1,0) t
WRITE (17,*) 'RIVER DATA NOW BEING READ...'READ (IURIV, 5010) MX, IRREAD (IURIV, 5010) ITMP
5010 FORMAT (3110, 3F10. 0,110)IF(ITMP.EQ.O) GO TO 30DO 20 N=1,ITMPREAD (IURIV, 5010) K, I, J, H, C, RB, IFACEIF(I.LT.IMIN.OR.I.GT.IMAX) GO TO 20IF(J.LT. JMIN. OR. J.GT. JMAX) GO TO 20IF(K.LT.KMIN.OR.K.GT.KMAX) GO TO 20IF (IBUFF(J, I,K) .EQ.l) GO T<"» 20IBUFF(J,I,K)=1IF (IFACE. GT. 6) GO TO 20IF (IVIEW. EQ.l) THENDX=XMX(J)-XMN(J)DY=YMX(I)-YMN(I)X= (XMX(J)+XMN(J))/2.0Y= (YMX(I)+YMN(I))/2.0CALL SYMBL (X, Y,DX,DY, 0)END IF
20 CONTINUE30 CONTINUE
WRITE (I 7,*) ' RIVER DATA HAS BEEN READ'IF (NCLR.GE.O) CALL PKCLR (1)RETURNEND
ISUM=ISUM+NLAYLCNCON=ISUMISUM=ISUM+NLAYLCDZCB=ISUMISUM=ISUM+NLAYLCIBUF-ISUMISOM-ISDM + NCRLLCIUN=ISUMISUM=ISOM + NDNITLCIBYZ=ISUMISUM=ISUM + (NROW*NLAY)LCIBXZ=ISUMISUM=ISUM + (NCOL*NLAY)ISM1=ISUM-1NDIF=LENA-ISM1IF(LIMIT.EQ.l) THENIF (NDIF.GT.32000) NDIF-32000END IFNPART= NDIF/2IF (NPART.LT.l) THENWRITE (*,*) 1'THE SIZE OF THE MASTER ARRAY IS NOT LARGE ENOUGH.'WRITE (*,*) 'DIMENSION THE MASTER ARRAY: A(LENA)'WRITE (*,5010) ISM1WRITE (17,*) 1'THE SIZE OF THE MASTER ARRAY IS NOT LARGE ENOUGH.'WRITE (17,*) 'DIMENSION THE MASTER ARRAY: A(LENA)'WRITE (17,5010) ISM1
5010 FORMAT (' WITH LENA -',18,' + 2 X (NUMBER OF PARTICLES)')STOPEND IFLCIZN=ISUMISUM=ISUM + (2*NPART)ISM1=ISUM-1WRITE (*,5020) NPART
5020 FORMAT (' THE MAXIMUM NUMBER OF PARTICLES FOR THIS RUN ISWRITE (17,5030) NPART
5030 FORMAT(' MAXIMUM NUMBER OF PARTICLES IS ',18)WRITE (17,5040) ISMl,LENA
5040 FORMAT(I8,' ELEMENTS OUT OF ',18,' USED IN "A" ARRAY')IF(ISMl.GT.LENA) STOPRETURNEND
C END OF ROUTINE
CC GKS Version 1.0 March l f 1990
',18)
CC DATINCC THIS ROUTINE READS IN DATAC #Q*****+*****************************************************************$
C #SUBROUTINE DATIN (LAYCON,NCON,HEAD,XMX,XMN,YMX,YMN,DELR, #IDELC,DELZ,DELZCB,ZTOP,ZBOT,ZMN,ZMX,IBOUND,IUNIT, NCOL,NROW,NLAY, #2NUNIT,NZDIM,IGRID,NCBL,II,17) #
C *CHARACTER*16 TEXT #INTEGER*4 KSTP,KPER,NC,NR,K #DIMENSION LAYCON(NLAY),NCON(NLAY),DELR(NCOL),DELC(NROW),DELZ(NLAY)#1,DELZCB(NLAY),XMX(NCOL),YMX(NROW),ZTOP(NZDIM),ZBOT(NZDIM), #2HEAD(NCOL,NROW,NLAY),IBOUND(NCOL,NROW,NLAY),XMN(NCOL),YMN(NROW), #4IUNIT(NUNIT),ZMN(NLAY), ZMX(NLAY) #
30 XMX(J)-XMX(J-1)+DELR(J) CC DELC, GRID SPACING ALONG A COLUMN (Y-DIRECTION) C
WRITE(17,5000)WRITE(17,*) 'DELC ARRAY NOW BEING READ...'CALL IN1DR (ID,DELC,BROW,17J
40 C C C
COMPOTE YMAX ARRAY
YMX(NROW)-DELC(NROW) YMN(NROW)-0.0 DO 40 1-2,NROW II-NROW+1-I YMN(II)-YMX(II+1) YMX(II)-YMX(II-H)+DELC(II)
READ VERTICAL COORDINATE DATA
50
IF (IGRID.EQ.l) THENWRITE(17, 5000)WRITE(17,*) 'DELZ ARRAY NOW BEING READ...'CALL IN1DR (ID,DELZ,NLAY,I7)IF(NCBL.GT.O) THENWRITE(17, 5000)WRITE(17,*) 'DELZCB ARRAY NOW BEING READ...'CALL IN1DR (ID,DELZCB,NLAY,17)ELSEDO 50 N-1,NLAYDELZCB(N)=0.0END IFREAD(ID,5070) ZBL1
90 HEAD(J, I,K)-0.IUHED-IUNIT(8)IF (IOHED.NE.O) THEN
100 CONTINUEREAD (IDHED,END*110) KSTP,KPER,PERTIM,TOTIM, TEXT, NC,NR, KIF (TEXT.NE. 1 HEAD 1 ) THENWRITE (*,*) 'HEAD FILE DOES NOT CONTAIN HEAD DATA. 1WRITE (17,*) 'HEAD FILE DOES NOT CONTAIN HEAD DATA. 1STOPEND IFWRITE(17,5000)WRITE(17,5120) K
5120 FORMAT(' HEADS NOW BEING READ FOR LAYER 1 ,14)READ(IDHED) ((HEAD(J,I,K),J«1,NCOL) , I«1,NROW)GO TO 100END IF
110 CONTINUEWRITE(17,*) 'HEADS HAVE BEEN READ 1IF(IGRID.EQ.O) THENDO 140 K=1,NLAYDELZ(K)-0.0COUNT-0.0DO 120 I-1,NROWDO 120 J-1,NCOLIF(IBOUND(J,I,K).EQ.O.OR.HEAD(J,I,K).GT.l.OE+29) GO TO 120COUNT-COUNT*1.OE+0JIK- (K-1)*NCOL*NROW + (I-1)*NCOL + JIF(LAYCON(K).NE.l) THENDELZ(K)-DELZ(K) + (ZTOP(JIK)-ZBOT(JIK))ELSEDELZ(K)«DELZ(K) + (HEAD(J,I,K)-ZBOT(JIK))END IF
120 CONTINUEDELZ(K)=DELZ(K)/COUNTDELZCB(K)«0.0COUNT-0.0IF(NCON(K).EQ.O) GO TO 140DO 130 I«1,NROWDO 130 J-1,NCOLIF(IBODND(J,I,K).EQ.O) GO TO 130COUNT-COUNT*1.OE+0JIK- (K-1)*NCOL*NROW + (I-1)*NCOL + JJIK1-JIK+(NCOL*NROW)DELZCB(K)- DELZCB(K) + (ZBOT(JIK)-ZTOP(JIK1))
IF(FMT.EQ.' ') THENREAD(LOCAT, *) (N( J) , J-l, JJ)ELSEREAD (LOG AT, FMT) (N ( J) , J-l, JJ)END IFIF (ICON.NE.O) THENDO 20 J=1,JJK(J)= ICON*N(J)END IFIF(IPRN.GT.O) THENWRITE (17, 5020) (N( J) , J-l, JJ)ELSEWRITE (I 7,*) ' DATA WAS READ BUT NOT PRINTED'END IF
5020 FORMAT (2515) C
RETURNEND
C END OF ROUTINE -------------------------------
C GKS Version 1.0 March 1, 1990Q***********************************************************************
CC NEWIBCC THIS ROUTINE FILLS A NEW TWO DIMENSIONAL "IBOUND" ARRAY FOR CROSSC SECTIONAL SLICE THROUGH THE 3-D GRIDCC***********************************************************************
10 CONTINUEIF (IVIEW.EQ.l) THENREAD(IU,*,END=20) KNT,N,J,I r K r XPT r YPT,ZLr ZLL,TIMELSEC=KELSE IF (IVIEW.EQ.2) THENREAD(IU r *,END-20) KNT,N r J r I,K,XX,XPT,ZL r ZLL,TIMELSEC-JIF(ZLL.GE.O.O) YPT= (1.0-ZLL)*ZMN(K) + ZLL*ZMX(K)IF(ZLL.LT.O.O) YPT- (l.OE+0+ZLL)*ZMN(K) - ZLL*ZMX(K+1)ELSE IF (IVIEW.EQ.3) THENREAD(IU r *,END-20) KNT r N r J, I,K,XPT,YY r ZL r ZLL,TIMELSEC-IIF(ZLL.GE.O.O) YPT= (1.0-ZLL)*ZMN(K) + ZLL*ZMX(K)IF(ZLL.LT.O.O) YPT= (1.OE+O+ZLL)*ZMN(K) - ZLL*ZMX(K+1)END IFICK=0IF(XPT.GT.XMAX.OR.XPT.LT.XMIN) ICK=1IF(YPT.GT.YMAX.OR.YPT.LT.YMIN) ICK-1IF(IPROJ.EQ.I.AND.LSEC.NE.NSEC) ICK=1IF (KNT.EQ.KSTP) THENIF(ICK.EQ.O) CALL GPM(1,XPT,YPT)GO TO 10ELSE IF (KNT.EQ.NEXT.AND.KNT.NE.O) THENKSTP-NEXTIF(NCLR.EQ.O) THENKCLR-KCLR+1CALL PKCLR (KCLR)END IF
SUBROUTINE PKCLR (KCLR)IF(KCLR.LE.4) GO TO 20KCLR=KCLR-4IF (KCLR. LE. 4) GO TO 20GO TO 10CONTINUECALL GSTXCI(KCLR)CALL GSPLCI(KCLR)CALL GSPMCI(KCLR)RETURNEND
C GKS Version 1.0 March 1Q****
C
Cc
*************************
COLOR
******************************************
, 1990******************************************
PKPAT
C THIS ROUTINE SELECTS A PENCc****c
10
20
*************************
SUBROUTINE PKPAT (IPAT)IF(IPAT.LE.3) GO TO 20IPAT=IPAT-3IF (IPAT. LE. 3) GO TO 20GO TO 10CONTINUEIF (IPAT.EQ.l) THENCALL GSLN(l)ELSE IF (IPAT.EQ.2) THENCALL GSLN(2)ELSE IF (IPAT.EQ.3) THENCALL GSLN(3)END IFRETURNEND
CC OPEN FILE CONTAINING FILE NAMES AND FORTRAN UNITS C
WRITE (*,*) 'ENTER NAME OF FILE CONTAINING NAMES AND UNITS OF DAT 1A FILES: 1READ (*,5000) FNAME
5000 FORMAT (A) C
CALL OPNFIL (10,FNAME,1,17, 0,1) C
KFIRST«0 10 READ (IO,*,END=20 ) ID,FNAME
IF (KFIRST.EQ.O) I1=IUKFIRST=1
CC OPEN DATA FILES C
CALL OPNFIL (ID,FNAME,1,17, 0,1) C
WRITE(17,5010) IU,FNAME 5010 FORMATC FORTRAN UNIT ',13,' *> f ,A60)
GO TO 10 20 CONTINUE
RETURNEND
C END OF ROUTINE
CC GKS Version 1.0 March 1, 1990Q**********************************************************************
CC COUNTPCC THIS ROUTINE READS THE ENDPOINT FILE AND COUNTS THE NUMBER OFC PARTICLES RECORDED IN THE FILE. IT REWINDS THE FILE WHEN THEC COUNT IS FINISHEDCC***********************************************************************
WRITE(I7,*) 'DRAIN DATA BEING READ... ' READ (IUDRAI, 5 010) MXW,ID READ (IUDRAI, 5010) NDRAIFORMAT (2110)
DO 10 N=l, NDRAIREAD (IUDRAI, 5020) K, I, J,H, C, IFACE IF(IFACE.NE.O) GO TO 10 IF(I.LT.IMIN.OR.I.GT.IMAX) GO TO 10 IF(J.LT. JMIN. OR. J.GT. JMAX) GO TO 10 IF(K.LT. KMIN. OR. K.GT. KMAX) GO TO 10 IF (IV. EQ.l. AND. K.NE. ISLICE) GO TO 10
(IVIEW.EQ.2.AND.J.NE.ISLICE) GO TO 10 NE.ISLICE) GO TO 10
WRITE(I7,*) GHB DATA BEING READ. ..' READ (IUGHB, 5010) MXW, ID READ(IUGHB,5010) NGHBFORMAT (2110)
DO 10 N-1,NGHBREAD (IUGHB, 5020) K, I, J, H,C, IFACE IF(IFACE.NE.O) GO TO 10 IF(I.LT.IMIN.OR.I.GT.IMAX) GO TO 10 IF(J.LT.JMIN.OR.J.GT.JMAX) GO TO 10 IF(K.LT.KMIN.OR.K.GT.KMAX) GO TO 10 IF (IV. EQ.l. AND. K.NE. ISLICE) GO TO 10 IF (IVIEW. EQ. 2. AND. J.NE. ISLICE) GO TO 10 IF (IVIEW. EQ. 3. AND. I. NE. ISLICE) GO TO 10 IF (IVIEW. EQ.l) THEN X= (XMX ( J) +XMN ( J) ) /2 . 0 Y-(YMX(I)+YMN(I))/2.0 DX-XMX(J)-XMN(J) DY=YMX(I)-YMN(I) ELSE IFUVIEW.EQ.2) THEN X-(YMX(I)+YMN(I))/2.0 Y- (ZMX (K) +ZMN (K) ) /? . 0 DX-YMX(I)-YMN(I) DY-ZMX(K)-ZMN(K) ELSE IF(IVIEW.EQ.3) THEN X- (XMX ( J) +XMN ( J) ) /2 . 0 Y- (ZMX (K) +ZMN (K) ) /2 . 0 DX-XMX(J)-XMN(J) DY=ZMX(K)-ZMN(K) END IFIF (IVIEW. EQ.l) THEN CALL SYMBL (X, Y,DX,DY, 1) ELSE CALL SYMBL (X, Y,DX, DY,0)
"NACT" IS NOT USED IN THIS SUBROUTINE. ALL FILES ARE OPENED FORREADING AND WRITING. OPENING "READ w«iA" Ai\iD : ' SRI IE ONLY" FILESIS MACHINE DEPENDENT. THE VARIABLE "NACT" IS PASSED TO THISROUTINE TO MAKE IT EASY TO MODIFY THE OPEN STATEMENTS TO ALLOWFOR READ AND WRITE ONLY FILES ON ANY GIVEN MACHINE. THE CALLS TOTHIS SUBROUTINE ARE CURRENTLY SET UP SO THAT ANY FILE THAT ISWRITTEN TO IS GIVEN "NACT - 3" AND ANY FILE THAT IS READ FROM BUTNOT WRITTEN TO IS GIVEN "NACT - 1". NO FILES ARE GIVEN "WRITE ONLY"STATUS. "READ ONLY" STATUS IS USEFUL IF A NUMBER OF USERS WANTTO SIMULTANEOUSLY SHARE INPUT FILES.
IF THE FILE DOES NOT CURRENTLY EXIST, A NEGATIVE UNIT NUMBER ISUSED AS A FLAG TO INDICATED THAT A NEW FILE SHOULD BE CREATED AS
CHECK TO SEE IF A FILE IS OPENED TO UNIT-IOUT SO THAT ERROR MESSAGES CAN BE WRITTEN.
INQOIRE (UNIT-IOUT,OPENED-EX)10-0
IF (EX) 10=1
FNAME=FILNAM
OPEN AN EXISTING FILE
IF (NSTAT.EQ.l) THENINQUIRE (FILE-FNAME,EXIST-EX,UNFORMATTED-FM)
CHECK TO SEE IF FILE EXISTS IF (EX) GO TO 20 IF (IBATCH.EQ.O) THEN WRITE (*,*) 'FILE DOES NOT EXIST.'WRITE (*,*) 'ENTER THE NAME OF AN EXISTING FILE «CR>-QUIT) READ (* r '(A)') FNAME IF (FNAME.EQ.' ') STOP GO TO 10 ELSEIF (IO.EQ.1) IF (IO.EQ.1) STOP END IF CONTINUE FMT- 1 FORMATTED 1IF (IBIN.EQ.I.OR.FM.EQ.'YES') FMT-'UNFORMATTED' OPEN <IU,FILE=FNAME,STATUS='OLD' ,FORM-FMT, IOSTAT=IERR) IF (IERR.GT.O) GO TO 40 RETURN END IF
OPEN A NEW FILE
IF (NSTAT.EQ.2) THENINQUIRE <FILE=FNAME,EXIST-EX)IF (EX) THENIF (IBATCH.EQ.O) THENWRITE (*,*) 'FILE ALREADY EXISTS. 1WRITE (*,*) 'ENTER THE NAME OF A NEW FILE «CR>-QUIT) : 'READ (*,'(A)') FNAME
') STOP
WRITE WRITE
(IOUT,*) 'FILE DOES NOT EXIST:' (IOUT,'(A)') FNAME
IF (FNAME.EQGO TO 30ELSEIF (IO.EQ.1) WRITEIF (IO.EQ.1) WRITESTOPEND IFEND IFFMT='FORMATTED 1IF (IBIN.EQ.l) FMT-'UNFORMATTED OPEN (IU,FILE=FNAME,STATUS='NEW I ,FORM=FMT,IOSTAT=IERR)IF (IERR.GT.O) GO TO 40RETURNEND IF
ELSEWRITE(*,*) 'ENTER THE TYPE OF GRAPHICS OUTPUT DEVICE: 1DO 45 N=1,NDEVWRITE(*,5000) N,LABEL(N)
45 CONTINUE 50 READ(*,*) IM
IF (IM.LT.I.OR.IM.GT.NDEV) THENWRITE(*,*) 'THE NUMBER IS OUT OF RANGE. CHOOSE AGAIN.'GO TO 50END IFEND IFMODEL - IDEV(IM)IWAIT=0IF (ITP(IM).EQ.O) IWAIT=NWAITKIND-ITP(IM)RETURN
20 WRITE(*,*) 'THE FILE DEVICE.DAT IS EMPTY OR HAS BAD DATA 1STOP