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

Compiling MSES software

  1. Apr 16, 2013 #1
    Hello,

    I'm trying to compile some software called MSES, its written by Mark Drela in some fortran flavour. I've successfully compiled a number of subroutines through make files but there is one subroutine giving me grief. It's called dplot.f.

    It has a strage syntax I cant seem to work around:

    Code (Text):
         SUBROUTINE DPLOT
          INCLUDE 'STATE.INC'    
          INCLUDE 'MPLOT.INC'
    C-----------------------------------------------------------
    C     Reads in data file or reference profiles and plots them
    C     superimposed on calculated profiles.  The profiles are
    C     plotted in proper location on actual airfoil.
    C-----------------------------------------------------------
    C
          CHARACTER*40 FNAME, LINE, uname
          PARAMETER (IPRX=40,KPRX=240)
          DIMENSION XX(KPRX), YY(KPRX)
          DIMENSION APR(IPRX), XPR(IPRX), YPR(KPRX,IPRX), UPR(KPRX,IPRX)
          DIMENSION YADD(IPRX), YPRFAC(IPRX), UPRFAC(IPRX)
          DIMENSION DSPR(IPRX), THPR(IPRX), TSPR(IPRX)
          INTEGER KK(IPRX), NXPR(IPRX)
          LOGICAL LUPR, LTPR
    c
          parameter (jprx=isx*200)
          dimension nsum$(jprx)
          dimension y$(jprx), u$(jprx), uinv$(jprx), udef$(jprx)

    ...

     
    the dollar sign after a variable name, as in nsum$, makes no sense to me. Coming from matlab this wouldnt be a valid variable name and in my fortran compiler (tried both f77 and gfortran) it tells me a number of different errors about invalid forms and type disagreements. Removing the dollar signs gives errors relating to invalid declarations.

    Does anyone have any idea how to fix my code?
     
  2. jcsd
  3. Apr 16, 2013 #2
    Use gfortran -fdollar-ok

    Use gfortran with option -fdollar-ok:

    Sample
    Code (Text):

    c    file foo.f
          program foo
          real pi$
          parameter (pi$ = acos(-1.0))
          write(*,*) pi$  
          end program foo
    Reproducing the error
    Code (Text):

    gfortran foo.f
    foo.f:3.14:

          real pi$                                                          
                  1
    Error: Invalid character '$' at (1). Use -fdollar-ok to allow it as an extension
    foo.f:4.20:

          parameter (pi$ = acos(-1.0))                                      
                        1
    Error: Invalid character '$' at (1). Use -fdollar-ok to allow it as an extension
    foo.f:5.20:

          write(*,*) pi$                                                    
                        1
    Error: Invalid character '$' at (1). Use -fdollar-ok to allow it as an extension
     
    Fixing it
    Code (Text):

    gfortran -fdollar-ok foo.f
    echo $?
    0
     

    But despite this fix I would strongly discourage using non-standard names in self-written code.

    Cheers, Solkar
     
  4. Apr 16, 2013 #3
    Thank you Solkar.

    What do you mean by using non standard names?

    I'm new to fortran and wouldnt say i'm keen to learn it. I just need to use the programme for some work.

    After using your suggestion it seemed to have compiled correctly although now I have some problems with additional modules with the error:

    CHANGE = CHANGE .OR. (LMOD1(K,IP).XOR.LMOD(K,IP))
    1
    Error: Unknown operator 'xor' at (1)

    I dont think ill bother investigating it because its a module I dont need.
     
  5. Apr 16, 2013 #4
    Names which require tricking the compiler into eating them, like those ending with a "$" you asked for.

    I think intel's ifort has .xor. defined by default, but gfortran apparently doesn't.
    Standard Fortran has
    Code (Text):
    A .neqv. B
    for XORing of logical A,B, and it's common wisdom that most compilers support
    Code (Text):
    ieor(i,j)
    for bitwise XORing of integer i,j.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Compiling MSES software
  1. Fortran Compiler (Replies: 2)

  2. Fortran Compiler (Replies: 0)

  3. Difficulty Compiling (Replies: 3)

Loading...