*comdeck,fdrpsd                                                          jas
c 
c *** Copyright ANSYS.  All Rights Reserved.
c *** ansys, inc


c     **********  description of rpsd result file  **********
      character*8  rpsdnm
      parameter  (rpsdnm='rpsd    ')
      LONGINT         rpsdfpL, piRpsdL
      integer         rpsdbk,  rpsdut,  piRpsd, hRpsd, rpsdfp
      common /fdrpsd/ rpsdfpL, piRpsdL, rpsdbk, rpsdut,
     x                piRpsd,  hRpsd,   rpsdfp

c  write:    dynwrt
c  rewrite:  aftwd8
c  read:     aftw10
c  read:     lnfrcl,lnfrin

c     **********  file format  **********

c  group   type    nrec    lrec           contents

c    1      i       1       30       fun08,mxeval,wavkey, ndone, nmode,
c                                    nbase,  npsd,lowtri, nnpsd, mdpsd,
c                                    irms1, irms2, irms3,reldfp,relvfp,
c                                   relafp,quadfp,quavfp,quaafp,covdfp,
c                                   covvfp,covafp, mxexp,     0,     0,
c                                        0,     0,     0,     0,     0
c    2      i       1       10      (ipsdty(i),i=1,10)
c    3      i       1       10      (iext(i),i=1,10)
c if wavkey=1
c    3a     i       1       10      (numdf(i),i=1,10)
c endif
c    4      dp      1       3        freq1, freq2,frqrat
c    5      dp      1      nmode    (dampjk(i),i=1,nmode)
c    6      dp      1      ndone    (omeg(i),i=1,ndone)

c displacement-type relative quantities
c if irms1=1 or irms1=2
c     'RELDFP' is set here
c     do xxx jmd = 1,nmode
c        zcj = sqrt(frq(jmd))
c        do xx kmd = 1,jmd
c           zck = sqrt(frq(kmd))
c           if ((zcj/zck) .gt. frqrat) go to xx
c    7      i       1       5        ieval,   jmd,   kmd,     0,     0
c    8      dp      1      ieval    (freq(i),i=1,ieval)
c    9      dp      1      ieval    (rdpsd(i),i=1,ieval)
c  xx    continue
c xxx continue
c endif

c velocity-type relative quantities
c if irms2=1 or irms2=2
c     'RELVFP' is set here
c     do xxx jmd = 1,nmode
c        zcj = sqrt(frq(jmd))
c        do xx kmd = 1,jmd
c           zck = sqrt(frq(kmd))
c           if ((zcj/zck) .gt. frqrat) go to xx
c    10     i       1       5        ieval,   jmd,   kmd,     0,     0
c    11     dp      1      ieval    (freq(i),i=1,ieval)
c    12     dp      1      ieval    (rvpsd(i),i=1,ieval)
c  xx    continue
c xxx continue
c endif

c acceleration-type relative quantities
c if irms3=1 or irms3=2
c     'RELAFP' is set here
c     do xxx jmd = 1,nmode
c        zcj = sqrt(frq(jmd))
c        do xx kmd = 1,jmd
c           zck = sqrt(frq(kmd))
c           if ((zcj/zck) .gt. frqrat) go to xx
c    13     i       1       5        ieval,   jmd,   kmd,     0,     0
c    14     dp      1      ieval    (freq(i),i=1,ieval)
c    15     dp      1      ieval    (rapsd(i),i=1,ieval)
c  xx    continue
c xxx continue
c endif

c displacement-type quasi-static quantities
c if irms1=1 and wavkey=0
c     do xxx lp = 1,nbase
c        lpsd = iext(lp)
c        do xx mp = 1,lp
c           mpsd = iext(mp)
c           'QUADFP' is set here
c    16     i       1       5         nseg,    lp,    mp,     0,     0
c           if (nseg .eq. 0) go to xx
c    17     i       1       5        ieval,     0,     0,     0,     0
c    18     dp      1      ieval    (freq(i),i=1,ieval)
c    19     dp      1      ieval    (qdpsd(i),i=1,ieval)
c  xx    continue
c xxx continue
c endif
c if irms1=1 and wavkey=1
c     do xxx lp = 1,nbase
c        lpsd = iext(lp)
c        mpsd = lpsd
c        'QUADFP' is set here
c    16     i       1       5         nseg,    lp,     0,     0,     0
c        if (nseg .eq. 0) go to xx
c        do xx iidof = 1,ncdof
c           do x jjdof = 1,iidof
c    17     i       1       5        ieval,     0,     0,     0,     0
c    18     dp      1      ieval    (freq(i),i=1,ieval)
c    19     dp      1      ieval    (qdpsd(i),i=1,ieval)
c   x       continue
c  xx    continue
c xxx continue
c endif

