Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28512 Discussions

Compiler fortran Error cfx5mkext -64bit

Hich_C_
Beginner
1,918 Views

i have try to write this programm but don´t work i become errors i have no idea please i need a help. i would like to calculate CD

 

 

#include "cfx5ext.h"
dllexport(drag_factor)
      SUBROUTINE drag_factor (NLOC,NRET,NARG,RET,ARG,CRESLT,
     &                              CZ,DZ,IZ,LZ,RZ)
CC
CC --------------------
CC        Input
CC --------------------
CC
CC  NRET   - number of components in result
CC  NARG   - number of arguments in call
CC  ARG() - (NARG) argument values
CC
CC --------------------
CC      Modified
CC --------------------
CC
CC  Stacks possibly.
CC
CC --------------------
CC        Output
CC --------------------
CC
CC  RET()  - (NRET) return values
CC
CC --------------------
CC       Details
CC --------------------
CC
CC======================================================================
C
C ------------------------------
C     Preprocessor includes
C ------------------------------
C
C ------------------------------
C        Global Parameters
C ------------------------------
C
C ------------------------------
C        Argument list
C ------------------------------
C
      INTEGER NLOC,NARG,NRET
C
      REAL ARG(NLOC,NARG), RET(NLOC,NRET)
C
      CHARACTER CRESLT*(*)
C
      INTEGER IZ(*)
      CHARACTER CZ(*)*(1)
      DOUBLE PRECISION DZ(*)
      LOGICAL LZ(*)
      REAL RZ(*)
C
C ------------------------------
C        External routines
C ------------------------------
C
C ------------------------------
C        Local Parameters
C ------------------------------
C
C ------------------------------
C        Local Variables
C ------------------------------
C
C ------------------------------
C        Stack pointers
C ------------------------------
C
C=======================================================================
C
C ---------------------------
C    Executable Statements
C ---------------------------
C
C=======================================================================
C
C     Argument variables stack:
C     -------------------------
C     Particle Reynolds Number          :     RE_PT      = ARG(1,1)
C     Mean Particle Diameter            :     d_p        = ARG(1,2)
C     Turbulence Eddy Dissipation       :     psy        = ARG(1,3)
C     Dynamic Viscosity                 :     ny         = ARG(1,4)
C     Density                           :     rho        = ARG(1,5)
C
C     Return variables stack            :
C     -----------------------
C     drag factor coefficient           :     CD         = RET(1,1)
C
C=======================================================================
C
C-----------------------------------------------------------------------
C     Calculate the momentum source and source term coefficient
C-----------------------------------------------------------------------
C
      CALL USER_CD(RET(1,1),ARG(1,1),ARG(1,2),ARG(1,3),ARG(1,4),ARG(1,5))
      END
C
      SUBROUTINE USER_CD(CD,RE_PT,d_p,psy,ny,rho)
C
C=======================================================================
C     Calculate the momentum source and source term coefficient
C=======================================================================
C
C ------------------------------
C     Preprocessor includes
C ------------------------------
C
#include "cfd_sysdep.h"
#include "cfd_constants.h"
C
C ------------------------------
C        Argument list
C ------------------------------
C
      REAL CD, RE_PT, d_p, psy, ny, rho
C
C ------------------------------
C        Local variables
C ------------------------------
C
      REAL CD0, lambda
