How to Compile MSES Software with Unexpected Syntax in Fortran?

  • Thread starter jasonbot
  • Start date
  • Tags
    Software
In summary: Names which require tricking the compiler into eating them, like those ending with a "$" you asked for.
  • #1
jasonbot
17
0
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 can't seem to work around:

Code:
     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 wouldn't 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?
 
Technology news on Phys.org
  • #2
Use gfortran -fdollar-ok

Use gfortran with option -fdollar-ok:

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

Reproducing the error
Code:
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:
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
 
  • Like
Likes 1 person
  • #3
Thank you Solkar.

What do you mean by using non standard names?

I'm new to fortran and wouldn't 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 don't think ill bother investigating it because its a module I don't need.
 
  • #4
jasonbot said:
Thank you Solkar.
What do you mean by using non standard names?
Names which require tricking the compiler into eating them, like those ending with a "$" you asked for.

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

I think intel's ifort has .xor. defined by default, but gfortran apparently doesn't.
Standard Fortran has
Code:
A .neqv. B
for XORing of logical A,B, and it's common wisdom that most compilers support
Code:
ieor(i,j)
for bitwise XORing of integer i,j.
 
  • Like
Likes 1 person
  • #5



Hello,

It seems like you are having trouble compiling the dplot.f subroutine in the MSES software. The strange syntax you mentioned, such as the dollar signs after variable names, may be specific to the fortran flavour used by Mark Drela. It is not a valid syntax in other languages like MATLAB.

Based on the information provided, it is difficult to pinpoint the exact issue with your code. However, here are some suggestions that may help:

1. Double check that you have correctly included all the necessary files (STATE.INC and MPLOT.INC) and that they are in the correct location.

2. It seems like the subroutine is expecting certain variables to be declared as character arrays (indicated by the dollar signs after their names). Make sure you have declared them as such in your code.

3. It is also possible that the subroutine is expecting certain variables to be passed in as arguments. Make sure you are passing in the correct arguments when calling the subroutine.

4. If you are still having trouble, it may be helpful to look at the rest of the code in the MSES software and see how other subroutines are using the dplot.f subroutine. This may give you some clues as to how to fix your code.

I hope this helps and good luck with your compilation process!
 

1. What is MSES software?

MSES (Multimode Spectral Evaluation System) is a software package used for analyzing spectral data, such as data from fluorescence, Raman, or infrared spectroscopy experiments. It allows for data visualization, processing, and modeling to aid in the interpretation of complex spectra.

2. How do I download and install MSES software?

MSES software can be downloaded from the official website of the software developer or from a trusted software repository. Once downloaded, the installation process is typically straightforward and involves following the instructions provided by the software. It is important to ensure that your computer meets the system requirements for the software before installing.

3. Can I use MSES software for my specific type of spectral data?

MSES software is designed to be versatile and can be used for various types of spectral data, including fluorescence, Raman, and infrared spectra. However, it is recommended to check the software's documentation or contact the developer to confirm if it is suitable for your specific type of data.

4. Are there any tutorials or resources available to help me learn how to use MSES software?

Yes, there are various resources available to help users learn how to use MSES software. These include user manuals, video tutorials, and online forums where users can ask questions and share tips and tricks. The software's developer may also offer training or workshops for a more in-depth understanding of the software's capabilities.

5. Can I customize MSES software for my specific needs?

Yes, MSES software allows for customization and can be adapted to fit specific research needs. This can include creating custom scripts or adding new features through plugin development. It is recommended to have a basic understanding of coding to make these customizations.

Back
Top