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

Help with source codes for numerical simulation

  1. Oct 28, 2011 #1
    Hi all,

    I need to use some numerical simulation programs.
    The source code is provided in Fortran 90 but I'm not able to compile it.
    I'm using G95 complier on WinXP, and the code are avilable at the following address: http://www2.fz-juelich.de/jsc/splim/ [Broken]

    Could you provide any step by step procedure to run the code?

    Thanks
     
    Last edited by a moderator: May 5, 2017
  2. jcsd
  3. Nov 3, 2011 #2
    No one has any idea about that stuf? :(
     
  4. Nov 3, 2011 #3

    phyzguy

    User Avatar
    Science Advisor

    What goes wrong when you try to compile it? I don't have much experience with Fortran, but from my experience with compiling C codes from external sources, I suspect you are lacking the necessary support libraries.
     
  5. Nov 3, 2011 #4
    Actually I have a lot of error messages if I use Force 2.0 compiler
    If I use Gfortran the error message says that a file with a certain name is missing, but this file is in the folder in which I have the source code.
    The source code are written for Unix based system, what I need to change to make it work on WinXP?

    I'm getting crazy with this stuff. It is supposed to be my thesis degree but my tutor doesn't care about. :(
     
  6. Nov 3, 2011 #5

    phyzguy

    User Avatar
    Science Advisor

    Getting this stuff to work on Windows can be a huge undertaking. Can you convert to Unix? Ubuntu Linux is available for free download. If you want, you can configure your computer to dual-boot Windows or Linux. This is what I did, and after 6 months or so I abandoned Windows altogether and now do everything on Linux. It works better, and its FREE.

    http://www.ubuntu.com/
     
  7. Nov 3, 2011 #6
    Yes, I know you are right, but I'm to lazy to erase my machine.
    Anyway if it is necessary I will do it, but I want to be sure it is a OS problem. Do you know if there is a Linux emulator or somithing similar? just to try if this code work on Linux.
     
  8. Nov 3, 2011 #7

    phyzguy

    User Avatar
    Science Advisor

    There is no Unix emulator under Windows. This is moving backwards. Bite the bullet and move to a 'real' OS. If you want to verify that it will work under Unix first, go find another machine that is running Unix.
     
  9. Nov 3, 2011 #8
    the code is free and downloadable clicking on the link I posted above, could you try to compile it and let me know if it work?
     
  10. Nov 3, 2011 #9

    Mark44

    Staff: Mentor

    I'm going to guess that the file that Gfortran says is missing is just in the wrong directory. There's probably a make file that the compiler uses to know what to compile and link. Look for the make file, which is a text file, and see if it lists the missing file. If so, note where the make file thinks this file should be (i.e., directory path), and compare to where the file actually is. If that's the problem, you could either move the file to the right directory, or update the make file so that it has the correct path for this file.

    It doesn't seem reasonable to me that you should have to wipe your hard drive and install a new OS just to make a Fortran program run.
     
  11. Nov 3, 2011 #10
    Ok!
    It seems resonable to me your explanation, and I think I have to make a lot of changes in the make file.
    I'll try in the following days and let you know.
    I hope you are right.
    Many thanks
     
  12. Nov 3, 2011 #11
    It's me again, sorry for bothering, but I thought it was easy, but for me that programming stuf are a bit tricky

    anyway,using the console I enter in the directory with this code end I have to compile a file named drelp.f using this command:

    C:\Documents & Settings\....\propag\src>make drelp

    after pressing "enter" I have this message:

    gfortran -c -g -03 absorb.f
    process_begin: CreateProcess <<null>, gfortran -c -g -03 absorb.f, ...> failed
    make (e=2): Impossible to find the specified file.
    make: *** [absorb.o] Error 2


    It seems that the compiler can't find absorb.f that is actually in the same directori of drelp.f


    That's the make file:

    # Gnu compiler
    FC = gfortran
    FFLAGS = -g -O3

    # Intel compiler
    #FC = ifort
    #FFLAGS = -g -fixed -O3


    .SUFFIXES: .f

    SOURCES.f = absorb.f arinit.f \
    setup.f diagnostics.f drelp.f \
    density.f emhist.f \
    emprop.f energy.f ffts.f \
    flhist.f ghist.f gmovie.f \
    grafout.f grid.f grinp.f grxy.f grzsurf.f \
    init.f ionize.f ioutils.f launch.f \
    outini.f powcon.f \
    pulinit.f rezone.f spec.f \
    stamp.f cputime.f

    OBJ = $(SOURCES.f:.f=.o)

    # compile mode
    .f.o:
    $(FC) -c $(FFLAGS) $<


    drelp: $(OBJ)
    $(FC) $(FFLAGS) $(OBJ) -o drelp


    clean:
    rm -f drelp.o drelp core *.o




    what I need to change?
    I get a bit confused...
     
  13. Nov 4, 2011 #12

    phyzguy

    User Avatar
    Science Advisor

    Mark44 is right that you should be able to fix this with your current OS. However, you should know that you don't have to wipe your hard drive to install Ubuntu Linux. You can install it alongside of Windows on a partition of your hard drive. Then when you boot up it asks you if you want to boot Windows or Linux.
     
  14. Nov 7, 2011 #13
    I know about partition, but as I wrote I'm too lazy to change anything on my pc, and my machine is very old and I don't want to take the risk of messing up everything.
    If you guys cold help me in modifying the makefile it would be great.
     
  15. Nov 7, 2011 #14

    Stephen Tashi

    User Avatar
    Science Advisor

    What do you mean by that? When you use the DIR command, does it show the make file and the FORTRAN files are in the directory?
     
  16. Nov 7, 2011 #15
    yes, everything is in the same directory C:\Documents & Settings\....\propag\src

    Dir command shows all files correctly.
    I think Mark44 is right, but I don't know how fix the makefile.
     
  17. Nov 7, 2011 #16

    Stephen Tashi

    User Avatar
    Science Advisor

    I don't have any machines running Windows, so I can conjecture things, but i can't test them for you. One way to try to find out what's going on is the put commands in the makefile that show "what it thinks".

    For example, you might be able to find out where it thinks the files are by adding a few commands to it. (Be aware that (in Linux) makefiles are very particular about the difference between spaces and tabs. I can't say what will happen in Windows.)

    Make a copy of the makefile and name it something like savemakefile before you begin editing the original makefile.

    Then try adding commands. For example below the "clean:" section you can try:

    Then, from the command line, try the commands:

    make showdir

    make showfiles

    and see what is printed out on the console.

    This suggestion is an attempt to detect errors in how the directory and file names are defined within the makefile. Problems between Windows and Linux can arise because some versions of Windows treated all characters as capitals and Windows uses "\" for a directory separator while Linux uses "/".
     
  18. Nov 7, 2011 #17

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

    The error message doesn't say "the compiler can't find your source code", it says "make can't find gfortran".

    Your OP said you are using "G95 compiler" but the makefile thinks the compiler is called "gfortran". Try changing "FC = gfortran" to "FC = g95" or whatever your compiler is called.
     
  19. Nov 7, 2011 #18
    I added the lines as you suggested, and to avoid any risk I had "copy/paste" the layout of previous commands and it worked.
    It seems to me that the make file "thinks" that all the file are in the right folder.
    Could you please doublecheck the attached screenshot?
    Please note that the first one is not complete, the list is a bit longer but it doesn't fit in one screenshot.
     

    Attached Files:

  20. Nov 7, 2011 #19
    It seems you are right.
    I have changed compiler and something happened: it make some new file like *.o but at a certain point I have a new error.
    Could you check the attached screenshot, please.

    It is very kind of you guys, thanks everybody for helping
     

    Attached Files:

  21. Nov 7, 2011 #20

    hotvette

    User Avatar
    Homework Helper

    Have you successfully compiled ANY code at all using G95 and Windows or is this your very first attempt? Sometimes it helps to get a very simple program working before tackling a more complicated situation.

    Also, what are you actually trying to do? Compile the individual fortran source into object files and link them to create an exe?
     
    Last edited: Nov 7, 2011
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Help with source codes for numerical simulation
  1. Source code of Games (Replies: 8)

  2. The Source Code! (Replies: 15)

Loading...