PROGRAM SETAXISYMM8
C=======================================================================
C                 ********** 8-NODED ELEMENT **********
C------------------- ELEMENT NUMBERING: HORIZONTAL SCAN ----------------
C     DATA GENERATING PROGRAM FOR STATIC8QFXAXISYMM-NEW.FOR
C     DOMAIN SIZE: TLX BY TLY
C     BOUNDARY CONDITIONS
C------------ NORMAL DIRECTION
C        ON FACE OF -X: P=P0
C        ON FACE OF +X: P=0
C        ON FACE OF -Y: V=0
C        ON FACE OF +Y: V=0
C------------ TANGENTIAL DIRECTION
C        ON FACE OF -X: NATURAL BOUNDARY
C        ON FACE OF +X: NATURAL BOUNDARY
C        ON FACE OF -Y: NATURAL BOUNDARY
C        ON FACE OF +Y: NATURAL BOUNDARY
C     NOV. 28, 2012
C     EIJI FUKUMORI
C                                  NUMBERING OF NODEAL POINTS
C  FOR CASE OF NEX=2 & NEY=2     17-----18-----19-----20-----21
C                                 |             |             |
C                                14            15            16
C                                 |             |             |
C                                 9-----10-----11-----12-----13
C                                 |             |             |
C                                 6             7             8
C                                 |             |             |
C                                 1------2------3------4------5
C NOEDX OF 1ST ELEMENT = 1, 2, 3, 7, 11, 10, 9, 6
C=======================================================================
      IMPLICIT REAL*8 ( A-H , O-Z )
      PARAMETER ( ND=8, INTEPT=3, MXE=31300, MXN=34410, MXB=21000 )
      PARAMETER ( TLX0=0.1D0,TLX1=0.15D0,TLY=0.2D0 )
      PARAMETER ( YOUNG=210.D9, POISSON=0.3D0 )
      PARAMETER ( NEX=5,NEY=10 )
      PARAMETER ( P0=10.D6, ALPHA = 1.D0 )
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 / 'STATIC8.DAT' /
C=======================================================================
C         NEX: NEMBER OF ELEMENTS IN RADIAL DIRECTION
C         NEY: NEMBER OF ELEMENTS IN VERTICAL DIRECTION
C         P0, P1, P2: APPLIED HYDRAULIC PRESSURE
C=======================================================================
      THICKNSS = TLX1-TLX0
      DX = THICKNSS / 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) = (I-1)*(NEX*3+2) + 1 + (J-1)*2
      NODEX(NE,2) = NODEX(NE,1) + 1
      NODEX(NE,3) = NODEX(NE,2) + 1
      NODEX(NE,4) = NODEX(NE,3) + (NEX*2 + 1 - J )
      NODEX(NE,5) = NODEX(NE,3) + (NEX*3 + 2 )
      NODEX(NE,6) = NODEX(NE,5) - 1
      NODEX(NE,7) = NODEX(NE,6) - 1
      NODEX(NE,8) = NODEX(NE,4) - 1
      END DO
      END DO
C=======================================================================
C                 NODAL COORDINATE CREATION
      NNODE = 0
      NCENTER = NEX + 1
      DO I = 1 , NEY
      DO J = 1 , NEX*2+1
      NNODE = NNODE + 1
      IF ( NNODE .GT. MXN ) STOP 'NNODE > MXN'
      XCOORD(NNODE) =  DX/2.*(J-1) + TLX0
      YCOORD(NNODE) =  DY   *(I-1)
      END DO
      DO J = 1 , NCENTER
      NNODE = NNODE + 1
      IF ( NNODE .GT. MXN ) STOP 'NNODE > MXN'
      XCOORD(NNODE) =  DX*(J-1) + TLX0
      YCOORD(NNODE) =  DY*(I-1) + DY/2.
      END DO
      END DO
