#!/bin/csh #----------------------------------------------------------- #version: 3 January 1997 # # READ ME FIRST # This beta-test code is provided by R. Grotjahn. It is a # shell program to illustrate use of ncar graphics by # creating an executable file; hence the program can be # as a UNIX command by typing the file name and hitting "return." # shell script changes are needed to make the program run. # Look for UNIX script changes between successive lines # starting with: # chg # you will also want to modify the FORTRAN code, see # READ ME SECOND. # #---------------------------------------- cat >! template.for << 'EOF' c c READ ME SECOND c This is a script & fortran file to run a basic template of a c program to make contour plots of 2-d arrays. c Users of this script need to modify the unix commands at the c end of this file: several cp commands in order to c direct program input and output to their own directory under c a name of their preference. c c This program also illustrates a simple written output procedure c as well contour plotting. See READ ME THIRD c c Other notes: c don't forget to make your file executable: chmod u+x contour.for c c c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c READ ME THIRD c c your source code to generate the 2-d arrays goes between the c first pair of lines that contain c repeated many times. To c change the calls to the plot generation, make mods between c the next pair of lines containing c repeated many times. c c For the purpose of this shell example, arrays PSIP and PSI are created. PROGRAM Contour c PARAMETER (NY=21,Nx=41) C NY=GRID PTS IN Y, NX GRID PTS IN X, DIMENSION Y(NY),X(NX), PSIP(NX,Ny),PSI(NX,Ny) C CHARACTER*8 CHRS COMMON /DOMAIN/ XWd,XEd,YSd,YNd PI=acos(-1.) DO 1 I=1,NX X(I)=FLOAT(I-1)*0.1-2. DO 1 J=1,NY Y(J)=FLOAT(J-1)*0.1-1. PSIP(I,J)=17.*EXP(-X(I)**2-Y(J)**2) PSI(I,J)=27.2*SIN(0.5*PI*X(I))*COS(PI*Y(J)/2.-X(I)/3.) 1 CONTINUE C DEFINE RANGES XW=X(1) XE=X(NX) YS=Y(1) YN=Y(NY) c c c FYI: c c The next few lines are commented out and can be ignored, these lines c show an example set up for writing to a file called numric.dat c open(9,file='./numric.dat', c 1 form='formatted',status='unknown') c c some example output forms c write(9,*)'This is a test program' c ba=2. c write(9,19)ba 19 format(//,'The value of ba is',f5.1) c close(9) c c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc C C NOW PLOT PSIP and PSI C c start plot commands CALL OPNGKS g=1. c input ranges, neg values may be needed due to constraints of the c call to subroutine set in subroutine ploty (see note below) c these ranges are also used to label axes. c left & right edges of "x" range XWd=Xw XEd=Xe c bottom & top edges of "y" range YSd=YS YNd=YN c note: the set call requires: xwd& output # std out + std err to file output # copy output to a specified file name echo ' write output data to disk ' # chg: change next line to file name to your choice cp output ./contour.out # chg-------^^^^^^^^^^^---------------------------------------- # -V option creates compiled listing (.l file) which is copied (to a .lst file) next cp template.l ./contour.lst # chg-------^^^^^^^^^^^---------------------------------------- # write output data to a temp disk echo ' write plot data to disk ' # next write any metafile that was created to a specified file # chg: change next line to file name to your choice cp gmeta ./contour.plt # chg-------^^^^^^^^^^^--------------------------------------- # chg: change file name to your choice (default: not implemented) #cp ./numric.dat ./contour.dat # chg--------------^^^^^^^^^^^--------------------------------- # remove exe file when done in case next time have compilatn errs rm a.out rm gmeta # error exits to here exit # chg: change file name to your choice cp log ./contour.log # chg--^^^^^^^^^^^^^--------------------------------------------