与转换旧代码相关的语法细微差别

问题描述 投票:0回答:1

错误较多,但主要与代码中写FORMAT的部分有关。在这一部分中,我分离了一些单词“_”,因为它们以颜色突出显示,这意味着编译器不会将它们视为解释,而是对某些操作的调用,我还将“=”替换为“等于”,去掉了点,那么编译器是如何诅咒它们的。如果有人有机会,请帮我纠正错误。我相信它们是相同的类型。我在 Code::Blocks 中使用 2012 代码编译器,这样就不会抱怨“GO TO”。

源代码链接:https://acrobat.adobe.com/id/urn:aaid:sc:VA6C2:e77e5821-8991-4144-9711-d2ffcf868c0a

更新代码:

          PROGRAM TWOFS
          COMMON/S1/PI,PR,PR1,PR2,PR3,CON,COND
          COMMON/S2/SXXS,SXXN,SYYS,SYYN,SXYS,SXYN,UXS,UXN,UYS,UYN
          COMMON/S3/C(100,100),B(100),P(100)
    !
          DIMENSION XM(50),YM(50),A(50),COSBET(50),SINBET(50),KOD(50)
          DIMENSION TITLE(20)
    !
          READ (5,1) (TITLE(I),I=1,20)
          WRITE (6,2) (TITLE(I),I=1,20)
          READ (5,3) NUMBS,NUMOS,KSYM
          READ (5,4) PR,E,XSYM,YSYM
          READ (5,5) PXX,PYY,PXY
          WRITE (6,6) NUMBS,NUMOS
          GO TO (80,85,90,95), KSYM
    80    WRITE (6,7)
          GO TO 100
    85    WRITE (6,8) XSYM
          GO TO 100
    90    WRITE (6,9) YSYM
          GO TO 100
    95    WRITE (6,10) XSYM,YSYM
    !
    100   CONTINUE
          WRITE (6,11) PR,E
          WRITE (6,12) PXX,PYY,PXY
    !
          PI=4.*ATAN(1.)
          CON=1./(4.*PI*(1.-PR))
          COND=(1.+PR)/E
          PR1=1.-2.*PR
          PR2=2.*(1.-PR)
          PR3=3.-4.*PR
    !
    !   DEFINE LOCATIONS,SIZES,ORIENTATIONS AND BOUNDARY CONDITIONS OF BOUNDARY ELEMENTS
    !
          NUMBE=0
          DO 110 N=1,NUMBS
          READ (5,14) NUM,XBEG,YBEG,XEND,YEND,KODE,BVS,BVN
          XD=(XEND-XBEG)/NUM
          YD=(YEND-YBEG)/NUM
          SW=SQRT(XD*XD+YD*YD)
    !
          DO 110 NE=1,NUM
          NUMBE=NUMBE+1
          M=NUMBE
          XM(M)=XBEG+0.5*(2.*NE-1.)*XD
          YM(M)=YBEG+0.5*(2.*NE-1.)*YD
          A(M)=0.5*SW
          SINBET(M)=YD/SW
          COSBET(M)=XD/SW
          KOD(M)=KODE
          MN=2*M
          MS=MN-1
          B(MS)=BVS
    110   B(MN)=BVN
          WRITE (6,13)
          DO 115 M=1,NUMBE
          SIZE=2.*A(M)
          ANGLE=180.*ATAN2(SINBET(M),COSBET(M))/PI
          WRITE (6,15) M,KOD(M),XM(M),YM(M),SIZE,ANGLE,B(2*M-1),B(2*M)
    115   CONTINUE
    !
    !   ADJUST STRESS BOUNDARY VALUES TO ACCOUNT FOR INITIAL STRESSES.
    !
          DO 150 N=1,NUMBE
          NN=2*N
          NS=NN-1
          COSB=COSBET(N)
          SINB=SINBET(N)
          SIGS=(PYY-PXX)*SINB*COSB+PXY*(COSB*COSB-SINB*SINB)
          SIGN=PXX*SINB*SINB-2.*PXY*SINB*COSB+PYY*COSB*COSB
          GO TO (120,150,130,140),KOD(N)
    120   B(NS)=B(NS)-SIGS
          B(NN)=B(NN)-SIGN
          GO TO 150
    130   B(NN)=B(NN)-SIGN
          GO TO 150
    140   B(NS)=B(NS)-SIGS
    150   CONTINUE
    !
    !   COMPUTE INFLUENCE COEFFICIENTS AND SET UP SYSTEM OF ALGEBRAIC EQUATIONS.
    !
          DO 300 I=1,NUMBE
          IN=2*I
          IS=IN-1
          XI=XM(I)
          YI=YM(I)
          COSBI=COSBET(I)
          SINBI=SINBET(I)
          KODE=KOD(I)
    !
          DO 300 J=1,NUMBE
          JN=2*J
          JS=JN-1
          CALL INITL
          XJ=XM(J)
          YJ=YM(J)
          COSBJ=COSBET(J)
          SINBJ=SINBET(J)
          AJ=A(J)
          CALL COEFF(XI,YI,XJ,YJ,AJ,COSBJ,SINBJ,+1)
          GO TO (240,210,220,230),KSYM
    !
    210   XJ=2.*XSYM-XM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
          GO TO 240
    !
    220   YJ=2.*YSYM-YM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
          GO TO 240
    !
    230   XJ=2.*XSYM-XM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
          XJ=XM(J)
          YJ=2.*YSYM-YM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
          XJ=2.*XSYM-XM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,-SINBJ,+1)
    !
    240   CONTINUE
          GO TO (250,260,270,280),KODE
    !
    250   C(IS,JS)=(SYYS-SXXS)*SINBI*COSBI+SXYS*(COSBI*COSBI-SINBI*SINBI)
          C(IS,JN)=(SYYN-SXXN)*SINBI*COSBI+SXYN*(COSBI*COSBI-SINBI*SINBI)
          C(IN,JS)=SXXS*SINBI*SINBI-2.*SXYS*SINBI*COSBI+SYYS*COSBI*COSBI
          C(IN,JN)=SXXN*SINBI*SINBI-2.*SXYN*SINBI*COSBI+SYYN*COSBI*COSBI
          GO TO 300
    !
    260   C(IS,JS)=UXS*COSBI+UYS*SINBI
          C(IS,JN)=UXN*COSBI+UYN*SINBI
          C(IN,JS)=-UXS*SINBI+UYS*COSBI
          C(IN,JN)=-UXN*SINBI+UYN*COSBI
          GO TO 300
    !
    270   C(IS,JS)=UXS*COSBI+UYS*SINBI
          C(IS,JN)=UXN*COSBI+UYN*SINBI
          C(IN,JS)=SXXS*SINBI*SINBI-2.*SXYS*SINBI*COSBI+SYYS*COSBI*COSBI
          C(IN,JN)=SXXN*SINBI*SINBI-2.*SXYN*SINBI*COSBI+SYYN*COSBI*COSBI
          GO TO 300
    !
    280   C(IS,JS)=(SYYS-SXXS)*SINBI*COSBI+SXYS*(COSBI*COSBI-SINBI*SINBI)
          C(IS,JN)=(SYYN-SXXN)*SINBI*COSBI+SXYN*(COSBI*COSBI-SINBI*SINBI)
          C(IN,JS)=-UXS*SINBI+UYS*COSBI
          C(IN,JN)=-UXN*SINBI+UYN*COSBI
    !
    300   CONTINUE
    !
    !   SOLVE SYSTEM OF ALGEBRAIC EQUATIONS.
    !
          N=2*NUMBE
          CALL SOLVE(N)
    !
    !   COMPUTE BOUNDARY DISPLACEMENTS AND STRESSES.
    !
          WRITE (6,16)
          DO 600 I=1,NUMBE
          XI=XM(I)
          YI=YM(I)
          COSBI=COSBET(I)
          SINBI=SINBET(I)
    !
          UX=0.
          UY=0.
          SIGXX=PXX
          SIGYY=PYY
          SIGXY=PXY
    !
          DO 570 J=1,NUMBE
          JN=2*J
          JS=JN-1
          CALL INITL
          XJ=XM(J)
          YJ=YM(J)
          AJ=A(J)
          COSBJ=COSBET(J)
          SINBJ=SINBET(J)
          CALL COEFF(XI,YI,XJ,YJ,AJ,COSBJ,SINBJ,+1)
          GO TO (540,510,520,530),KSYM
    !
    510   XJ=2.*XSYM-XM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
          GO TO 540
    !
    520   YJ=2.*YSYM-YM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
          GO TO 540
    !
    530   XJ=2.*XSYM-XM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
          XJ=XM(J)
          YJ=2.*YSYM-YM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
          XJ=2.*XSYM-XM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,-SINBJ,+1)
    !
    540   CONTINUE
    !
          UX=UX+UXS*P(JS)+UXN*P(JN)
          UY=UY+UYS*P(JS)+UYN*P(JN)
          SIGXX=SIGXX+SXXS*P(JS)+SXXN*P(JN)
          SIGYY=SIGYY+SYYS*P(JS)+SYYN*P(JN)
          SIGXY=SIGXY+SXYS*P(JS)+SXYN*P(JN)
    !
    570   CONTINUE
    !
          US=UX*COSBI+UY*SINBI
          UN=-UX*SINBI+UY*COSBI
          SIGS=(SIGYY-SIGXX)*SINBI*COSBI+SIGXY*(COSBI*COSBI-SINBI*SINBI)
          SIGN=SIGXX*SINBI*SINBI-2.*SIGXY*SINBI*COSBI+SIGYY*COSBI*COSBI
          SIGT=SIGXX*COSBI*COSBI-2.*SIGXY*COSBI*SINBI+SIGYY*SINBI*SINBI
    !
          WRITE (6,17) I,UX,UY,US,UN,SIGXX,SIGYY,SIGXY,SIGS,SIGN,SIGT
    !
    600   CONTINUE
    !
    !   COMPUTE DISPLACEMENTS AND STRESSES AT SPECIFIED POINTS IN BOD
    !
          IF (NUMOS.LE.0) GO TO 900
          WRITE (6,18)
          NPOINT=0
          DO 890 N=1,NUMOS
          READ (5,19) XBEG,YBEG,XEND,YEND,NUMPB
          NUMP=NUMPB+1
          DELX=(XEND-XBEG)/NUMP
          DELY=(YEND-YBEG)/NUMP
          IF (NUMPB.GT.0) NUMP=NUMP+1
          IF (DELX**2+DELY**2.EQ.0.) NUMP=1
    !
          DO 890 NI=1,NUMP
          XP=XBEG+(NI-1)*DELX
          YP=YBEG+(NI-1)*DELY
    !
          UX=0.
          UY=0.
          SIGXX=PXX
          SIGYY=PYY
          SIGXY=PXY
    !
          DO 880 J=1,NUMBE
          JN=2*J
          JS=JN-1
          CALL INITL
          XJ=XM(J)
          YJ=YM(J)
          AJ=A(J)
    !
          IF (SQRT((XP-XJ)**2+(YP-YJ)**2).LT.2.*AJ) GO TO 890
    !
          COSBJ=COSBET(J)
          SINBJ=SINBET(J)
          CALL COEFF(XI,YI,XJ,YJ,AJ,COSBJ,SINBJ,+1)
          GO TO (840,810,820,830),KSYM
    !
    810   XJ=2.*XSYM-XM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
          GO TO 840
    !
    820   YJ=2.*YSYM-YM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
          GO TO 840
    !
    830   XJ=2.*XSYM-XM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
          XJ=XM(J)
          YJ=2.*YSYM-YM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
          XJ=2.*XSYM-XM(J)
          CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,-SINBJ,+1)
    !
    840   CONTINUE
    !
          UX=UX+UXS*P(JS)+UXN*P(JN)
          UY=UY+UYS*P(JS)+UYN*P(JN)
          SIGXX=SIGXX+SXXS*P(JS)+SXXN*P(JN)
          SIGYY=SIGYY+SYYS*P(JS)+SYYN*P(JN)
          SIGXY=SIGXY+SXYS*P(JS)+SXYN*P(JN)
    !
    880   CONTINUE
    !
          NPOINT=NPOINT+1
          WRITE (6,20) NPOINT,XP,YP,UX,UY,SIGXX,SIGYY,SIGXY
    !
    890   CONTINUE
    !
    900   CONTINUE
    !
    !   FORMAT STATEMENTS.
    !
    1     FORMAT (20A4)
    2     FORMAT (1H1,/,25X,20A4,/)
    3     FORMAT (3I4)
    4     FORMAT (F6.2,E11.4,2F12.4)
    5     FORMAT (3E11.4)
    6     FORMAT (/,109H NUMBE_R OF STRAIGHT-LINE SEGMENTS (EACH COUNTING AT LEAST ONE BOUNDARY ELEMENT) USED T_O DEFINE BOUNDARIES equals,I3,//,12 23H NUMBE_R OF STRAIGHT-LINE SEGMENTS USED T_O SPECIFY OTHER LOCATIONS (I E, NO_T ON A BOUNDARY) WHER_E RESULTS ARE T_O BE FOUND =,I3)
    7     FORMAT (/,32H NOSYMMETRY CONDITIONS IMPOSED)
    8     FORMAT (/,18H THE LINE X equals XS equals, F12.4,23H I_S A LINE OF SYMMETRY)
    9     FORMAT (/,18H THE LINE Y equals YS equals, F12.4,23H I_S A LINE OF SYMMETRY)
    10    FORMAT (/,19H THE LINES X equals XS equals,F12.4,13H AND Y equals YS equals, F12.4,23H ARE LINES OF SYMMETRY)
    11    FORMAT (/,18H POISSONS RATIO equals,F6.2,//,18H YOUNGS MODULUS equals,E11.14)
    12    FORMAT (/,31H XX-COMPONENT OF FIELD STRESS -,E11.4,//,31H YY-COMPONENT OF FIELD STRESS equals,E11.4,//,31H XY COMPONENTOF FIELD STRESS equals,E11.4)
    13    FORMAT (1H1,/,27H BOUNDARY ELEMENT DAT_A,//,96H ELEMENT KODE X (CENTER) Y (CENTER) LENGTH ANGLE US OR SIGMA-S UN OR SIGMA-N,/)
    14    FORMAT (I4,4F12.4,I4,2E11.4)
    15    FORMAT (2I9,3F12.4,F12.2,2E15.4)
    16    FORMAT (1H1,/,66H DISPLACEMENTS AND STRESS AT MIDPOINTS OF BOUNDARY ELEMENTS,//,40H ELEMENT UX UY US,60H UN SIGXX SIGYY SIGXY SIGMA-S SIGMA-N,10H SIGMA-T,/)
    17    FORMAT (I10,4F10.6,6F10.1)
    18    FORMAT (1H1,/,64H DISPLACEMENTS AND STRESSES AT SPECIFIED POINTS I_N THE BODY,//,93H POINT X CO-ORD Y CO-ORD UX UY SIGXX SIGYY SIGXY,/)
    19    FORMAT (4F12.4,I4)
    20    FORMAT (I9,2F12.4,2F12.6,3F12.1)
    !
          END
    
          SUBROUTINE INITL
    !
          COMMON/S2/SXXS,SXXN,SYYS,SYYN,SXYS,SXYN,UXS,UXN,UYS,UYN
    !
          SXXS=0.
          SXXN=0.
          SYYS=0.
          SYYN=0.
          SXYS=0.
          SXYN=0.
    !
          UXS=0.
          UXN=0.
          UYS=0.
          UYN=0.
    !
          RETURN
          END
    
          SUBROUTINE COEFF(X,Y,CX,CY,A,COSB,SINB,MSYM)
    !
          COMMON/S1/PI,PR,PR1,PR2,PR3,CON,COND
          COMMON/S2/SXXS,SXXN,SYYS,SYYN,SXYS,SXYN,UXS,UXN,UYS,UYN
    !
          COS2B=COSB*COSB-SINB*SINB
          SIN2B=2.*SINB*COSB
          XB=(X-CX)*COSB+(Y-CY)*SINB
          YB=-(X-CX)*SINB+(Y-CY)*COSB
    !
          R1S=(XB-A)*(XB-A)+YB*YB
          R2S=(XB+A)*(XB+A)+YB*YB
          FL1=0.5*ALOG(R1S)
          FL2=0.5*ALOG(R2S)
          FB2=CON*(FL1-FL2)
          IF (YB.NE.0.) GO TO 10
          FB3=0.
          IF (ABS(XB).LT.A) FB3=CON*PI
          GO TO 20
    10    FB3=-CON*(ATAN((XB+A)/YB)-ATAN((XB-A)/YB))
    20    FB1=YB*FB3+CON*(XB-A)*FL1-(XB+A)*FL2)
          FB4=CON*(YB/R1S-YB/R2S)
          FB5=CON*((XB-A)/R1S-(XB+A)/R2S)
    !
          UXPS=COND*(PR3*COSB*FB1+YB*(SINB*FB2+COSB*FB3))
          UXPN=COND*(-PR3*SINB*FB1-YB*(COSB*FB2-SINB*FB3))
          UYPS=COND*(PR3*SINB*FB1-YB*(COSB*FB2-SINB*FB3))
          UYPN=COND*(PR3*COSB*FB1-YB*(SINB*FB2+COSB*FB3))
    !
          SXXPS=FB2+PR2*(COS2B*FB2-SIN2B*FB3)+YB*(COS2B*FB4+SIN2B*FB5)
          SXXPN=FB3-PR1*(SIN2B*FB2+COS2B*FB3)+YB*(SIN2B*FB4-COS2B*FB5)
          SYYPS=FB2-PR2*(COS2B*FB2-SIN2B*FB3)-YB*(COS2B*FB4+SIN2B*FB5)
          SYYPN=FB3+PR1*(SIN2B*FB2+COS2B*FB3)-YB*(SIN2B*FB4-COS2B*FB5)
          SXYPS=PR2*(SIN2B*FB2+COS2B*FB3)+YB*(SIN2B*FB4-COS2B*FB5)
          SXYPN=PR1*(COS2B*FB2-SIN2B*FB3)-YB*(COS2B*FB4+SIN2B*FB5)
    !
          UXS=UXS+MSYM*UXPS
          UXN=UXN+UXPN
          UYS=UYS+MSYM*UYPS
          UYN=UYN+UYPN
    !
          SXXS=SXXS+MSYM*SXXPS
          SXXN=SYYN+SXXPN
          SYYS=SYYS+MSYM*SYYPS
          SYYN=SYYN+SYYPN
          SXYS=SXYS+MSYM*SXYPS
          SXYN=SXYN+SXYPN
    !
          RETURN
          END
          SUBROUTINE SOLVE(N)
    !
          COMMON/S3/A(100,100),B(100),X(100)
    !
          NB=N-1
          DO 20 J=1,NB
          L=J+1
          DO 20 JJ=L,N
          XM=A(JJ,J)/A(J,J)
          DO 10 I=J,N
    10    A(JJ,I)=A(JJ,I)-A(J,I)*XM
    20    B(JJ)=B(JJ)-B(J)*XM
    !
          X(N)=B(N)/A(N,N)
          DO 40 J=1,NB
          JJ=N-J
          L=JJ+1
          SUM=0.
          DO 30 I=L,N
    30    SUM=SUM+A(JJ,I)*X(I)
    40    X(JJ)=(B(JJ)-SUM)/(A(JJ,JJ))
    !
          RETURN
          END

更新错误列表:

     |296|  296 .130:|||Error: Unexpected element 'Q' in format string  |
     |297|  297 .50:|||Error: Unexpected end of format string in format string  |
     |298|  298 .73:|||Error: Positive width required in format specifier E  |
     |299|  299 .39:|||Error: Unexpected element 'Y' in format string  |
     |300|  300 .75:|||Error: Positive width required in format specifier E  |
     |301|  301 .38:|||Error: Unexpected element 'U' in format string  |
     |302|  302 .95:|||Error: Unexpected element 'Q' in format string  |
     |303|  303 .132:|||Error: Unexpected end of format string in format string  |
     |306|  306 .171:|||Error: Positive width required in format specifier E  |
     |308|  308 .132:|||Error: Unexpected end of format string in format string  |
     |353|  353 .6:|||Error: Unclassifiable statement  |
     |15|  15 .16:|||Error: FORMAT label 6  not defined|
     |17|  17 .16:|||Error: FORMAT label 7  not defined|
     |19|  19 .16:|||Error: FORMAT label 8  not defined|
     |21|  21 .16:|||Error: FORMAT label 9  not defined|
     |23|  23 .17:|||Error: FORMAT label 10  not defined|
     |26|  26 .17:|||Error: FORMAT label 11  not defined|
     |27|  27 .17:|||Error: FORMAT label 12  not defined|
     |58|  58 .17:|||Error: FORMAT label 13  not defined|
     |351|  351 .14:|||Error: Label 20 referenced  is never defined|
     |157|  157 .17:|||Error: FORMAT label 16  not defined|
     |221|  221 .17:|||Error: FORMAT label 18  not defined|
    ||=== Build finished: 24 errors, 0 warnings (0 minutes, 0 seconds) ===|

带编号行的代码:

1         PROGRAM TWOFS
2   
3         COMMON/S1/PI,PR,PR1,PR2,PR3,CON,COND
4         COMMON/S2/SXXS,SXXN,SYYS,SYYN,SXYS,SXYN,UXS,UXN,UYS,UYN
5         COMMON/S3/C(100,100),B(100),P(100)
6   !
7         DIMENSION XM(50),YM(50),A(50),COSBET(50),SINBET(50),KOD(50)
8         DIMENSION TITLE(20)
9   !
10        READ (5,1) (TITLE(I),I=1,20)
11        WRITE (6,2) (TITLE(I),I=1,20)
12        READ (5,3) NUMBS,NUMOS,KSYM
13        READ (5,4) PR,E,XSYM,YSYM
14        READ (5,5) PXX,PYY,PXY
15        WRITE (6,6) NUMBS,NUMOS
16        GO TO (80,85,90,95), KSYM
17  80    WRITE (6,7)
18        GO TO 100
19  85    WRITE (6,8) XSYM
20        GO TO 100
21  90    WRITE (6,9) YSYM
22        GO TO 100
23  95    WRITE (6,10) XSYM,YSYM
24  !
25  100   CONTINUE
26        WRITE (6,11) PR,E
27        WRITE (6,12) PXX,PYY,PXY
28  !
29        PI=4.*ATAN(1.)
30        CON=1./(4.*PI*(1.-PR))
31        COND=(1.+PR)/E
32        PR1=1.-2.*PR
33        PR2=2.*(1.-PR)
34        PR3=3.-4.*PR
35  !
36  !   DEFINE LOCATIONS,SIZES,ORIENTATIONS AND BOUNDARY CONDITIONS OF BOUNDARY ELEMENTS
37  !
38        NUMBE=0
39        DO 110 N=1,NUMBS
40        READ (5,14) NUM,XBEG,YBEG,XEND,YEND,KODE,BVS,BVN
41        XD=(XEND-XBEG)/NUM
42        YD=(YEND-YBEG)/NUM
43        SW=SQRT(XD*XD+YD*YD)
44  !
45        DO 110 NE=1,NUM
46        NUMBE=NUMBE+1
47        M=NUMBE
48        XM(M)=XBEG+0.5*(2.*NE-1.)*XD
49        YM(M)=YBEG+0.5*(2.*NE-1.)*YD
50        A(M)=0.5*SW
51        SINBET(M)=YD/SW
52        COSBET(M)=XD/SW
53        KOD(M)=KODE
54        MN=2*M
55        MS=MN-1
56        B(MS)=BVS
57  110   B(MN)=BVN
58        WRITE (6,13)
59        DO 115 M=1,NUMBE
60        SIZE=2.*A(M)
61        ANGLE=180.*ATAN2(SINBET(M),COSBET(M))/PI
62        WRITE (6,15) M,KOD(M),XM(M),YM(M),SIZE,ANGLE,B(2*M-1),B(2*M)
63  115   CONTINUE
64  !
65  !   ADJUST STRESS BOUNDARY VALUES TO ACCOUNT FOR INITIAL STRESSES.
66  !
67        DO 150 N=1,NUMBE
68        NN=2*N
69        NS=NN-1
70        COSB=COSBET(N)
71        SINB=SINBET(N)
72        SIGS=(PYY-PXX)*SINB*COSB+PXY*(COSB*COSB-SINB*SINB)
73        SIGN=PXX*SINB*SINB-2.*PXY*SINB*COSB+PYY*COSB*COSB
74        GO TO (120,150,130,140),KOD(N)
75  120   B(NS)=B(NS)-SIGS
76        B(NN)=B(NN)-SIGN
77        GO TO 150
78  130   B(NN)=B(NN)-SIGN
79        GO TO 150
80  140   B(NS)=B(NS)-SIGS
81  150   CONTINUE
82  !
83  !   COMPUTE INFLUENCE COEFFICIENTS AND SET UP SYSTEM OF ALGEBRAIC EQUATIONS.
84  !
85        DO 300 I=1,NUMBE
86        IN=2*I
87        IS=IN-1
88        XI=XM(I)
89        YI=YM(I)
90        COSBI=COSBET(I)
91        SINBI=SINBET(I)
92        KODE=KOD(I)
93  !
94        DO 300 J=1,NUMBE
95        JN=2*J
96        JS=JN-1
97        CALL INITL
98        XJ=XM(J)
99        YJ=YM(J)
100       COSBJ=COSBET(J)
101       SINBJ=SINBET(J)
102       AJ=A(J)
103       CALL COEFF(XI,YI,XJ,YJ,AJ,COSBJ,SINBJ,+1)
104       GO TO (240,210,220,230),KSYM
105 !
106 210   XJ=2.*XSYM-XM(J)
107       CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
108       GO TO 240
109 !
110 220   YJ=2.*YSYM-YM(J)
111       CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
112       GO TO 240
113 !
114 230   XJ=2.*XSYM-XM(J)
115       CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
116       XJ=XM(J)
117       YJ=2.*YSYM-YM(J)
118       CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
119       XJ=2.*XSYM-XM(J)
120       CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,-SINBJ,+1)
121 !
122 240   CONTINUE
123       GO TO (250,260,270,280),KODE
124 !
125 250   C(IS,JS)=(SYYS-SXXS)*SINBI*COSBI+SXYS*(COSBI*COSBI-SINBI*SINBI)
126       C(IS,JN)=(SYYN-SXXN)*SINBI*COSBI+SXYN*(COSBI*COSBI-SINBI*SINBI)
127       C(IN,JS)=SXXS*SINBI*SINBI-2.*SXYS*SINBI*COSBI+SYYS*COSBI*COSBI
128       C(IN,JN)=SXXN*SINBI*SINBI-2.*SXYN*SINBI*COSBI+SYYN*COSBI*COSBI
129       GO TO 300
130 !
131 260   C(IS,JS)=UXS*COSBI+UYS*SINBI
132       C(IS,JN)=UXN*COSBI+UYN*SINBI
133       C(IN,JS)=-UXS*SINBI+UYS*COSBI
134       C(IN,JN)=-UXN*SINBI+UYN*COSBI
135       GO TO 300
136 !
137 270   C(IS,JS)=UXS*COSBI+UYS*SINBI
138       C(IS,JN)=UXN*COSBI+UYN*SINBI
139       C(IN,JS)=SXXS*SINBI*SINBI-2.*SXYS*SINBI*COSBI+SYYS*COSBI*COSBI
140       C(IN,JN)=SXXN*SINBI*SINBI-2.*SXYN*SINBI*COSBI+SYYN*COSBI*COSBI
141       GO TO 300
142 !
143 280   C(IS,JS)=(SYYS-SXXS)*SINBI*COSBI+SXYS*(COSBI*COSBI-SINBI*SINBI)
144       C(IS,JN)=(SYYN-SXXN)*SINBI*COSBI+SXYN*(COSBI*COSBI-SINBI*SINBI)
145       C(IN,JS)=-UXS*SINBI+UYS*COSBI
146       C(IN,JN)=-UXN*SINBI+UYN*COSBI
147 !
148 300   CONTINUE
149 !
150 !   SOLVE SYSTEM OF ALGEBRAIC EQUATIONS.
151 !
152       N=2*NUMBE
153       CALL SOLVE(N)
154 !
155 !   COMPUTE BOUNDARY DISPLACEMENTS AND STRESSES.
156 !
157       WRITE (6,16)
158       DO 600 I=1,NUMBE
159       XI=XM(I)
160       YI=YM(I)
161       COSBI=COSBET(I)
162       SINBI=SINBET(I)
163 !
164       UX=0.
165       UY=0.
166       SIGXX=PXX
167       SIGYY=PYY
168       SIGXY=PXY
169 !
170       DO 570 J=1,NUMBE
171       JN=2*J
172       JS=JN-1
173       CALL INITL
174       XJ=XM(J)
175       YJ=YM(J)
176       AJ=A(J)
177       COSBJ=COSBET(J)
178       SINBJ=SINBET(J)
179       CALL COEFF(XI,YI,XJ,YJ,AJ,COSBJ,SINBJ,+1)
180       GO TO (540,510,520,530),KSYM
181 !
182 510   XJ=2.*XSYM-XM(J)
183       CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
184       GO TO 540
185 !
186 520   YJ=2.*YSYM-YM(J)
187       CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
188       GO TO 540
189 !
190 530   XJ=2.*XSYM-XM(J)
191       CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
192       XJ=XM(J)
193       YJ=2.*YSYM-YM(J)
194       CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
195       XJ=2.*XSYM-XM(J)
196       CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,-SINBJ,+1)
197 !
198 540   CONTINUE
199 !
200       UX=UX+UXS*P(JS)+UXN*P(JN)
201       UY=UY+UYS*P(JS)+UYN*P(JN)
202       SIGXX=SIGXX+SXXS*P(JS)+SXXN*P(JN)
203       SIGYY=SIGYY+SYYS*P(JS)+SYYN*P(JN)
204       SIGXY=SIGXY+SXYS*P(JS)+SXYN*P(JN)
205 !
206 570   CONTINUE
207 !
208       US=UX*COSBI+UY*SINBI
209       UN=-UX*SINBI+UY*COSBI
210       SIGS=(SIGYY-SIGXX)*SINBI*COSBI+SIGXY*(COSBI*COSBI-SINBI*SINBI)
211       SIGN=SIGXX*SINBI*SINBI-2.*SIGXY*SINBI*COSBI+SIGYY*COSBI*COSBI
212       SIGT=SIGXX*COSBI*COSBI-2.*SIGXY*COSBI*SINBI+SIGYY*SINBI*SINBI
213 !
214       WRITE (6,17) I,UX,UY,US,UN,SIGXX,SIGYY,SIGXY,SIGS,SIGN,SIGT
215 !
216 600   CONTINUE
217 !
218 !   COMPUTE DISPLACEMENTS AND STRESSES AT SPECIFIED POINTS IN BOD
219 !
220       IF (NUMOS.LE.0) GO TO 900
221       WRITE (6,18)
222       NPOINT=0
223       DO 890 N=1,NUMOS
224       READ (5,19) XBEG,YBEG,XEND,YEND,NUMPB
225       NUMP=NUMPB+1
226       DELX=(XEND-XBEG)/NUMP
227       DELY=(YEND-YBEG)/NUMP
228       IF (NUMPB.GT.0) NUMP=NUMP+1
229       IF (DELX**2+DELY**2.EQ.0.) NUMP=1
230 !
231       DO 890 NI=1,NUMP
232       XP=XBEG+(NI-1)*DELX
233       YP=YBEG+(NI-1)*DELY
234 !
235       UX=0.
236       UY=0.
237       SIGXX=PXX
238       SIGYY=PYY
239       SIGXY=PXY
240 !
241       DO 880 J=1,NUMBE
242       JN=2*J
243       JS=JN-1
244       CALL INITL
245       XJ=XM(J)
246       YJ=YM(J)
247       AJ=A(J)
248 !
249       IF (SQRT((XP-XJ)**2+(YP-YJ)**2).LT.2.*AJ) GO TO 890
250 !
251       COSBJ=COSBET(J)
252       SINBJ=SINBET(J)
253       CALL COEFF(XI,YI,XJ,YJ,AJ,COSBJ,SINBJ,+1)
254       GO TO (840,810,820,830),KSYM
255 !
256 810   XJ=2.*XSYM-XM(J)
257       CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
258       GO TO 840
259 !
260 820   YJ=2.*YSYM-YM(J)
261       CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
262       GO TO 840
263 !
264 830   XJ=2.*XSYM-XM(J)
265       CALL KOEFF(XI,YI,XJ,YJ,AJ,COSBJ,-SINBJ,-1)
266       XJ=XM(J)
267       YJ=2.*YSYM-YM(J)
268       CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,SINBJ,-1)
269       XJ=2.*XSYM-XM(J)
270       CALL KOEFF(XI,YI,XJ,YJ,AJ,-COSBJ,-SINBJ,+1)
271 !
272 840   CONTINUE
273 !
274       UX=UX+UXS*P(JS)+UXN*P(JN)
275       UY=UY+UYS*P(JS)+UYN*P(JN)
276       SIGXX=SIGXX+SXXS*P(JS)+SXXN*P(JN)
277       SIGYY=SIGYY+SYYS*P(JS)+SYYN*P(JN)
278       SIGXY=SIGXY+SXYS*P(JS)+SXYN*P(JN)
279 !
280 880   CONTINUE
281 !
282       NPOINT=NPOINT+1
283       WRITE (6,20) NPOINT,XP,YP,UX,UY,SIGXX,SIGYY,SIGXY
284 !
285 890   CONTINUE
286 !
287 900   CONTINUE
288 !
289 !   FORMAT STATEMENTS.
290 !
291 1     FORMAT (20A4)
292 2     FORMAT (1H1,/,25X,20A4,/)
293 3     FORMAT (3I4)
294 4     FORMAT (F6.2,E11.4,2F12.4)
295 5     FORMAT (3E11.4)
296 6     FORMAT (/,109H NUMBE_R OF STRAIGHT-LINE SEGMENTS (EACH COUNTING AT LEAST ONE BOUNDARY ELEMENT) USED T_O DEFINE BOUNDARIES equals,I3,//,12 23H NUMBE_R OF STRAIGHT-LINE SEGMENTS USED T_O SPECIFY OTHER LOCATIONS (I E, NO_T ON A BOUNDARY) WHER_E RESULTS ARE T_O BE FOUND =,I3)
297 7     FORMAT (/,32H NOSYMMETRY CONDITIONS IMPOSED)
298 8     FORMAT (/,18H THE LINE X equals XS equals, F12.4,23H I_S A LINE OF SYMMETRY)
299 9     FORMAT (/,18H THE LINE Y equals YS equals, F12.4,23H I_S A LINE OF SYMMETRY)
300 10    FORMAT (/,19H THE LINES X equals XS equals,F12.4,13H AND Y equals YS equals, F12.4,23H ARE LINES OF SYMMETRY)
301 11    FORMAT (/,18H POISSONS RATIO equals,F6.2,//,18H YOUNGS MODULUS equals,E11.14)
302 12    FORMAT (/,31H XX-COMPONENT OF FIELD STRESS -,E11.4,//,31H YY-COMPONENT OF FIELD STRESS equals,E11.4,//,31H XY COMPONENTOF FIELD STRESS equals,E11.4)
303 13    FORMAT (1H1,/,27H BOUNDARY ELEMENT DAT_A,//,96H ELEMENT KODE X (CENTER) Y (CENTER) LENGTH ANGLE US OR SIGMA-S UN OR SIGMA-N,/)
304 14    FORMAT (I4,4F12.4,I4,2E11.4)
305 15    FORMAT (2I9,3F12.4,F12.2,2E15.4)
306 16    FORMAT (1H1,/,66H DISPLACEMENTS AND STRESS AT MIDPOINTS OF BOUNDARY ELEMENTS,//,40H ELEMENT UX UY US,60H UN SIGXX SIGYY SIGXY SIGMA-S SIGMA-N,10H SIGMA-T,/)
307 17    FORMAT (I10,4F10.6,6F10.1)
308 18    FORMAT (1H1,/,64H DISPLACEMENTS AND STRESSES AT SPECIFIED POINTS I_N THE BODY,//,93H POINT X CO-ORD Y CO-ORD UX UY SIGXX SIGYY SIGXY,/)
309 19    FORMAT (4F12.4,I4)
310 20    FORMAT (I9,2F12.4,2F12.6,3F12.1)
311 !
312       END
313 
314       SUBROUTINE INITL
315 !
316       COMMON/S2/SXXS,SXXN,SYYS,SYYN,SXYS,SXYN,UXS,UXN,UYS,UYN
317 !
318       SXXS=0.
319       SXXN=0.
320       SYYS=0.
321       SYYN=0.
322       SXYS=0.
323       SXYN=0.
324 !
325       UXS=0.
326       UXN=0.
327       UYS=0.
328       UYN=0.
329 !
330       RETURN
331       END
332 
333       SUBROUTINE COEFF(X,Y,CX,CY,A,COSB,SINB,MSYM)
334 !
335       COMMON/S1/PI,PR,PR1,PR2,PR3,CON,COND
336       COMMON/S2/SXXS,SXXN,SYYS,SYYN,SXYS,SXYN,UXS,UXN,UYS,UYN
337 !
338       COS2B=COSB*COSB-SINB*SINB
339       SIN2B=2.*SINB*COSB
340       XB=(X-CX)*COSB+(Y-CY)*SINB
341       YB=-(X-CX)*SINB+(Y-CY)*COSB
342 !
343       R1S=(XB-A)*(XB-A)+YB*YB
344       R2S=(XB+A)*(XB+A)+YB*YB
345       FL1=0.5*ALOG(R1S)
346       FL2=0.5*ALOG(R2S)
347       FB2=CON*(FL1-FL2)
348       IF (YB.NE.0.) GO TO 10
349       FB3=0.
350       IF (ABS(XB).LT.A) FB3=CON*PI
351       GO TO 20
352 10    FB3=-CON*(ATAN((XB+A)/YB)-ATAN((XB-A)/YB))
353 20    FB1=YB*FB3+CON*(XB-A)*FL1-(XB+A)*FL2)
354       FB4=CON*(YB/R1S-YB/R2S)
355       FB5=CON*((XB-A)/R1S-(XB+A)/R2S)
356 !
357       UXPS=COND*(PR3*COSB*FB1+YB*(SINB*FB2+COSB*FB3))
358       UXPN=COND*(-PR3*SINB*FB1-YB*(COSB*FB2-SINB*FB3))
359       UYPS=COND*(PR3*SINB*FB1-YB*(COSB*FB2-SINB*FB3))
360       UYPN=COND*(PR3*COSB*FB1-YB*(SINB*FB2+COSB*FB3))
361 !
362       SXXPS=FB2+PR2*(COS2B*FB2-SIN2B*FB3)+YB*(COS2B*FB4+SIN2B*FB5)
363       SXXPN=FB3-PR1*(SIN2B*FB2+COS2B*FB3)+YB*(SIN2B*FB4-COS2B*FB5)
364       SYYPS=FB2-PR2*(COS2B*FB2-SIN2B*FB3)-YB*(COS2B*FB4+SIN2B*FB5)
365       SYYPN=FB3+PR1*(SIN2B*FB2+COS2B*FB3)-YB*(SIN2B*FB4-COS2B*FB5)
366       SXYPS=PR2*(SIN2B*FB2+COS2B*FB3)+YB*(SIN2B*FB4-COS2B*FB5)
367       SXYPN=PR1*(COS2B*FB2-SIN2B*FB3)-YB*(COS2B*FB4+SIN2B*FB5)
368 !
369       UXS=UXS+MSYM*UXPS
370       UXN=UXN+UXPN
371       UYS=UYS+MSYM*UYPS
372       UYN=UYN+UYPN
373 !
374       SXXS=SXXS+MSYM*SXXPS
375       SXXN=SYYN+SXXPN
376       SYYS=SYYS+MSYM*SYYPS
377       SYYN=SYYN+SYYPN
378       SXYS=SXYS+MSYM*SXYPS
379       SXYN=SXYN+SXYPN
380 !
381       RETURN
382       END
383       SUBROUTINE SOLVE(N)
384 !
385       COMMON/S3/A(100,100),B(100),X(100)
386 !
387       NB=N-1
388       DO 20 J=1,NB
389       L=J+1
390       DO 20 JJ=L,N
391       XM=A(JJ,J)/A(J,J)
392       DO 10 I=J,N
393 10    A(JJ,I)=A(JJ,I)-A(J,I)*XM
394 20    B(JJ)=B(JJ)-B(J)*XM
395 !
396       X(N)=B(N)/A(N,N)
397       DO 40 J=1,NB
398       JJ=N-J
399       L=JJ+1
400       SUM=0.
401       DO 30 I=L,N
402 30    SUM=SUM+A(JJ,I)*X(I)
403 40    X(JJ)=(B(JJ)-SUM)/(A(JJ,JJ))
404 !
405       RETURN
406       END
compiler-errors fortran
1个回答
0
投票

拿走

 FORMAT (/,109H NUMBE_R OF STRAIGHT-LINE SEGMENTS (EACH COUNTING AT LEAST ONE BOUNDARY ELEMENT) USED T_O DEFINE BOUNDARIES equals,I3,//,12 23H NUMBE_R OF STRAIGHT-LINE SEGMENTS USED T_O SPECIFY OTHER LOCATIONS (I E, NO_T ON A BOUNDARY) WHER_E RESULTS ARE T_O BE FOUND =,I3)

此格式字符串使用了 Fortran 的一个古老且现已删除的功能,称为 Hollerith 编辑。基本上,在

109H
之后正好有 109 个字符要打印。

由于一些不太好的原因(显然是由于代码编辑器的语法突出显示),您添加了多个

_
字符。这意味着文本现在比这 109 个字符长,因此字符 109 之后的字符将被解释为 Fortran 格式字符串的另一部分。那是行不通的。

请勿使用 Hollerith 编辑将字符添加到零件中,除非相应地调整

H
描述符之前的数字。 FORTRAN 77 和更新版本的标准带来了 Hollerith 编辑的更好替代方案。

© www.soinside.com 2019 - 2024. All rights reserved.