Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help about Fortran

  1. Sep 13, 2015 #1
    [mentor edit added code tags to improve listing]

    Hey everyone!! im new in this forum.
    This thread
    I need help with my thesis. I'm doing a study of two-dimensional axisymmetric flow in a Kaplan turbine. So I am using a program called Force2.0 for programming in Fortran 77 but have several compilation errors , please I need help in this area if they can

    this is the programm
    Code (Fortran):

    c AA(1,N)=AZ(N) AA(2,N)=AR(N)
    c AB(1,N)=BZ(N) AB(2,N)=BR(N)
    c AC(1,N)=CZ(N) AC(2,N)=CR(N)
    c BB(N) = B(N) BC(N) = C(N) BD(N) = D(N)
    c NELE = NR OF ELEMENTS
    c NNODE = NR OF NODES
    c NBC = NR OF DIRICHLET ROUNDARY CONDITIONS (WITH PSI = 0 OR ?)
    c XY = X COORD FOR GLOBAL NODE
    c YY = Y COORD FOR GLOBAL NODE
    c X = X COORD FOR LOCAL NODE
    c Y = Y COORD FOR LOCAL NODE
    c IE = TABLE OF GLOBAL NODE NRS BY ELEMENT
    c SK = GLOBAL MATRIX
    c R = INPUT VECTOR
    c AK = ELEMENT COERFICIANT MATRIX


    c **WARNING - ALL NODES ALONG THE VERTICAL LINE AROVE THE CREST OF
    c THE SPHERE SHOULD BE RIMEZRED CONSECUTIVELY ERROR FOR TO BOTTON
    c IN ORDEN TO BE COMPATABLE WITH VELOCITY CALCULATIONS USED IN THIS
    c PROGRAM

    PARAMETER NELE=95, NNODE=117, NBC=33
    PARAMETER NVN=91, NRN=13

    DIMENSION AA(2,4),AB(2,4),AC(2,4),BB(4),BC(4),BD(4),
    # DTJ(3),VYR(4),W(6),ST(6),PS(8),AK(4,4),PSI(NNODE),
    # XF(4,4),XG(4,4),X(4),Y(4),FKK(6,4,4),GK(8,4,4)
    # ,IE(NELE,4),XX(NNODE),YY(NNODE),SK(NNODE,NNODE),R(NNODE),
    # MODE(NBC),NDDE(NBC),NODE(NBC),VAL(NBC),JC(NNODE)
    c
    c READ NODE NRS AND COORDINATES
    WRITE (6,203)
    11 READ (5,102) N,XX(N),YY(N)
    WRITE (6,204) N,XX(N),YY(N)
    IF (N.LT.NNODE) GO TO 11
    c
    c READ ELEMENT AND GLOBAL NODE NRS
    WRITE (6,400)
    12 READ (5,103) Y,(IE(M,I),I=1,4)
    WRITE (6,206) Y,(IE(M,I),I=1,4)
    IF (M.LT.NELE) GO TO 12
    c
    c READ DIRICHLET ROUNDARY CONDITION INFORMATION
    WRITE (6,107)

    DO 13 I=1,NPC
    READ (5,105) MODE(I),NODE(I),VAL(I)
    WRITE (6,108) MODE(I), NODE(I), VAL(I)
    13 CONTINUE
    c
    c WEIGTH AND ABSCCISA FOR GAUSSIAN CUADRATURE
    c
    W(1)=0.1713244923
    W(2)=0.3607615730
    W(3)=0.4679139345
    W(4)=W(3)
    W(5)=W(2)
    W(6)=W(1)
    ST(1)=-0.9324895142
    ST(2)=-0.6612093864
    ST(3)=-0.2386171860
    ST(4)=0.2386171860
    ST(5)=0.6612093864
    ST(6)=0.9324895142
    c
    BB(1) =-1.0
    BB(2) = 1.0
    BB(3) = 1.0
    BB(4) =-1.0
    BC(1) =-1.0
    BC(2) =-1.0
    BC(3) = 1.0
    BC(4) = 1.0
    BD(1) = 1.0
    BD(2) =-1.0
    BD(3) = 1.0
    BD(4) =-1.0
    c
    c CLEAR GLOBAL MATRIX
    DO 38 I = 1,NNODE
    DO 38 J = 1,NNODE
    38 SK(I,J)=0,0
    c
    c CALCULATE COEFFICIENT MATRIX FOR EACH ELEMENT
    DO 5 X=1,NELE
    c FIND LOCAL NODE COORDINATES
    DO 6 N=1,4
    NN=IR(M,N)
    X(N)=XY(NN)
    Y(N)=YY(NN)
    6 CONTINUE
    c
    c CALCULATE CONSTANTS IN DERIVATIVE OF INTERPOLATION FUNCTION
    AA(1,1) = X(4)-X(2)
    AA(1,2) = X(1)-X(3)
    AA(1,3) = X(2)-X(4)
    AA(1,4) = X(3)-X(1)
    AA(2,1) = Y(2)-Y(4)
    AA(2,2) = Y(3)-Y(1)
    AA(2,3) = Y(4)-Y(2)
    AA(2,4) = Y(1)-Y(3)
    AB(1,1) = X(3)-X(4)
    AB(1,2) = X(4)-X(3)
    AB(1,3) = X(2)-X(2)
    AB(1,4) = X(1)-X(1)
    AB(2,1) = X(4)-X(3)
    AB(2,2) = X(3)-X(2)
    AB(2,3) = X(1)-X(1)
    AB(2,4) = X(2)-X(4)
    c
    c COMPUTE JACOBIAN
    DTJ(1)=(X(2)-X(4))*(Y(3)-Y(1))-(X(3)-X(1))*(Y(2)-Y(4))
    DTJ(2)=(X(4)-X(3))*(Y(2)-Y(1))-(X(2)-X(1))*(Y(4)-Y(3))
    DTJ(3)=(X(1)-X(4))*(Y(3)-Y(2))-(X(3)-X(2))*(Y(1)-Y(4))
    c
    c INTERPOLATION FIELD
    XXR(1)=Y(1)+Y(2)+Y(3)+Y(4)
    XXR(2)=-Y(1)+Y(2)+Y(3)-Y(4)
    XXR(3)=-Y(1)-Y(2)+Y(3)+Y(4)
    XXR(4)=Y(1)-Y(2)+Y(3)-Y(4)
    c
    c COMPUTE ELEMENT COEFFICIENT MATRIX
    DO 71 I=1,4
    DO 72 J=1,4
    XF(I,J)=0,0
    YG(I,J)=0,0
    FK(1,I,J)=AA(1,J)*AA(1,I)+AA(2,J)*AA(2,I)
    FK(2,I,J)=AB(1,J)*AA(1,I)+AB(2,J)*AA(2,I)+AA(1,J)*AB(1,I)+AA(2,J)
    # *AB(2,I)
    FK(3,I,J)=AC(1,J)*AA(1,I)+AC(2,J)*AA(2,I)+AA(1,J)*AC(1,I)+AA(2,J)
    # *AC(2,I)
    FK(4,I,J)=AC(1,J)*AB(1,I)+AC(2,J)*AB(2,I)+AB(1,J)*AC(1,I)+AB(2,J)
    # *AC(2,I)
    FK(5,I,J)=AB(1,I)*AB(1,J)+AB(2,I)*AB(2,J)
    FK(6,I,J)=AC(1,I)*AC(1,J)+AC(2,I)*AC(2,J)
    GK(1,I,J)=AA(1,J)
    GK(2,I,J)=AA(1,J)*BB(I)+AB(1,J)
    GK(3,I,J)=AA(1,J)*BC(I)+AC(1,J)
    GK(4,I,J)=BC(I)*AB(1,J)+BB(I)*AC(1,J)+ED(I)*AA(1,J)
    GK(5,I,J)=BB(I)*AB(1,J)
    GK(6,I,J)=BC(I)*AC(1,J)
    GK(7,I,J)=BD(I)*AB(1,J)
    GK(8,I,J)=BD(I)*AC(1,J)
    c
    c GAUSSIAN CUADRATURE INTEGRATION
    DO 35 K = 1,3
    DO 35 L = 1,6
    c
    c ISOPARAMETRIC VARIABLES
    PS(1) = 1.6
    PS(2) = ST(K)
    PS(3) = ST(L)
    PS(4) = ST(K)*ST(L)
    PS(5) = ST(K)*ST(K)
    PS(6) = ST(L)*ST(L)
    PS(7) = ST(K)*ST(K)*ST(L)
    PS(8) = ST(K)*ST(L)*ST(L)
    DJA = 0.0
    DO 43 II = 1,3
    43 DJA = DJA + DTJ(II)*PS(II)/8.C
    XR = 0,0
    DO 42 II = 1,4
    42 AR = XR + XXR(II)*PS(II)/4.0
    ACOF=W(K)*W(L)*XR/(DJA*64)
    DO 47 KK = 1,6
    XF(I,J) + FK(KK,I,J)*PS(KK)*ACOF
    47 CONTINUE
    APGF=W(K)*W(L)/16
    DO 48 KK = 1,8
    AG(I,J) = AH(I,J) + GK(KN,I,J)*PS(KK)*APGF
    48 CONTINUE
    35 cONTINUE
    AK(I,J) = XG(I,J)+XG(I,J)
    72 CONTINUE
    71 CONTINUE
    c
    c ASSEMBLE GLOBAL COEFFICIENT MATRIX
    c
    DO 65 JJ = 1,4
    J = IB (N,JJ)
    DO 65 KK = 1,4
    K = IS (M,KK)
    SK(J,K) = SK(J,K) + AK(JJ,KK)
    65 CONTINUE
    5 CONTINUE
    DO 81 I = 1,NNODE
    81 R(I) = 0.0
    c
    c INTRODUCE ROUNDARY CONDITIONS
    DO 82 I=1,NFC
    NX=NODE(I)
    IF (NODE(I).NE.O) GO TO 84
    DO 85 J = 1,NNODE
    SK(NX,J)=0.0
    SK(J,NX)=0.0
    85 CONTINUE
    SK(NX,NX)=1,0
    GO TO 82
    c
    c COMPUTE INPUT VECTOR
    84 CONTINUE
    DO 86 K = 1,NNODE
    86 R(K)=R(K)-SK(K,NX)*VAL(I)
    DO 87 K = 1,NNODE
    SK(K,NX)=0,0
    SK(NX,K)=0,0
    87 CONTINUE
    SK(NX,NX)=1,0
    R(K)=VAL(I)
    82 CONTINUE
    c
    c INVERT GLOBAL MATRIX AND MULTIPLY BY VECTOR
    CALL IVMTX(SK,JC,NNODE,NNODE)
    DO 97 I = 1,NNODE
    PSI(I) = PSI(I) + SK(I,J)*R(J)
    97 CONTINUE
    c
    c WRITE NODAL STREAMFUNCTION DATA
    WRITE (6,998)
    WRITE(6,999) (I,PSI(I),I=1,NNODE)
    c
    c VELOCITY PROFILE ON CREST OF SPHERE
    NNN = NNODE - NVN + 1
    MMM = NNODE - 1
    WRITE (6,590)
    DO 555 I = NNN,MMM
    J = I + 1
    RD= YY(I)**2 -YY(J)**2
    SID= (PSI(I) -PSI(J))*2
    VEL= SID/RD
    RM = (YY(I) + YY(J))/2.0
    WRITE(6,591) RM,VEL
    555 CONTINUE
    808 STOP
    102 FORMAT (IS,2F10.0)
    103 FORMAT (5I5)
    105 FORMAT (2I5,F10.0)
    106 FORMAT (2I5)
    107 FORMAT (ï1 DIRICHLET BOUNDARY CONDITIONSï,//6X,MODE,5X,ïNODEï,
    # 5X,ïVALUEï/)
    108 FORMAT (ïï,2I9,F10.4)
    110 FORMAT (ïï,2I9)
    203 FORMAT (1H1,20H NODAL POINT DATA // 1 5X,12H NODAL POINT,
    # 15X,1HX,20X,1HY )
    204 FORMAT (I12,6X,F16.4,4X,F16.4)
    206 FORMAT (5I10)
    400 FORMAT (1H1,ïNODAL ASSEMBLY DATAï// 4X,ïELEMENTï,5X,ï1ï,9X,ï2ï,
    # 9X,ï3ï,9X,ï4ï//)
    590 FORMAT (1H1,ïVELOCITY PROFILE ON CREST OF SPHEREï/// 6X,
    # ïYï,16X,ïVELï//)
    591 FORMAT (F10.5,F20.8/ )
    998 FORMAT (1H1,ïNODAL STREAMFUNCCTION DATAï//)
    999 FORMAT (I5, F15.8)
    END
     
     
    Last edited by a moderator: Sep 13, 2015
  2. jcsd
  3. Sep 13, 2015 #2

    Mark44

    Staff: Mentor

    What are the compiler errors you are getting, and where do they occur (line number)? Posting a mass of code and saying it doesn't work isn't very helpful, as it doesn't give us much to go on.
     
  4. Sep 13, 2015 #3
    ok Force 2.0 is the compiler
    this is the errors:

    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:34.6:

    PARAMETER NELE=95, NNODE=117, NBC=33
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:35.6:

    PARAMETER NVN=91, NRN=13
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:94.10:

    38 SK(I,J)=0,0
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:97.13:

    DO 5 X=1,NELE
    1
    Error: Loop variable at (1) cannot be a sub-component
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:129.8:

    XXR(1)=Y(1)+Y(2)+Y(3)+Y(4)
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:130.8:

    XXR(2)=-Y(1)+Y(2)+Y(3)-Y(4)
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:131.8:

    XXR(3)=-Y(1)-Y(2)+Y(3)+Y(4)
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:132.8:

    XXR(4)=Y(1)-Y(2)+Y(3)-Y(4)
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:135.17:

    DO 71 I=1,4
    1
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:92.72:

    DO 38 I = 1,NNODE
    2
    Error: Variable 'i' at (1) cannot be redefined inside loop beginning at (2)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:136.17:

    DO 72 J=1,4
    1
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:93.72:

    DO 38 J = 1,NNODE
    2
    Error: Variable 'j' at (1) cannot be redefined inside loop beginning at (2)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:137.6:

    XF(I,J)=0,0
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:138.6:

    YG(I,J)=0,0
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:139.6:

    FK(1,I,J)=AA(1,J)*AA(1,I)+AA(2,J)*AA(2,I)
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:140.6:

    FK(2,I,J)=AB(1,J)*AA(1,I)+AB(2,J)*AA(2,I)+AA(1,J)*AB(1,I)+AA(2,J)
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:142.6:

    FK(3,I,J)=AC(1,J)*AA(1,I)+AC(2,J)*AA(2,I)+AA(1,J)*AC(1,I)+AA(2,J)
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:144.6:

    FK(4,I,J)=AC(1,J)*AB(1,I)+AC(2,J)*AB(2,I)+AB(1,J)*AC(1,I)+AB(2,J)
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:146.6:

    FK(5,I,J)=AB(1,I)*AB(1,J)+AB(2,I)*AB(2,J)
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:147.6:

    FK(6,I,J)=AC(1,I)*AC(1,J)+AC(2,I)*AC(2,J)
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:172.6:

    43 DJA = DJA + DTJ(II)*PS(II)/8.C
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:173.6:

    XR = 0,0
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:174.20:

    DO 42 II = 1,4
    1
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:171.72:

    DO 43 II = 1,3
    2
    Error: Variable 'ii' at (1) cannot be redefined inside loop beginning at (2)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:178.6:

    XF(I,J) + FK(KK,I,J)*PS(KK)*ACOF
    1
    Error: Unclassifiable statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:182.72:

    AG(I,J) = AH(I,J) + GK(KN,I,J)*PS(KK)*APGF
    1
    Error: Unexpected STATEMENT FUNCTION statement at (1)
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:184.72:

    35 cONTINUE
    1
    Error: End of nonblock DO statement at (1) is interwoven with another DO loop
    C:\Users\ogos\Desktop\Nueva carpeta\programa turbina.f:186.72:

    72 CONTINUE
    1
    Error: End of nonblock DO statement at (1) is interwoven with another DO loop
    Fatal Error: Error count reached limit of 25.
    gfortran.exe: Internal error: Aborted (program f951)
    Please submit a full bug report.
    See <http://gcc.gnu.org/bugs.html> [Broken] for instructions.
     
    Last edited by a moderator: May 7, 2017
  5. Sep 13, 2015 #4

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    You should also use Code tags when you import source code. It preserves the original format of the source code.

    Fortran 77 still expects certain formatting requirements for program statements. The first character of an executable statement should be located in column 7. Continuation characters are found in column 6, and statement labels are legal in columns 1-5. The 'C' for a comment statement must be located in column 1 ...

    For instance, the PARAMETER statement should begin in column 7.
     
  6. Sep 13, 2015 #5

    Mark44

    Staff: Mentor

    It's usually a good idea to look at the first error in the list of compiler errors, since this one can sometimes cause a cascade effect. The first error in your list is from not having a PROGRAM statement -- you have this commented out.

    It should be
    Code (Fortran):
    PROGRAM SomeName
    I wrote "SomeName". You should give it a name that you choose.
     
  7. Sep 13, 2015 #6

    Mark44

    Staff: Mentor

    One problem I see is a common one amongst beginning programmers, especially those who are new to Fortran -- terrible variable names!
    These names are awful! AA, AB, AC, BB, BC, BD, DTJ, and on and on. These names have been chosen out of laziness, with no attempt that I can see to use names that reflect what they are supposed to represent.

    In the middle of the above declaration, the variable X is declared to be an array with four elements. One of the compiler errors comes from using X as a loop control variable.

    The best advice I can give you, since you are writing code to back up a thesis, is to spend some time learning Fortran.
     
  8. Sep 13, 2015 #7
    Don't know if something happened during the pasting operation, but if you code starts in the very first column, that's your problem right there...to better diagnose, you should probably attach your file, instead.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Help about Fortran
  1. Help about Fortran (Replies: 16)

  2. [Fortran] help (Replies: 2)

  3. FORTRAN Help (Replies: 1)

  4. Fortran Help (Replies: 2)

  5. Fortran If help (Replies: 3)

Loading...