PROGRAM SETSOLID09
C=======================================================================
C     DATA GENERATING PROGRAM FOR STATIC8Q.FOR
C     DOMAIN SIZE: TLX BY TLY
C     BOUNDARY CONDITIONS
C        ON FACES OF -X AND -Y: U=V=0 AT NODE1, U= ON OTHER NODES
C        ON FACE OF +X: FX=-1000N ON THE TOP NODE
C                       FX= 1000N ON THE LOWER NODE
C        ON OTHER FACES: TAUnn=TAUns=0
C     EIJI FUKUMORI APRIL 15, 2010
C                                  NUMBERING OF NODEAL POINTS
C  FOR CASE OF NEX=2 & NEY=2     21-----22-----23-----24-----25
C                                 |             |             |
C                                16     17     18     19     20
C                                 |             |             |
C                                11-----12-----13-----14-----15
C                                 |             |             |
C                                 6      7      8      9     10
C                                 |             |             |
C                                 1------2------3------4------5
C NOEDX OF 1ST ELEMENT = 1, 2, 3, 8, 13, 12, 11, 6, 7
C=======================================================================
      IMPLICIT REAL*8 ( A-H , O-Z )
      PARAMETER ( ND=9, INTEPT=3, MXE=3130, MXN=3441, MXB=2100 )
      PARAMETER ( TLX = 20.D0, TLY = 2.D0, NEX=100, NEY=4 )
      PARAMETER ( YOUNG=69.D6,POISSON=0.3D0 )
C=======================================================================
      DIMENSION NODEX(MXE,ND), XCOORD(MXN), YCOORD(MXN),
     * IBNDFX(MXB),IBNDFY(MXB),BVX(MXB),BVY(MXB),
     * IBFORCEX(MXB), IBFORCEY(MXB), BVFORCEX(MXB), BVFORCEY(MXB)
      DIMENSION NEUTRAL(MXN)
      CHARACTER PROJECT*12,EXFILE*3
      LOGICAL YES
C=======================================================================
      DATA PROJECT / 'STATIC09.DAT' /
C=======================================================================
C         NEY: NEMBER OF VERTICAL ELEMENTS (NUMBER OF NODES: NEY+1)
C         NEX: NEMBER OF HORIZONTAL ELEMENTS (NUMBER OF NODES: NEX+1)
C=======================================================================
      DX = TLX / NEX
      DY = TLY / NEY
      NDX = NEX*2 + 1
      NDY = NEY*2 + 1
C=======================================================================
      WRITE (*,*)' YOUNG MODULUS = ',YOUNG
      WRITE (*,*)' POISSON RATIO = ',POISSON
C=======================================================================
C                    ELEMENT CREATION
      NE = 0
      DO I = 1 , NEY
      DO J = 1 , NEX
      NE = NE + 1
      IF ( NE .GT. MXE ) STOP 'NE > MXE'
      NODEX(NE,1) = (J-1)*(NEY*4+2) + (I-1)*2 + 1
      NODEX(NE,2) = NODEX(NE,1) + NEY*2 + 1
      NODEX(NE,3) = NODEX(NE,2) + NEY*2 + 1
      NODEX(NE,4) = NODEX(NE,3) + 1
      NODEX(NE,5) = NODEX(NE,4) + 1
      NODEX(NE,6) = NODEX(NE,2) + 2
      NODEX(NE,7) = NODEX(NE,1) + 2
      NODEX(NE,8) = NODEX(NE,1) + 1
      NODEX(NE,9) = NODEX(NE,2) + 1
      END DO
      END DO
C=======================================================================
C                 NODAL COORDINATE CREATION
      NNODE = 0
      DO J = 1 , NEX*2+1
      DO I = 1 , NEY*2+1
      NNODE = NNODE + 1
      IF ( NNODE .GT. MXN ) STOP 'NNODE > MXN'
      XCOORD(NNODE) =  DX/2.*(J-1)
      YCOORD(NNODE) =  DY/2.*(I-1) - TLY/2.D0
      END DO
      END DO
C=======================================================================
      PI = 4.D0* ATAN (1.D0)
C                    BOUNDARY CONDITIONS
C==== FIRST KIND
C--------- NAVIER EQUATIONS
      NBFX = 0
      NBFY = 0
      NFORCEX = 0
      NFORCEY = 0
C--------- X DIRECTION ON FACE -X
      U0 = 0.
      DO J = 1 , NDY
      NBFX = NBFX + 1
      IBNDFX(NBFX) = J
      BVX(NBFX) = U0
      END DO
C--------- Y DIRECTION ON FACE -X
C******************************************************
C    FIXED LEFT END OF BEAM NEUTRAL LINE
C******************************************************
      V0 = 0.
      NBFY = NBFY + 1
      IBNDFY(NBFY) = NEY + 1
      BVY(NBFY) = V0
C******************************************************
C******************************************************
C==== SECOND KIND
C--------- FACE OF +X
      FORCEINX =  1000.D0
C LOWER POINT
      NFORCEX = NFORCEX + 1
      IBFORCEX(NFORCEX) = 2*NEX*NDY + 1
      BVFORCEX(NFORCEX) = FORCEINX
C UPPER POINT
      FORCEINX =  -1000.D0
      NFORCEX = NFORCEX + 1
      IBFORCEX(NFORCEX) = 2*NEX*NDY + NDY
      BVFORCEX(NFORCEX) = FORCEINX