c velocity-type quasi-static quantities
c if irms2=1 and wavkey=0
c     do xxx lp = 1,nbase
c        lpsd = iext(lp)
c        do xx mp = 1,lp
c           mpsd = iext(mp)
c           'QUAVFP' is set here
c    20     i       1       5         nseg,    lp,    mp,     0,     0
c           if (nseg .eq. 0) go to xx
c    21     i       1       5        ieval,     0,     0,     0,     0
c    22     dp      1      ieval    (freq(i),i=1,ieval)
c    23     dp      1      ieval    (qvpsd(i),i=1,ieval)
c  xx    continue
c xxx continue
c endif
c if irms2=1 and wavkey=1
c     do xxx lp = 1,nbase
c        lpsd = iext(lp)
c        mpsd = lpsd
c        'QUAVFP' is set here
c    20     i       1       5         nseg,    lp,     0,     0,     0
c           if (nseg .eq. 0) go to xx
c        do xx iidof = 1,ncdof
c           do x jjdof = 1,iidof
c    21     i       1       5        ieval,     0,     0,     0,     0
c    22     dp      1      ieval    (freq(i),i=1,ieval)
c    23     dp      1      ieval    (qvpsd(i),i=1,ieval)
c   x       continue
c  xx    continue
c xxx continue
c endif

c acceleration-type quasi-static quantities
c if irms3=1 and wavkey=0
c     do xxx lp = 1,nbase
c        lpsd = iext(lp)
c        do xx mp = 1,lp
c           mpsd = iext(mp)
c           'QUAAFP' is set here
c    24     i       1       5         nseg,    lp,    mp,     0,     0
c           if (nseg .eq. 0) go to xx
c    25     i       1       5        ieval,     0,     0,     0,     0
c    26     dp      1      ieval    (freq(i),i=1,ieval)
c    27     dp      1      ieval    (qapsd(i),i=1,ieval)
c  xx    continue
c xxx continue
c endif
c if irms3=1 and wavkey=1
c     do xxx lp = 1,nbase
c        lpsd = iext(lp)
c        mpsd = lpsd
c        'QUAAFP' is set here
c    24     i       1       5         nseg,    lp,    mp,     0,     0
c           if (nseg .eq. 0) go to xx
c        do xx iidof = 1,ncdof
c           do x jjdof = 1,iidof
c    25     i       1       5        ieval,     0,     0,     0,     0
c    26     dp      1      ieval    (freq(i),i=1,ieval)
c    27     dp      1      ieval    (qapsd(i),i=1,ieval)
c   x       continue
c  xx    continue
c xxx continue
c endif

c displacement-type covariant quantities
c if irms1=1 and wavkey=0
c     do xxx jmd = 1,nmode
c        do xx lp = 1,nbase
c           lpsd = iext(lp)
c           'COVDFP' is set here
c    28     i       1       5        ieval,   jmd,    lp,     0,     0
c    29     dp      1      ieval    (freq(i),i=1,ieval)
c    30     dp      1      ieval    (cdpsd(i),i=1,ieval)
c  xx    continue
c xxx continue
c endif
c if irms1=1 and wavkey=1
c     do xxx jmd = 1,nmode
c        do xx lp = 1,nbase
c           lpsd = iext(lp)
c           mpsd = lpsd
c           'COVDFP' is set here
c    28     i       1       5         nseg,   jmd,    lp,     0,     0
c           if (nseg .eq. 0) go to xx
c           do x iidof = 1,ncdof
c    28a    i       1       5        ieval, iidof,     0,     0,     0
c    29     dp      1      ieval    (freq(i),i=1,ieval)
c    30     dp      1      ieval    (cdpsd(i),i=1,ieval)
c   x       continue
c  xx    continue
c xxx continue
c endif