C-------- TOP LAYER -----------
      DO J = 1 , NEX*2+1
      NNODE = NNODE + 1
      IF ( NNODE .GT. MXN ) STOP 'NNODE > MXN'
      XCOORD(NNODE) =  DX/2.*(J-1) + TLX0
      YCOORD(NNODE) =  DY   *NEY
      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
C------- BOTTOM
      DO I = 1 , NDX
      NBFY = NBFY + 1
      IBNDFY(NBFY) = I
      BVY(NBFY) = 0.D0
      END DO
C------- TOP
      DO I = 1 , NDX
      NBFY = NBFY + 1
      IBNDFY(NBFY) = NNODE - NDX + I
      BVX(NBFX) = 0.D0
      END DO
C
C==== SECOND KIND
C--------RESET
      DO I = 1 , NDY
      BVFORCEX(I) = 0.D0
      END DO
C--------- LOAD DISTRIBUTION FOR PARABOLIC ELEMENT UNDER UNIFORM LOAD
C--------- EDGE NODES WIEGHT=1/6, MID NODE WIEGHT=2/3
      WEIGHT1 = 1.D0/6.D0
      WEIGHTC = 4.D0/6.D0
      DO I = 1 , NEY
      NODE1 = (I-1)*(NEX*3+2) + 1
      NODE2 = NODE1 + NEX*2 + 1
      NODE3 = NODE2 + NEX + 1
      DYELE = YCOORD(NODE3)-YCOORD(NODE1)
      DF0 = 2.D0*PI*TLX0*DYELE*P0
      NFORCEX = 2*(I-1) + 1
      IBFORCEX(NFORCEX) = NODE1
      BVFORCEX(NFORCEX) = BVFORCEX(NFORCEX) + WEIGHT1*DF0
      NFORCEX = 2*I
      IBFORCEX(NFORCEX) = NODE2
      BVFORCEX(NFORCEX) = WEIGHTC*DF0
      NFORCEX = 2*I + 1
      IBFORCEX(NFORCEX) = NODE3
      BVFORCEX(NFORCEX) = BVFORCEX(NFORCEX) +WEIGHT1*DF0
      END DO
C=======================================================================
      WRITE (*,*) ' NUMBER OF ELEMENTS (NE) = ',NE
      WRITE (*,*) ' NUMBER OF NODAL POINTS (NNODE) = ',NNODE
      WRITE (*,*) ' NUMBER OF DIRICHLET R (NBFX) = ',NBFX
      WRITE (*,*) ' NUMBER OF DIRICHLET Z (NBFY) = ',NBFY
      WRITE (*,*) ' NUMBER OF NEUMANN R (NFORCEX) = ',NFORCEX
      WRITE (*,*) ' NUMBER OF NEUMANN Z (NFORCEY) = ',NFORCEY
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='ELEMENT8.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,*)
      END DO
      CLOSE (1)
C=======================================================================
C------ CREATION OF PARAMETER FILE TO BE USED IN INCLUDE STATEMENT
      CALL BANDWID ( MXE, ND, NE, NODEX, NBW )
      OPEN ( 1, FILE='PARAM.DAT', STATUS='UNKNOWN' )
      WRITE (1,*) '      PARAMETER ( ND=',ND,', INTEPT=',INTEPT,' )'
      WRITE (1,*) '      PARAMETER ( MXE=',NE,', MXN=',NNODE,
     * ', MXB=',MAX0(NBFX,NBFY,NFORCEX,NFORCEY), ', MXW=',NBW, ' )'
      CLOSE (1)
      STOP 'NORMAL TERMINATION'
      END
C
C
      SUBROUTINE BANDWID ( MXE , ND , NE , NODEX , NBW )
      DIMENSION NODEX(MXE,ND)
C------- RETURN VALUE: NBW
      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 (*,*) ' HALH BANDWIDTH =', NBW
      RETURN
      END
C
C
      FUNCTION F (X,A)
      IMPLICIT REAL*8 ( A-H , O-Z )
      F = X**A
      RETURN
      END