C
C *** OUTPUT OF DATA (QN, VN AND WN)***
C
      SUBROUTINE DATOUT(DOM,MOM,NOM,NOB,MOB,ROB,RAD,UX,UY,UZ)
C
      IMPLICIT REAL*8(A-H,O-Z)
      COMPLEX*16 UX(MOM,MOB),UY(MOM,MOB),UZ(MOM,MOB),C1,C2
      DIMENSION ROB(MOB)
      CHARACTER FNAME*15
C
C *** OUTPUT OF UX, UY AND UZ ***
C
C   * OUTPUT ON CRT *
C
      WRITE(*,2000)DOM,NOM
      DO 100 IOB=1,NOB
        WRITE(*,2100)ROB(IOB)
        DO 110 K=1,NOM,2
          C1=UX(K  ,IOB)
          C2=UX(K+1,IOB)
          DC1=CDABS(C1)
          DC2=CDABS(C2)
          WRITE(*,2400)C1,DC1,C2,DC2
  110   CONTINUE
  100 CONTINUE
      DO 120 IOB=1,NOB
        WRITE(*,2200)ROB(IOB)
        DO 130 K=1,NOM,2
          C1=UY(K  ,IOB)
          C2=UY(K+1,IOB)
          DC1=CDABS(C1)
          DC2=CDABS(C2)
          WRITE(*,2400)C1,DC1,C2,DC2
  130   CONTINUE
  120 CONTINUE
      DO 140 IOB=1,NOB
        WRITE(*,2300)ROB(IOB)
        DO 150 K=1,NOM,2
          C1=UZ(K  ,IOB)
          C2=UZ(K+1,IOB)
          DC1=CDABS(C1)
          DC2=CDABS(C2)
          WRITE(*,2400)C1,DC1,C2,DC2
  150   CONTINUE
  140 CONTINUE
C
 2000 FORMAT(/' DOM,NOM=',F6.2,I5)
 2100 FORMAT(/' X=',F10.2,'; UX*2 (Real, Imag, Abs)')
 2200 FORMAT(/' X=',F10.2,'; UY*2 (Real, Imag, Abs)')
 2300 FORMAT(/' X=',F10.2,'; UZ*2 (Real, Imag, Abs)')
 2400 FORMAT(2(3D10.3,3X))
C
      WRITE(*,1000)
      READ(*,*)IYES
      IF(IYES.NE.0)GOTO 20
C
 1000 FORMAT(/' File Output of UX, UY AND UZ? (YES=0): ',\)
C
      WRITE(*,*)
   10 WRITE(*,2500)
      READ(*,'(A)')FNAME
      IF(FNAME(1:1).EQ.' ')GOTO 10
      WRITE(*,2600)
 2500 FORMAT( ' Enter file name : ',\)
 2600 FORMAT( '   Data format for PLOTMS 1: OB => 2: UX, UY and UZ')
C      
C   * OUTPUT ON FILE *
C
      OPEN(8,FILE=FNAME)
        WRITE(8,2700)DOM,NOM
        WRITE(8,2800)
        DO 200 IOB=1,NOB
          DO 210 K=1,NOM,4
            WRITE(8,2900)(UX(K+J,IOB),J=0,3)
  210     CONTINUE
  200   CONTINUE
        DO 220 IOB=1,NOB
          DO 230 K=1,NOM,4
            WRITE(8,2900)(UY(K+J,IOB),J=0,3)
  230     CONTINUE
  220   CONTINUE
        DO 240 IOB=1,NOB
          DO 250 K=1,NOM,4
            WRITE(8,2900)(UZ(K+J,IOB),J=0,3)
  250     CONTINUE
  240   CONTINUE
      CLOSE(8)