c velocity-type covariant quantities
c if irms2=1 and wavkey=0
c     do xxx jmd = 1,nmode
c        do xx lp = 1,nbase
c           lpsd = iext(lp)
c           'COVVFP' is set here
c    31     i       1       5        ieval,   jmd,    lp,     0,     0
c    32     dp      1      ieval    (freq(i),i=1,ieval)
c    33     dp      1      ieval    (cvpsd(i),i=1,ieval)
c  xx    continue
c xxx continue
c endif
c if irms2=1 and wavkey=1
c     do xxx jmd = 1,nmode
c        do xx lp = 1,nbase
c           lpsd = iext(lp)
c           mpsd = lpsd
c           'COVVFP' is set here
c    31     i       1       5         nseg,   jmd,    lp,     0,     0
c           if (nseg .eq. 0) go to xx
c           do x iidof = 1,ncdof
c    31a    i       1       5        ieval, iidof,     0,     0,     0
c    32     dp      1      ieval    (freq(i),i=1,ieval)
c    33     dp      1      ieval    (cvpsd(i),i=1,ieval)
c   x       continue
c  xx    continue
c xxx continue
c endif

c acceleration-type covariant quantities
c if irms3=1 and wavkey=0
c     do xxx jmd = 1,nmode
c        do xx lp = 1,nbase
c           lpsd = iext(lp)
c           'COVAFP' is set here
c    34     i       1       5        ieval,   jmd,    lp,     0,     0
c    35     dp      1      ieval    (freq(i),i=1,ieval)
c    36     dp      1      ieval    (capsd(i),i=1,ieval)
c  xx    continue
c xxx continue
c endif
c if irms3=1 and wavkey=1
c     do xxx jmd = 1,nmode
c        do xx lp = 1,nbase
c           lpsd = iext(lp)
c           mpsd = lpsd
c           'COVVFP' is set here
c    34     i       1       5         nseg,   jmd,    lp,     0,     0
c           if (nseg .eq. 0) go to xx
c           do x iidof = 1,ncdof
c    34a    i       1       5        ieval, iidof,     0,     0,     0
c    35     dp      1      ieval    (freq(i),i=1,ieval)
c    36     dp      1      ieval    (capsd(i),i=1,ieval)
c   x       continue
c  xx    continue
c xxx continue
c endif

c   fun08  = unit number for file.rpsd
c  mxeval  = maximum possible number of forcing frequency points
c  wavkey  = 0 (ordinary), 1 (wave propagation or spatial)
c   ndone  = number of modes extracted in modal analysis
c   nmode  = number of modes selected for evaluation
c   nbase  = number of base excitation tables
c   npsd   = total number of psd table
c   lowtri = nmode*(nmode+1)/2
c   npspsd = npsdx*(npsdx+1)/2
c   mdnpsd = npsdx*nmode
c   irms1  = 0 no disp 1-sigma, 1 abs disp 1-sigma, 2 rel disp 1-sigma
c   irms2  = 0 no velo 1-sigma, 1 abs velo 1-sigma, 2 rel velo 1-sigma
c   irms3  = 0 no acel 1-sigma, 1 abs acel 1-sigma, 2 rel acel 1-sigma
c   iwave  = 1 for wave propagation and 0 for non-wave propagation
c   ispace = 1 for spatial correl. and 0 for no spatial correl.
c   reldfp = file position for rel disp modal matrix
c   relvfp = file position for rel velo modal matrix
c   relafp = file position for rel acel modal matrix
c   quadfp = file position for quasi-static disp matrix
c   quavfp = file position for quasi-static velo matrix
c   quaafp = file position for quasi-static acel matrix
c   covdfp = file position for covariant disp matrix
c   covvfp = file position for covariant velo matrix
c   covafp = file position for covariant acel matrix
c   mxexp  = number of modes expanded in modal analysis
c   ispdty = type of psd (see rancom)
c   iext   = compact address only for base excitation; stores original
c            address for base excitation contained in iexcit (rancom)
c   numdf  = no. of dof'S EXCITED BY PSD TABLE FOR WAVE OR SPATIAL
C   FREQ1  = MINIMUM FORCING FREQUENCY ENTERED BY USER
C   FREQ2  = MINIMUM FORCING FREQUENCY ENTERED BY USER
C   FRQRAT = FREQUENCY RATIO TO COMPUTE BAND-WIDTH ON MODAL MATRIX
c      spectrum mode combination option [mcomb,psd cmd]
c   dampjk = modal damping vector
c   omeg   = natural frequency vector

co  rpsdfpL      file position on file rpsd
co  piRpsdL      Buffer pointer for file rpsd 
co  rpsdbk       block number for file rpsd
co  rpsdut       file unit for file rpsd
co  hRpsd        Handle for file rpsd buffer
