PROGRAM SETPOLAR
C======================================================================
C        DATA ASSEMBLY PROGRAM FOR APPLICATION: POLAR1D.FOR
C                   EIJI FUKUMORI  11-FEB-2022
C              ********* CASE OF NO CHARGE ZONE **********
C  X(I) = RADIUS OF POLAR COORDINATE
C  CHARGE(I) = CHARGE SUCH AS CURRENT INTO THE CENTER WIRE OF COAXIAL
C  IBTYPE(1) = BOUNDARY CONDITION AT R=0        2 FOR NEUMANN
C  IBTYPE(2) = BOUNDARY CONDITION AT R=RADIUSB  1 FOR DICHILET
C  BV(I) = BOUNDARY VALUES
C  NODEX(I,J) = REPRESENTS ELEMENT CONFIGURATION
C======================================================================
      IMPLICIT REAL*8 ( A-H , O-Z )
      PARAMETER ( MXND=3,MXE=20000, MXN=MXE+1, ND=2 )
      DIMENSION NODEX(MXE,MXND),CHARGE(MXE),X(MXN),IBTYPE(2),BV(2)
C---------- INFORMATION OF COAXIAL CABLE DIMENSION
C-------------------- RADIUSA: RADIUS OF THE CENTER CONDUCTOR
C-------------------- RADIUSB: RADIUS OF BRAIDED CONDUCTOR
      RADIUSA = 0.7D0
      RADIUSB = 2.4D0
      WRITE (*,*) 'RADIUS A=', RADIUSA
      WRITE (*,*) 'RADIUS B=', RADIUSB
C---------- BOUNDARY CONDITIONS
      IBTYPE(1) = 2
      IBTYPE(2) = 1
      PI = 4.D0*DATAN (1.D0)
      Q = 1.D0
      BV(1) = -RADIUSA**2*Q/(2.D0*PI*RADIUSA)
      BV(2) = 0.D0
      WRITE (*,*) 'CASE OF NO UNIFORM ELECTRICAL CHARGE'
      WRITE (*,*) 'VALUE OF CONCENTRATED CHARGE Q=',Q
      WRITE (*,*) 'BOUNDARY CONDITION AT R=A IS NEUMANN TYPE'
      WRITE (*,*) 'BOUNDARY VALUE IS ', BV(1)
      WRITE (*,*) 'BOUNDARY CONDITION AT R=B IS DIRICHLET TYPE'
      WRITE (*,*) 'BOUNDARY VALUE IS ', BV(2)
C---------- VALUE OF CHARGE INTO THE CENTER CONDUCTOR
C----------------------------------------------------------
C--------- NE1 = NUMBER OF ELEMENTS WHERE CHARGE APPLIED
C--------- NE2 = NO CHARGE ZONE
      NE = 30
      WRITE (*,*) 'NUMBER OF ELEMENTS NE =', NE
C------- NODAL NUMBER ASSIGNMENT----------
      DO I = 1 , NE
      CHARGE(I) = 0.D0
      DO J = 1 , ND
      NODE = (I - 1)*(ND-1) + J
      NODEX(I,J) = NODE
      END DO
      END DO
C--------------NODAL COORDINATE--------------
      NNODE = NE + 1
      DX = ( RADIUSB - RADIUSA ) / NE
      DO I = 1 , NNODE
      X(I) =  (I-1)*DX + RADIUSA
      END DO
C------- WRITING DATA INTO INPUT FILE
      OPEN ( 1,FILE='POLAR.DAT', STATUS="UNKNOWN")
      WRITE(1,*) NE
      DO I = 1 , NE
      WRITE(1,*) I, (NODEX(I,J),J=1,ND), CHARGE(I)
      END DO
      DO I = 1 , NNODE
      WRITE(1,*) I, X(I)
      END DO
      WRITE(1,*) IBTYPE(1), BV(1)
      WRITE(1,*) IBTYPE(2), BV(2)
      CLOSE (1)
      STOP
      END