C=======================================================================
      WRITE (*,*) ' NUMBER OF ELEMENTS (NE) = ',NE
      WRITE (*,*) ' NUMBER OF NODAL POINTS (NNODE) = ',NNODE
C=======================================================================
C                      DATA FILE INQUIRY
      EXFILE = 'NEW'
      INQUIRE ( FILE = PROJECT, EXIST = YES )
      IF ( YES ) EXFILE='OLD'
C=======================================================================
C                     MAKING DATA FILES
C---------- 'PROJECT'.JNK
      IR = 1
C---------- PARAMETERS
      OPEN ( IR, FILE=PROJECT, STATUS = EXFILE )
      WRITE(1,*) YOUNG , POISSON
C---------- ELEMENTS
C---------- ELEMENTS
      WRITE(1,*) NE
      DO I = 1 , NE
      WRITE (1,*) I, (NODEX(I,J), J = 1 , ND )
      END DO
C---------- COORDINATES OF NONAL POINTS
      WRITE(1,*) NNODE
      DO I = 1 , NNODE
      WRITE(1,*) I,XCOORD(I), YCOORD(I)
      END DO
C---------- DIRICHLET TYPE BOUNDARY CONDITIONS
      WRITE(1,*) NBFX
      DO I = 1 , NBFX 
      WRITE (1,*) IBNDFX(I), BVX(I)
      END DO
      WRITE(1,*) NBFY
      DO  I = 1 , NBFY 
      WRITE (1,*) IBNDFY(I), BVY(I)
      END DO
C---------- NUEMANN TYPE BOUNDARY CONDITIONS
      WRITE(1,*) NFORCEX
      IF ( NFORCEX .GT. 0 ) THEN
      DO I = 1 , NFORCEX
      WRITE(1,*) IBFORCEX(I), BVFORCEX(I)
      END DO
      ENDIF
      WRITE(1,*) NFORCEY
      IF ( NFORCEY .GT. 0 ) THEN
      DO I = 1 , NFORCEY
      WRITE(1,*) IBFORCEY(I), BVFORCEY(I)
      END DO
      ENDIF
C---------- FINAL
      CLOSE (1)
C---------- ELEMENT DRAWING
      OPEN ( 1, FILE='ELEMENT09.DAT', STATUS = 'UNKNOWN')
      DO I = 1, NE
      DO J = 1, 3
      WRITE (1,*) XCOORD(NODEX(I,J)), YCOORD(NODEX(I,J))
      END DO
      WRITE (1,*)
      DO J = 3, 5
      WRITE (1,*) XCOORD(NODEX(I,J)), YCOORD(NODEX(I,J))
      END DO
      WRITE (1,*)
      DO J = 5, 7
      WRITE (1,*) XCOORD(NODEX(I,J)), YCOORD(NODEX(I,J))
      END DO
      WRITE (1,*)
      DO J = 7, 8
      WRITE (1,*) XCOORD(NODEX(I,J)), YCOORD(NODEX(I,J))
      END DO
      WRITE (1,*) XCOORD(NODEX(I,1)), YCOORD(NODEX(I,1))
      WRITE (1,*)
      WRITE (1,*) XCOORD(NODEX(I,9)), YCOORD(NODEX(I,9))
      WRITE (1,*)
      END DO
      CLOSE (1)
C---------- NEUTRAL NODAL NUMBERS
C NODEL NUMBERS ALONG NEUTRAL LINE OF BEAM
      NNEUT = 1
      NEUTRAL(NNEUT) = NEY + 1
      DO I = 1 , 2*NEX
      NNEUT = NNEUT + 1
      NEUTRAL(NNEUT) = NEUTRAL(NNEUT-1) + NDY
      END DO
C
      OPEN ( 1, FILE='NEUTRAL09.DAT', STATUS = 'UNKNOWN')
      WRITE (1,*) NNEUT
      DO I = 1 , NNEUT
      WRITE (1,*) NEUTRAL(I)
      END DO
      CLOSE (1)
C=======================================================================
      CALL BANDWID ( ND, MXE, NE, NODEX , NBW  )
C------ CREATION OF PARAMETER FILE TO BE USED IN INCLUDE STATEMENT
      OPEN ( 1, FILE='PARAM.DAT', STATUS='UNKNOWN' )
      WRITE (1,*) '      PARAMETER ( ND=',ND,'    )'
      WRITE (1,*) '      PARAMETER ( INTEPT=',INTEPT,')'
      WRITE (1,*) '      PARAMETER ( MXE=',NE,')'
      WRITE (1,*) '      PARAMETER ( MXN=',NNODE,')'
      WRITE (1,*) '      PARAMETER ( MXW=',NBW,')'
      NB = MAX0 (NBFX, NBFY, NFORCEX, NFORCEY )
      WRITE (1,*) '      PARAMETER ( MXB=',NB,'   )'
      CLOSE (1)
C=======================================================================
      STOP "NORMAL TERMINATION"
      END
C
C
      SUBROUTINE BANDWID ( ND, MXE, NE, NODEX , NBW  )
      IMPLICIT REAL*8 ( A-H , O-Z )
      DIMENSION NODEX(MXE,ND)
      NBW = 0
      DO  I = 1 , NE
      DO  J = 1 , ND-1
      DO  K = J+1 , ND
      NBW = MAX0(NBW,IABS(NODEX(I,J)-NODEX(I,K)))
      END DO
      END DO
      END DO
      NBW = NBW + 1
      WRITE(*,*) 'HALF BANDWIDTH + 1 =', NBW
      RETURN
      END