Subject: ufile writes

From: Dick Wieland <[email-masked]>
Date: Fri, 28 Mar 1997 11:09:56 -0500

Steve,

to link on hydra you need to include the ollowing libs:

       $(CODESYSDIR)/lib/tr_vax.a    \
       $(CODESYSDIR)/lib/uflib.a     \
       $(CODESYSDIR)/lib/opdummy.a   \
       $(CODESYSDIR)/lib/jukdummy.a  \
       $(CODESYSDIR)/lib/trgraf.a    \
       $(CODESYSDIR)/lib/ureadsub.a  \
       $(CODESYSDIR)/other/sglib.a   \
       $(CODESYSDIR)/lib/comput.a    \
       $(CODESYSDIR)/lib/vaxonly.a   

where CODESYSDIR = /u/pshare/codesys

-------------------------------------------------------------

here is some code I wrote to gen 2d ufiles ...

C******************** START FILE MMWRIT.FOR ; GROUP MOMSUB *************
C----------------------------------------------------------------
C  MMWRIT  - WRITE THE MOMENTS DATA
C
C   MOD DMC SEPT 1989 -- VARY THE FILENAME PREFIX
C    SURFIN INPUT: "M" IS PREFIX FOR OUTPUT UFILES
C    FQ INPUT:     "F" IS PREFIX FOR OUTPUT UFILES
C
C   THREE UFILES, E.G.:
C    Mnnnnn.RM0 - 1D 0TH R MOMENT VS. TIME
C    Mnnnnn.RMM - 2D HIGHER ORDER R MOMENTS VS. TIME
C    Mnnnnn.YMM - 2D HIGHER ORDER Y MOMENTS VS. TIME
C
C   TIME AVERAGING OPTION--
C    USER MAY REQUEST ALL TIME POINTS IN THE DATA TO BE AVERAGED;
C   THE RESULTING UFILES CONTAIN TWO TIME POINTS AT 0 AND 1 SECONDS
C   AND THE DATA WRITTEN IS TIME INVARIANT, THE AVERAGE OF ALL TIME
C   POINTS IN COMMON
C
	SUBROUTINE MMWRIT(IDATA)
C
C  IDATA=1 IF DATA IS FROM PBX SURFIN CODE
C  IDATA=3 IF FROM PBX-M FQ CODE
C
	INCLUDE 'MOMGET_BLK'
C
	REAL ZTIME(2)
C
	CHARACTER*1 ZCHAR
C
C  CLEAR TIME AVG FLAG
C
C *LISMAK* 12-APR-88  GENERATED LOGICAL DECLARATIONS
      LOGICAL LXOUT
      LOGICAL LYES
C *LISMAK* END OF GENERATED LOGICAL DECLARATIONS
C
C-----------------------------------------------------------------
C
	IF(IDATA.EQ.1) THEN
	  ZCHAR='M'
	ELSE
	  ZCHAR='F'
	ENDIF
C
	IAVG=0
C
	CALL UFSETR(LUNR0,ZCHAR,'RM0',' ',' ')
	CALL UFSETR(LUNRM,ZCHAR,'RMM',' ',' ')
	CALL UFSETR(LUNYM,ZCHAR,'YMM',' ',' ')
C
	CALL UFOPWR(LUNR0,NSHOT,IER)
	IF(IER.NE.0) GO TO 810
C
	CALL UFOPWR(LUNRM,NSHOT,IER)
	IF(IER.NE.0) GO TO 810
C
	CALL UFOPWR(LUNYM,NSHOT,IER)
	IF(IER.NE.0) GO TO 810
C
C  TIME AVERAGING OPTION
C
	IF(LXOUT(0)) WRITE(LNOUT(0),1000) NTIMES,TIME(1),TIME(NTIMES)
 1000	FORMAT('  ',I3,' TIME PTS, RANGE:  ',2(1X,1PE11.4))
	CALL UREAD(
     >'MMWRIT:  AVERAGE ALL TIME PTS BEFORE WRITING DATA ? (Y/N):$')
	IF(LYES(0)) THEN
