Error compiling the utility kswitch_v2.3.f

I'm attempting to compile the kswitch_v2.3.f source code that came with TOUGHREACT v3.32.   I'm using the gfortran compiler, and if this is relevant, I'm running this on Ubuntu v 17.10 as my OS. 

I've attached the error message I receive, but it's mostly repeated instances of the following:

kswitch_v2.3.f:321:39:

          write(iout1,"(a)") trim(short(dum))
                                                                 1

Error: ‘a’ argument of ‘short’ intrinsic at (1) must have a numeric type

By my cursory read through the source code, it looks like the variable dum is declared as a character, and the argument of short should be an integer.

 

Can anyone help me figure out how to fix this?

 

Thanks!

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Mikey,

    "short" is a function name in this program. It looks like gfortran doesn't like the name conflict. Just change the the name "short" everywhere to something different like "shorty".

    cheers,

    Eric

    Reply Like
  • Thanks!  That seemed to resolve the errors associated with 'short'.  There was one more:

    kswitch_v2.3.f:392:21:

           do while (.not.eof(inp1))
                                        1
    Error: Operand of .not. operator at (1) is REAL(8)

    I did a little digging on this, and it looks like gfortran doesn't recognize the 'eof' to designate the end of the file.  I did a workaround using the is_iostat_end function by following the steps below.  This got me past the compiling error, but I still need to test it on a simple database to make sure it runs correctly.

    1. declare integer variables stat and q with other variable declarations:
      • integer :: stat,q
    2. Write the following line before the line which was flagged by the compiler "do while (.not.eof(inp1))":
      • read(inp1,*,iostat=stat) q
    3. Replace "do while (.not.eof(inp1))" with the following:
      • do while (.not.is_iostat_end(stat))
    4. Repeat the line added from step 2 at the end of the do loop.
      • read(inp1,*,iostat=stat) q
      • end do  <--- this is around line 480 of the utility source code.

    I've attached the amended code here.  I'm not sure why it was only uploaded as a .zip file.

    Reply Like
Like Follow
  • 1 yr agoLast active
  • 2Replies
  • 233Views
  • 2 Following