C
C------------------------------
C---- Calculate Brucato Model
C
      
      IF (RE_PT .LT. 1.) THEN
      CD0 = 22.73/RE_PT + 0.0903/RE_PT + 3.69
      lambda = (((ny/rho)**3)/psy)**(1/4)
      CD = CD0 + CD0*(0.000867*(d_p / lambda)**3)
      
      ELSEIF ((RE_PT .LT. 10.).and.(RE_PT .GT. 1.)) THEN
      CD0 = 29.167/RE_PT - 3.889/RE_PT + 1.222
      lambda = (((ny/rho)**3)/psy)**(1/4)
      CD = CD0 + CD0*(0.000867*(d_p / lambda)**3)

      ELSEIF ((RE_PT .LT. 100.).and.(RE_PT .GT. 10.)) THEN
      CD0 = 46.5/RE_PT - 116.67/RE_PT + 0.6167
      lambda = (((ny/rho)**3)/psy)**(1/4)
      CD = CD0 + CD0*(0.000867*(d_p / lambda)**3)

      ELSEIF ((RE_PT .LT. 1000.).and.(RE_PT .GT. 100.)) THEN
      CD0 = 98.33/RE_PT - 2778/RE_PT + 0.3644
      lambda = (((ny/rho)**3)/psy)**(1/4)
      CD = CD0 + CD0*(0.000867*(d_p / lambda)**3)

      ELSEIF ((RE_PT .LT. 5000.).and.(RE_PT .GT. 1000.)) THEN
      CD0 = 148.62/RE_PT - 47500/RE_PT + 0.357
      lambda = (((ny/rho)**3)/psy)**(1/4)
      CD = CD0 + CD0*(0.000867*(d_p / lambda)**3)

      ELSEIF ((RE_PT .GT. 5000.) THEN
      CD0 = - 490.546/RE_PT + 578700/RE_PT + 0.46
      lambda = (((ny/rho)**3)/psy)**(1/4)
      CD = CD0 + CD0*(0.000867*(d_p / lambda)**3)

      END IF
C
      END

 

 

0 Kudos
10 Replies
TimP
Honored Contributor III
1,918 Views

You'll need to do your own proofreading as you have reformatted what you posted. F77 fixed format is strict about ignoring what falls beyond column 72.  Another glaring problem is your use of  expression (1/4) which evaluates to 0 where you may have intended 0.25 or 1./4.

0 Kudos
mecej4
Honored Contributor III
1,918 Views

In addition to what Tim wrote, which I second, please note:

  • It is not helpful when you post text in the form of an image (.jpg, .png, etc.). Post text as straight text so that commands, error messages, etc. in your post can be copied and used as necessary. Images contain very little easily transferable information. 
  • Do not post any but the shortest of program source in-line. As Tim pointed out, they can be reformatted by the forum software and have their validity/meaning completely changed. This admonition is even more important when you ask for help on an error message resulting from an attempt to compile the code. Use the {code} button on the toolbar, or attach a zipped collection of source codes.
  • If your program has INCLUDE statements/directives, usually you need to post the contents of the included files, as well.
  • Tim noted that your program uses "(1/4)" as an exponent quite often. In Fortan, that expression evaluates to zero. Along the same lines, note that your subroutine code fails to do anything useful if Re_Pt has one of the transition values 10, 100, 1000 or 5000. These values "fall through the cracks in the floor" of the subroutine.
  • The calculation of lambda is needlessly repeated six times. One instance of that preceding the cascade of IF..THEN..ELSEIF...ENDIF would suffice. Similarly, one instance of calculation CD from CD0, placed after the cascade of IF..ENDIF statements, should suffice. Unnecessary repetitions make the code more error prone and, often, result in less efficient compiled code.
0 Kudos
Hich_C_
Beginner
1,918 Views

Hallo,

firstly thank you for helping me.

1. @Tim: i not understand what you mean "F77 fixed format is strict about ignoring what falls beyond column 72."

2. I have try to do your every instruction

#include "cfx5ext.h"
dllexport(drag)
      SUBROUTINE drag (NLOC,NRET,NARG,RET,ARG,CRESLT,
     &                              CZ,DZ,IZ,LZ,RZ)
CC
CC --------------------
CC        Input
CC --------------------
CC
CC  NRET   - number of components in result
CC  NARG   - number of arguments in call
CC  ARG() - (NARG) argument values
CC
CC --------------------
CC      Modified
CC --------------------
CC
CC  Stacks possibly.
CC
CC --------------------
CC        Output
CC --------------------
CC
CC  RET()  - (NRET) return values
CC
CC --------------------
CC       Details
CC --------------------
CC
CC======================================================================
C
C ------------------------------
C     Preprocessor includes
C ------------------------------
C
C ------------------------------
C        Global Parameters
C ------------------------------
C
C ------------------------------
C        Argument list
C ------------------------------
C
      INTEGER NLOC,NARG,NRET
C
      REAL ARG(NLOC,NARG), RET(NLOC,NRET)
C
      CHARACTER CRESLT*(*)
C
      INTEGER IZ(*)
      CHARACTER CZ(*)*(1)
      DOUBLE PRECISION DZ(*)
      LOGICAL LZ(*)
      REAL RZ(*)
C
C ------------------------------
C        External routines
C ------------------------------
C
C ------------------------------
C        Local Parameters
C ------------------------------
C
C ------------------------------
C        Local Variables
C ------------------------------
C
C ------------------------------
C        Stack pointers
C ------------------------------
C
C=======================================================================
C
C ---------------------------
C    Executable Statements
C ---------------------------
C
C=======================================================================
C
C     Argument variables stack:
C     -------------------------
C     Particle Reynolds Number          :     RE_PT      = ARG(1,1)
C     Mean Particle Diameter            :     d_p        = ARG(1,2)
C     Turbulence Eddy Dissipation       :     psy        = ARG(1,3)
C     Dynamic Viscosity                 :     ny         = ARG(1,4) 
C     Density                           :     rho        = ARG(1,5)
C
C     Return variables stack            :
C     -----------------------
C     drag factor coefficient           :     CD         = RET(1,1)
C
C=======================================================================
C
C-----------------------------------------------------------------------
C     Calculate the momentum source and source term coefficient
C-----------------------------------------------------------------------
C
      CALL USER_CD(RET(1,1),ARG(1,1),ARG(1,2),ARG(1,3),ARG(1,4),ARG(1,5))
      END
C
      SUBROUTINE USER_CD(CD,RE_PT,d_p,psy,ny,rho)
C
C=======================================================================
C     Calculate the momentum source and source term coefficient
C=======================================================================
C
C ------------------------------
C     Preprocessor includes
C ------------------------------
C
#include "cfd_sysdep.h"
#include "cfd_constants.h"
C
C ------------------------------
C        Argument list
C ------------------------------
C
      REAL CD, RE_PT, d_p, psy, ny, rho
C
C ------------------------------
C        Local variables
C ------------------------------
C
      REAL CD_o, l_o
C
C ------------------------------
C    Executable statements
C ------------------------------
C
C---- lamda calculation
C
            l_o = (((ny/rho)**3)/psy)**0.25
C
C------------------------------
C---- Calculate mursi model
C
      
      IF (RE_PT .LT. 1.) THEN
      CD_o = 22.73/RE_PT + 0.0903/RE_PT + 3.69
      
      
      ELSEIF ((RE_PT .LT. 10.).and.(RE_PT .GT. 1.)) THEN
      CD_o = 29.167/RE_PT - 3.889/RE_PT + 1.222


      ELSEIF ((RE_PT .LT. 100.).and.(RE_PT .GT. 10.)) THEN
      CD_o = 46.5/RE_PT - 116.67/RE_PT + 0.6167


      ELSEIF ((RE_PT .LT. 1000.).and.(RE_PT .GT. 100.)) THEN
      CD_o = 98.33/RE_PT - 2778/RE_PT + 0.3644
    

      ELSEIF ((RE_PT .LT. 5000.).and.(RE_PT .GT. 1000.)) THEN
      CD_o = 148.62/RE_PT - 47500/RE_PT + 0.357


      ELSE
      CD_o = -490.546/RE_PT + 578700/RE_PT + 0.46


      ENDIF
C
C------------------------------
C---- Calculate Brucato Model
C

CD = CD_o + CD_o*(0.000867*(d_p / l_o)**3)
c
C------------------------------
      END

3. now i have just one error -:) i use cfx5mkext -64bit  to compile drag.F i receive

 