C  EXECUTE TIME AVG
	  IAVG=1
	  INT=2
C  SET UP PSEUDO-TIME VECTOR; BUT SAVE OLD VALUES
	  ZTIME(1)=TIME(1)
	  ZTIME(2)=TIME(2)
	  TIME(1)=0.0
	  TIME(2)=1.0
C
	  CALL MMTAVG(R0MOM,NTIMES)
	  DO IM=1,NRMOM
	    CALL MMTAVG(RMOMR(1,IM),NTIMES)
	  ENDDO
C
	  DO IM=1,NYMOM
	    CALL MMTAVG(YMOMR(1,IM),NTIMES)
	  ENDDO
C
	ELSE
C  NO TIME AVERAGING
	  INT=NTIMES
	ENDIF
C
C  ** WRITE THE DATA **
C
	IPROC=0
C
	CALL UF1DWR(LUNR0,TOK,SDATE,TIME,R0MOM,INT,IPROC,
     >     TLAB,R0LAB,NUMSC,SCVAL,SCLAB,IER)
C
	IF(IER.NE.0) GO TO 810
C
	CALL UF2DWR(LUNRM,TOK,SDATE,RMOMR,NTMAX,TIME,INT,XND,NRMOM,
     >     IPROC,RMLAB,TLAB,XNDLAB,NUMSC,SCVAL,SCLAB,IER)
C
	IF(IER.NE.0) GO TO 810
C
	CALL UF2DWR(LUNYM,TOK,SDATE,YMOMR,NTMAX,TIME,INT,XND,NYMOM,
     >     IPROC,YMLAB,TLAB,XNDLAB,NUMSC,SCVAL,SCLAB,IER)
C
	IF(IER.NE.0) GO TO 810
C
C  APPEND A FEW COMMENTS
C
	CALL MMCMTS(LUNR0,IAVG)
	CALL MMCMTS(LUNRM,IAVG)
	CALL MMCMTS(LUNYM,IAVG)
C
 810	CONTINUE
	CALL UFCLOS(LUNR0)
	CALL UFCLOS(LUNRM)
	CALL UFCLOS(LUNYM)
C
	IF(IAVG.EQ.1) THEN
C  RESTORE ORIGINAL TIME VECTOR
	  TIME(1)=ZTIME(1)
	  TIME(2)=ZTIME(2)
	ENDIF
C
	RETURN
	END
C******************** END FILE MMWRIT.FOR ; GROUP MOMSUB ***************

---------------------------------------------------------------------

here is the include file referenced in the above code
to give you an idea of what the dimensionality of various things are ...

C-----------------------------------------------------------------------
C  INCLUDE COMMON BLOCKS FOR MOMGET
C
	PARAMETER (MPOL$=8)	!MAX m in Rm,Ym expansion
	PARAMETER (NTHETA$=501)	!MAX NO OF BOUNDARY POINTS ALLOWED
	PARAMETER (NPHI$=1)	!TOROIDAL SYMMETRY
	PARAMETER (MND$=MPOL$*NPHI$)
	PARAMETER (MND1$=MND$+NPHI$)
	PARAMETER (NPD$=NPHI$*NTHETA$)
	PARAMETER (ND$=2*MND$+NPD$)
	COMMON /SCRPAR/ MPOL,NTHETA,NPHI,MND,MND1,NPD,ND
        COMMON/INDAT/MN10,RI(NPD$),ZI(NPD$),MM(MPOL$),NN,
     >  M1(MND1$),DM1(MND1$),N1(MND1$),DN1(MND1$),MPNT,
     >  MPNT2,MN0,PM(MND$),PM2(MND$),NTOR,NTOR0,NPOINTS
        COMMON/SPECTRUM/ALPHA,GNORM,EPS,FACT,SPECW,DELI,ICON
        COMMON/TRIGG/TCOS(NPD$,MND$),TSIN(NPD$,MND$)
 
	PARAMETER (NBUF=20480)	! BUFFER SIZE FOR PLOTTING BDY VS. TIME