C
 2700 FORMAT(F15.8,I15)
 2800 FORMAT(///)
 2900 FORMAT(8D10.3)
C
C *** OUTPUT OF DATA (Q, V AND W)***
C
C   * OUTPUT ON CRT *
C
   20 CRD=DCOS(RAD)
      SRD=DSIN(RAD)
      DO 300 IOB=1,NOB
        DO 310 K=1,NOM
          C1=UX(K,IOB)
          C2=UY(K,IOB)
          UX(K,IOB)= C1*CRD+C2*SRD
          UY(K,IOB)=-C1*SRD+C2*CRD
  310     CONTINUE
  300   CONTINUE
C
      WRITE(*,4000)DOM,NOM
      DO 320 IOB=1,NOB
        WRITE(*,4100)ROB(IOB)
        DO 330 K=1,NOM,2
          C1=UX(K  ,IOB)
          C2=UX(K+1,IOB)
          DC1=CDABS(C1)
          DC2=CDABS(C2)
          WRITE(*,4400)C1,DC1,C2,DC2
  330   CONTINUE
  320 CONTINUE
      DO 340 IOB=1,NOB
        WRITE(*,4200)ROB(IOB)
        DO 350 K=1,NOM,2
          C1=UY(K  ,IOB)
          C2=UY(K+1,IOB)
          DC1=CDABS(C1)
          DC2=CDABS(C2)
          WRITE(*,4400)C1,DC1,C2,DC2
  350   CONTINUE
  340 CONTINUE
      DO 360 IOB=1,NOB
        WRITE(*,4300)ROB(IOB)
        DO 370 K=1,NOM,2
          C1=UZ(K  ,IOB)
          C2=UZ(K+1,IOB)
          DC1=CDABS(C1)
          DC2=CDABS(C2)
          WRITE(*,4400)C1,DC1,C2,DC2
  370   CONTINUE
  360 CONTINUE
C
 4000 FORMAT(/' DOM,NOM=',F6.2,I5)
 4100 FORMAT(/' X=',F10.2,'; Q *2 (Real, Imag, Abs)')
 4200 FORMAT(/' X=',F10.2,'; V *2 (Real, Imag, Abs)')
 4300 FORMAT(/' X=',F10.2,'; W *2 (Real, Imag, Abs)')
 4400 FORMAT(2(3D10.3,3X))
C
C   * OUTPUT ON FILE *
C
      WRITE(*,3000)
      READ(*,*)IYES
      IF(IYES.NE.0)GOTO 40  
C
 3000 FORMAT(/' Output of Q, V AND W? (YES=0): ',\)
C
      WRITE(*,*)
   30 WRITE(*,4500)
      READ(*,'(A)')FNAME
      IF(FNAME(1:1).EQ.' ')GOTO 30
      WRITE(*,4600)
 4500 FORMAT( ' Enter file name : ',\)
 4600 FORMAT( '   Data format for PLOTMS 1: OB => 2: Q, V and W ')
C      
      OPEN(8,FILE=FNAME)
        WRITE(8,4700)DOM,NOM
        WRITE(8,4800)
        DO 400 IOB=1,NOB
          DO 410 K=1,NOM,4
            WRITE(8,4900)(UX(K+J,IOB),J=0,3)
  410     CONTINUE
  400   CONTINUE
        DO 420 IOB=1,NOB
          DO 430 K=1,NOM,4
            WRITE(8,4900)(UY(K+J,IOB),J=0,3)
  430     CONTINUE
  420   CONTINUE
        DO 440 IOB=1,NOB
          DO 450 K=1,NOM,4
            WRITE(8,4900)(UZ(K+J,IOB),J=0,3)
  450     CONTINUE
  440   CONTINUE
      CLOSE(8)
C
 4700 FORMAT(F15.8,I15)
 4800 FORMAT(///)
 4900 FORMAT(8D10.3)
C
C *** OUTPUT OF DATA (RAD, TRAN AND VER)***
C
C   * OUTPUT ON CRT *
C
   40 DO 500 IOB=1,NOB
        DO 510 K=1,NOM
          UY(K,IOB)=-UY(K,IOB)
          UZ(K,IOB)=-UZ(K,IOB)
  510     CONTINUE
  500   CONTINUE
C
      WRITE(*,6000)DOM,NOM
      DO 520 IOB=1,NOB
        WRITE(*,6100)ROB(IOB)
        DO 530 K=1,NOM,2
          C1=UX(K  ,IOB)
          C2=UX(K+1,IOB)
          DC1=CDABS(C1)
          DC2=CDABS(C2)
          WRITE(*,6400)C1,DC1,C2,DC2
  530   CONTINUE
  520 CONTINUE
      DO 540 IOB=1,NOB
        WRITE(*,6200)ROB(IOB)
        DO 550 K=1,NOM,2
          C1=UY(K  ,IOB)
          C2=UY(K+1,IOB)
          DC1=CDABS(C1)
          DC2=CDABS(C2)
          WRITE(*,6400)C1,DC1,C2,DC2
  550   CONTINUE
  540 CONTINUE
      DO 560 IOB=1,NOB
        WRITE(*,6300)ROB(IOB)
        DO 570 K=1,NOM,2
          C1=UZ(K  ,IOB)
          C2=UZ(K+1,IOB)
          DC1=CDABS(C1)
          DC2=CDABS(C2)
          WRITE(*,6400)C1,DC1,C2,DC2
  570   CONTINUE
  560 CONTINUE
C
 6000 FORMAT(/' DOM,NOM=',F6.2,I5)
 6100 FORMAT(/' X=',F10.2,'; Q *2 (Real, Imag, Abs)')
 6200 FORMAT(/' X=',F10.2,'; V *2 (Real, Imag, Abs)')
 6300 FORMAT(/' X=',F10.2,'; W *2 (Real, Imag, Abs)')
 6400 FORMAT(2(3D10.3,3X))
C
C   * OUTPUT ON FILE *
C
      WRITE(*,5000)
      READ(*,*)IYES
      IF(IYES.NE.0)GOTO 9999
C
 5000 FORMAT(/' Output of Rad, Tran AND Ver? (YES=0): ',\)
C
      WRITE(*,*)
   50 WRITE(*,6500)
      READ(*,'(A)')FNAME
      IF(FNAME(1:1).EQ.' ')GOTO 50
      WRITE(*,6600)
 6500 FORMAT( ' Enter file name : ',\)
 6600 FORMAT( '   Data format for PLOTMS 1: OB => 2: Q, V and W ')
C      
      OPEN(8,FILE=FNAME)
        WRITE(8,6700)DOM,NOM
        WRITE(8,6800)
        DO 600 IOB=1,NOB
          DO 610 K=1,NOM,4
            WRITE(8,6900)(UX(K+J,IOB),J=0,3)
  610     CONTINUE
  600   CONTINUE
        DO 620 IOB=1,NOB
          DO 630 K=1,NOM,4
            WRITE(8,6900)(UY(K+J,IOB),J=0,3)
  630     CONTINUE
  620   CONTINUE
        DO 640 IOB=1,NOB
          DO 650 K=1,NOM,4
            WRITE(8,6900)(UZ(K+J,IOB),J=0,3)
  650     CONTINUE
  640   CONTINUE
      CLOSE(8)
C
 6700 FORMAT(F15.8,I15)
 6800 FORMAT(///)
 6900 FORMAT(8D10.3)
C
 9999 RETURN
      END
