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

FORTRAN REAL*INT error

  1. Nov 11, 2012 #1
    So I have been trying to write a code which calls from REFPROP subroutines to get thermodynamic properties and then uses these to do some other calculations. I am facing two issues:

    1) The REFPROP subroutines require IMPLICIT definitions so I can't say IMPLICIT none at the top, and this may cause some errors popping up where I don't know, is there a way to get around this?

    i.e. this must be at the top of my code
    Code (Text):
    !SETUP REFPROP
    IMPLICIT DOUBLE PRECISION (a-h,o-z)
    IMPLICIT INTEGER (i-k,m,n)
    PARAMETER (ncmax=20)   !max number of components in mixture
    DIMENSION x(ncmax),xliq(ncmax),xvap(ncmax),f(ncmax)
    CHARACTER hrf*3, herr*255
    CHARACTER*255 hf(ncmax)
    CHARACTER*7 hfmix  
    2) It kept saying "possible change of value from REAL(4) to REAL(8)" as an error, so I defined all of my variables as REAL(8) and the errors went away.. But now all my variables are floating point values and can't be multiplied with integers where they need to..

    Are there any ways of avoiding these issues? Also, I am using COMMON blocks to send variable values between subroutines, functions and main program.

    Thank you for your time
     
  2. jcsd
  3. Nov 11, 2012 #2

    chiro

    User Avatar
    Science Advisor

    Hey Aerospark and welcome to the forums.

    I'm not sure what the command is in FORTRAN, but you should consider that if you want to multiply a float by an integer, then create a new temporary float and cast the integer value to the float.

    In C we write this as:

    Code (Text):

       // x is our temporary float
       float x = 0;
       x = (float)(tempInt);
     
    FORTRAN should have something like this, and if you know what the command is then you can use it to convert integer to float and then everything is done with floating point arithmetic for that floating point word data type.
     
  4. Nov 11, 2012 #3

    Mark44

    Staff: Mentor

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: FORTRAN REAL*INT error
  1. Fortran error (Replies: 33)

  2. Fortran NAN error (Replies: 4)

  3. [FORTRAN] Runtime error (Replies: 12)

Loading...