C
	PARAMETER (NTMAX=20000)	! MAX NO. OF TIME PTS
	PARAMETER (NMMAX=10)	! MAX NO. OF MOMENTS
C
	PARAMETER (NTVMAX=1024)	! MAX NO. OF TIME PTS (SURFACE VOLTAGE)
C
	REAL TIME(NTMAX)		! TIMES BDY DATA ARE SUPPLIED
	REAL PHIED(NTMAX)		! TOR. FLX TO BDY (WEBERS)
	REAL PSIED(NTMAX)		! POL. FLX TO BDY (WEBERS)
	REAL QED(NTMAX)			! Q AT BDY
	REAL RBT(NTMAX)  		! EXTERNAL R*TOROIDAL FIELD
	REAL PCUR(NTMAX)		! PLASMA CURRENT
	REAL RBTA(NTMAX)		! R*BT TIME AVERAGED
	REAL PCURA(NTMAX)		! STRAIGHT LINE PCUR (D/DT CONST.)
	REAL R0MOM(NTMAX)		! 0TH HORIZ MOMENT
	REAL RMOM(NMMAX,NTMAX)		! HORIZONTAL FOURIER MOMENTS
	REAL YMOM(NMMAX,NTMAX)		! VERITCAL FOURIER MOMENTS
	REAL RMOMR(NTMAX,NMMAX)		! RMOM W/INDEX REVERSED
	REAL YMOMR(NTMAX,NMMAX)		! YMOM W/INDEX REVERSED
	REAL XND(NMMAX)			! MOMENTS INDEX ARRAY
	REAL RBDY(NBUF),YBDY(NBUF)	! BDY MAPPED TO (R,Y) SPACE
C					! FOR PLOTTING
C
	REAL TVS(NTVMAX)		! CONSTRUCTED SURFACE
	REAL VS(NTVMAX)		! VOLTAGE DATA AND TIME PTS.
	REAL VSCOR(NTVMAX)	! VOLTAGE CORRECTION DUE TO D(PHIED)/DT
	REAL VSA(NTMAX)		! TIME AVERAGED VOLTAGE
C
	REAL SCVAL(50)
C
	CHARACTER*30 SCLAB(50)
	CHARACTER*30 TLAB,R0LAB,RMLAB,YMLAB,XNDLAB,RLAB,YLAB	! LABELS
	CHARACTER*30 QLAB,PSILAB,PHILAB,VSLAB,VCLAB,RBLAB,PCLAB
	CHARACTER*4 TOK
	CHARACTER*10 SDATE
	CHARACTER*10 IFILE
	CHARACTER*6 PROG1,PROG2
C
	COMMON/MMDATA/ TIME,PHIED,PSIED,QED,RBT,PCUR,
     >    R0MOM,RMOM,YMOM,XND,RBDY,YBDY,
     >    RMOMR,YMOMR,NTIMES,NRMOM,NYMOM,NBDY,TVS,VS,VSCOR,NVS,
     >    PCURA,RBTA,VSA,
     >    NUMSC,SCVAL
C
	COMMON/MMCNST/ XPI,XMU
C
	COMMON/MMFILE/ LUNI,LUNR0,LUNRM,LUNYM,LUNVS,LUNRB,LUNIP,
     >                 LUNC,NSHOT
C
	COMMON/MMLABL/ TLAB,R0LAB,RMLAB,YMLAB,XNDLAB,RLAB,YLAB,
     >     TOK,SDATE,IFILE,SCLAB,PSILAB,PHILAB,QLAB,PROG1,PROG2,
     >     VSLAB,VCLAB,RBLAB,PCLAB
C
C----------------------------------------------------------------------
--------------------------------------------------------------------

as far as documentation goes ...

look at it on the web ...
http://w3.pppl.gov/tftr/helpdocs/ufiles/ufiles_hlp.html

Dick