gfortran编译错误错误:(1)[关闭]的不可分类声明

问题描述 投票:-2回答:1

我正在编写Fortran代码来输入Abaqus中的用户子程序。这个示例代码用于UEL示例。

我想为超弹性参数制作UEL子程序。我是第一次做Fortran,所以我无法解决错误。

这是我的代码。错误是Unclassifiable语句,但我不知道Fortran方法。

    c
c Blankholder force contro element for deep drawing applications
c
     subroutine uel(rhs, amatrx, svars, energy, ndofel, nrhs, nsvars,
    1 props, nprops, coords, mcrd, nnode, u, du, v, a, jtype, time, dtime,
    2 kstep, kinc, jelem, params, nload, jdltyp, adlmag, predef, npredf,
    3 lfoags, mlvarx, ddlmag, mdload, pnewdt, jprops, njprop, period)
c
     include 'aba_param.inc'
c
     dimension rhs(mlvarx, *), amatrx(ndofel, ndofel), svars(*), props(*),
    1 energy(7), coord(mcrd, nnode), u(ndofel), du(mlvarx, *), v(ndofel),
    2 a(ndofel), time(2), params(*), jdltyp(mdload, *), adlmag(mdload, *),
    4 ddlag(mdload, *), predef(2, npredf, nnode), lflags(4), jprops(*)
c
c Pick up the input data
c
     sPunch         = props(1)      !Spring stiffness
     fPunchTarget = props(2)        ! Target punch force
     fHolderInit    = props(3)      ! Initial blankholder force
     fractHolder   = props(4)       ! Fractional change allowed
     tolPunch       = props(5)      ! Tolereance on punch force
c
c Calculate the punch force
c
     fPunchNew = sPunch * (u(1)-u(2))
c
c Generate force vector and
c
     rhs(1,1) = -fPunchNew
     rhs(2,1) = +fpunchNew
c
c Generate stiffness matris
c
     amatrx(1,1) = +sPunch
     amatrx(1,2) = -sPunch
     amatrx(2,1) = -sPunch
c
c The holder force is only applied during steps 2 and 3
c
     if(kstep.eq.2) teh
c
c Ramp the punch force to the desired starting value
c
    fHolder = time(1)*fHolderInit/period
    svars(2) = fHolder
    rhs(3,1) = -fHolder
    else if(kstep.eq.3) then
c
c Adjust the punch force to control the blankholder force
c
c Values of state variables at start of increment
c
    fPunchOld = svars(1)    !Punch force
    fHolderOld = svars(2)   !Blankholder force
    fPunchMax = svar(3) !Maximum blankholder force
c
c Allowed change in blankholer force
c
    dfHolderMax = fractHolder * fHolderOld
c
c Allowed tolerance in the targetforce
c
    dfPunchTol = tolPunch * fPunchTarget
c
c Calculate the holder force
c
    if (fPunchOld.gt.fPunchTarget+dfPunchTol) then
      fHolerNew = fHolderOld - dfHolderMax  !Decrease
    else if(fPunchMax.lt.fPunchTarget+dfPunchTol .or.
     1      fPunchOld.gt.fPunchTarget-dfPunchTol) then
      fHolderNew = fHolderOld
    else
      fHolderNew = fHolderOld + dfHolderMax !Increase
    end if
c
c Generate holer force vector
c
    rhs(3,1) = -fHolderNew
c
c Update state variables
c
    svars(1) = fPunchNew
    svars(2) = fPHolderNew
    svars(3) = max(fPunchMax, fPunchNew)
     end if
c
     return 
     end

这是我的错误。

my_subroutine.for:4:6:

      subroutine uel(rhs, amatrx, svars, energy, ndofel, nrhs, nsvars,
      1
Error: Bad continuation line at (1)
my_subroutine.for:4:6:

      subroutine uel(rhs, amatrx, svars, energy, ndofel, nrhs, nsvars,
      1
Error: Unclassifiable statement at (1)
my_subroutine.for:5:6:

     1 props, nprops, coords, mcrd, nnode, u, du, v, a, jtype, time, dtime,
      1
Error: Unclassifiable statement at (1)
my_subroutine.for:6:6:

     2 kstep, kinc, jelem, params, nload, jdltyp, adlmag, predef, npredf,
      1
Error: Unclassifiable statement at (1)
my_subroutine.for:7:6:

     3 lfoags, mlvarx, ddlmag, mdload, pnewdt, jprops, njprop, period)
      1
Error: Unclassifiable statement at (1)
aba_param.inc:17:57:

       PARAMETER(IALLD=0,IRMMD=4,NEMPTY=0,ISPIND=2,IGRAD=0)
                                                         1
Error: Unexpected characters in PARAMETER statement at (1)
my_subroutine.for:12:6:

     1 energy(7), coord(mcrd, nnode), u(ndofel), du(mlvarx, *), v(ndofel),
      1
Error: Unclassifiable statement at (1)
my_subroutine.for:13:6:

     2 a(ndofel), time(2), params(*), jdltyp(mdload, *), adlmag(mdload, *),
      1
Error: Unclassifiable statement at (1)
my_subroutine.for:14:6:

     4 ddlag(mdload, *), predef(2, npredf, nnode), lflags(4), jprops(*)
      1
Error: Unclassifiable statement at (1)
my_subroutine.for:46:6:

  svars(2) = fHolder
      1
Error: Unclassifiable statement at (1)
my_subroutine.for:47:6:

  rhs(3,1) = -fHolder
      1
Error: Unclassifiable statement at (1)
my_subroutine.for:48:5:

     else if(kstep.eq.3) then
     1
Error: Non-numeric character in statement label at (1)
my_subroutine.for:48:5:

     else if(kstep.eq.3) then
     1
Error: Unclassifiable statement at (1)
my_subroutine.for:79:6:

  rhs(3,1) = -fHolderNew
      1
Error: Unclassifiable statement at (1)
my_subroutine.for:83:11: Error: 'svars' at (1) is not a variable
my_subroutine.for:84:11: Error: 'svars' at (1) is not a variable
my_subroutine.for:85:11: Error: 'svars' at (1) is not a variable
f951.exe: Error: Unexpected end of file in 'my_subroutine.for'

如何解决此错误并使用Fortran方法?

fortran gfortran
1个回答
0
投票

您正在使用所谓的“固定形式”Fortran,其中第6列中的字符表示线条延续,请参阅Fortran Wiki page about this

从错误中,如果问题中的格式正确,您显然会错过每行开头的一个空格(错误位于该行的字符6处)。

确保“延续字符”(此处为1,2和3)位于第六列。

您还可以决定切换到“自由格式”Fortran,其中延续线的表示方式不同。

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