C:\Users\Home\.cfx\model>cfx5mkext -64bit drag.F
C:\Program Files (x86)\Intel\Composer XE 2015\bin\intel64\ifort -Qvec- -iface:cv
f -MD -fpp -include:"C:\Program Files\ANSYS Inc\v150\CFX\include" -object:winnt-
amd64\\drag.o -c drag.F
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Inte
l(R) 64, Version 15.0.4.221 Build 20150407
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

ifort: NOTE: The evaluation period for this product ends on 21-aug-2015 UTC.
drag.F(98): error #5082: Syntax error, found END-OF-STATEMENT when expecting one
 of: ) :: , :
      CALL USER_CD(RET(1,1),ARG(1,1),ARG(1,2),ARG(1,3),ARG(1,4),ARG(1,5)
------------------------------------------------------------------------^
compilation aborted for drag.F (code 1)
An error has occurred in cfx5mkext:

C:\Program Files (x86)\Intel\Composer XE 2015\bin\intel64\ifort exited with
return code 1.

C:\Users\Home\.cfx\model>

 

I wish you a good weekend

best regards

Hicham

0 Kudos
mecej4
Honored Contributor III
1,918 Views

Hich C. wrote:

1. @Tim: i not understand what you mean "F77 fixed format is strict about ignoring what falls beyond column 72."

Look at Line-98. It is too long; the ')' in column-73 is ignored by the compiler, and the truncated line has a syntax error. Break the line before that position, and continue the rest of the line on a continuation line.

2. I have try to do your every instruction

You did not provide the source codes for the included files.

 

0 Kudos
Hich_C_
Beginner
1,918 Views

Hello,

i have break the line

#include "cfx5ext.h"
dllexport(drag)
      SUBROUTINE drag (NLOC,NRET,NARG,RET,ARG,CRESLT,
     &                              CZ,DZ,IZ,LZ,RZ)
CC
CC --------------------
CC        Input
CC --------------------
CC
CC  NRET   - number of components in result
CC  NARG   - number of arguments in call
CC  ARG() - (NARG) argument values
CC
CC --------------------
CC      Modified
CC --------------------
CC
CC  Stacks possibly.
CC
CC --------------------
CC        Output
CC --------------------
CC
CC  RET()  - (NRET) return values
CC
CC --------------------
CC       Details
CC --------------------
CC
CC======================================================================
C
C ------------------------------
C     Preprocessor includes
C ------------------------------
C
C ------------------------------
C        Global Parameters
C ------------------------------
C
C ------------------------------
C        Argument list
C ------------------------------
C
      INTEGER NLOC,NARG,NRET
C
      REAL ARG(NLOC,NARG), RET(NLOC,NRET)
C
      CHARACTER CRESLT*(*)
C
      INTEGER IZ(*)
      CHARACTER CZ(*)*(1)
      DOUBLE PRECISION DZ(*)
      LOGICAL LZ(*)
      REAL RZ(*)
C
C ------------------------------
C        External routines
C ------------------------------
C
C ------------------------------
C        Local Parameters
C ------------------------------
C
C ------------------------------
C        Local Variables
C ------------------------------
C
C ------------------------------
C        Stack pointers
C ------------------------------
C
C=======================================================================
C
C ---------------------------
C    Executable Statements
C ---------------------------
C
C=======================================================================
C
C     Argument variables stack:
C     -------------------------
C     Particle Reynolds Number          :     RE_PT      = ARG(1,1)
C     Mean Particle Diameter            :     d_p        = ARG(1,2)
C     Turbulence Eddy Dissipation       :     psy        = ARG(1,3)
C     Dynamic Viscosity                 :     ny         = ARG(1,4) 
C     Density                           :     rho        = ARG(1,5)
C
C     Return variables stack            :
C     -----------------------
C     drag factor coefficient           :     CD         = RET(1,1)
C
C=======================================================================
C
C-----------------------------------------------------------------------
C     Calculate the momentum source and source term coefficient
C-----------------------------------------------------------------------
C
      CALL USER_CD(RET(1,1),ARG(1,1),ARG(1,2),
      & ARG(1,3),ARG(1,4),ARG(1,5))
      END
C
      SUBROUTINE USER_CD(CD,RE_PT,d_p,psy,ny,rho)
C
C=======================================================================
C     Calculate the momentum source and source term coefficient
C=======================================================================
C
C ------------------------------
C     Preprocessor includes C:\Users\Home\.cfx\model
C ------------------------------
C
#include "cfd_sysdep.h"
#include "cfd_constants.h"
C
C ------------------------------
C        Argument list
C ------------------------------
C
      REAL CD, RE_PT, d_p, psy, ny, rho
C
C ------------------------------
C        Local variables
C ------------------------------
C
      REAL CD_o, l_o
C
C ------------------------------
C    Executable statements
C ------------------------------
C
C---- lamda calculation
C
            l_o = (((ny/rho)**3)/psy)**0.25
C
C------------------------------
C---- Calculate mursi model
C
      
      IF (RE_PT .LT. 1.) THEN
      CD_o = 22.73/RE_PT + 0.0903/RE_PT + 3.69
      
      
      ELSEIF ((RE_PT .LT. 10.).and.(RE_PT .GT. 1.)) THEN
      CD_o = 29.167/RE_PT - 3.889/RE_PT + 1.222


      ELSEIF ((RE_PT .LT. 100.).and.(RE_PT .GT. 10.)) THEN
      CD_o = 46.5/RE_PT - 116.67/RE_PT + 0.6167


      ELSEIF ((RE_PT .LT. 1000.).and.(RE_PT .GT. 100.)) THEN
      CD_o = 98.33/RE_PT - 2778/RE_PT + 0.3644
    

      ELSEIF ((RE_PT .LT. 5000.).and.(RE_PT .GT. 1000.)) THEN
      CD_o = 148.62/RE_PT - 47500/RE_PT + 0.357


      ELSE
      CD_o = -490.546/RE_PT + 578700/RE_PT + 0.46


      ENDIF
C
C------------------------------
C---- Calculate Brucato Model
C

CD = CD_o + CD_o*(0.000867*(d_p / l_o)**3)
c
C------------------------------
      END

 

and provide the source but i get errors

C:\Users\Home\.cfx\model>cfx5mkext -64bit drag.F
C:\Program Files (x86)\Intel\Composer XE 2015\bin\intel64\ifort -Qvec- -iface:cv
f -MD -fpp -include:"C:\Program Files\ANSYS Inc\v150\CFX\include" -object:winnt-
amd64\\drag.o -c drag.F
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Inte
l(R) 64, Version 15.0.4.221 Build 20150407
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

ifort: NOTE: The evaluation period for this product ends on 21-aug-2015 UTC.
drag.F(98): error #5082: Syntax error, found END-OF-STATEMENT when expecting one
 of: ( * ) :: , <IDENTIFIER> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARAC
TER_CONSTANT> ...
      CALL USER_CD(RET(1,1),ARG(1,1),ARG(1,2),
----------------------------------------------^
drag.F(99): error #5276: Unbalanced parentheses
      & ARG(1,3),ARG(1,4),ARG(1,5))
----------------------------------^
drag.F(99): error #5082: Syntax error, found '&' when expecting one of: <LABEL>
<END-OF-STATEMENT> ; BLOCK PROGRAM BLOCKDATA MODULE INTEGER REAL COMPLEX ...
      & ARG(1,3),ARG(1,4),ARG(1,5))
------^
drag.F(99): error #5082: Syntax error, found ')' when expecting one of: , <END-O
F-STATEMENT> ;
      & ARG(1,3),ARG(1,4),ARG(1,5))
----------------------------------^
drag.F(99): error #6252: This format specifier is invalid.   [(1,3)]
      & ARG(1,3),ARG(1,4),ARG(1,5))
------------^
drag.F(99): error #6514: A substring must be of type CHARACTER.   [ARG]
      & ARG(1,3),ARG(1,4),ARG(1,5))
--------------------------^
fortcom: Fatal: There has been an internal compiler error (C0000005).
compilation aborted for drag.F (code 1)
An error has occurred in cfx5mkext:

C:\Program Files (x86)\Intel\Composer XE 2015\bin\intel64\ifort exited with
return code 1.

 

0 Kudos
Hich_C_
Beginner
1,918 Views

Hi,

i have find the problem now it work. Thank you very much!

CALL USER_CD(RET(1,1),ARG(1,1),ARG(1,2),
     &           ARG(1,3),ARG(1,4),ARG(1,5))

best regards,

 

Hicham

0 Kudos
mecej4
Honored Contributor III
1,918 Views

Good, but the corrected code still has the following error that I pointed out in #2: it fails to do anything useful if Re_Pt has one of the transition values 10, 100, 1000 or 5000. All these numbers are exactly representable in 32-bit or 64-bit IEEE floating point format, so one of these constants may test as equal to an input Re_Pt having one of these values.

Line-1 of #7 probably has six leading blanks that got stripped out by the slightly ignorant forum software.

0 Kudos
Hich_C_
Beginner
1,918 Views
oh yes i forget to change LT to LE and GT to GE
0 Kudos
Steven_L_Intel1
Employee
1,918 Views

That internal compiler error is a problem. It is triggered by the & continuation character for the CALL being in column 7 instead of 6. I will report this to the developers.

0 Kudos
Steven_L_Intel1
Employee
1,918 Views

The internal compiler error has been fixed for a future major release.

0 Kudos
Reply