Help with source codes for numerical simulation

Click For Summary

Discussion Overview

The discussion revolves around issues related to compiling Fortran 90 source code on a Windows XP system. Participants are seeking assistance with numerical simulation programs and troubleshooting compilation errors encountered with different compilers.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant expresses difficulty in compiling Fortran 90 code using the G95 compiler on Windows XP and requests a step-by-step procedure.
  • Another participant suggests that the user may be lacking necessary support libraries, based on their experience with compiling C codes.
  • A participant mentions encountering multiple error messages with the Force 2.0 compiler and missing files when using Gfortran, despite the files being present in the source code directory.
  • Some participants propose switching to a Unix-based system, such as Ubuntu Linux, as a potential solution for better compatibility with the source code.
  • There are suggestions to modify the makefile to ensure it correctly references the necessary files and directories for compilation.
  • One participant notes that the error message indicates that the make utility cannot find the gfortran compiler, suggesting a possible misconfiguration in the makefile.
  • Another participant recommends adding commands to the makefile to display the current directory and files to help diagnose the issue.

Areas of Agreement / Disagreement

Participants generally agree that the compilation issues may stem from the differences between Windows and Unix systems, but there is no consensus on the best approach to resolve the problems. Some advocate for switching to Linux, while others believe it should be possible to fix the issues within the current Windows environment.

Contextual Notes

Participants mention the need to modify the makefile and address potential discrepancies in file paths and compiler names. There is uncertainty regarding the exact nature of the errors and whether they are due to OS compatibility or configuration issues.

1Keenan
Messages
99
Reaction score
4
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/

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

Thanks
 
Last edited by a moderator:
Technology news on Phys.org
No one has any idea about that stuf? :(
 
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.
 
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. :(
 
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/
 
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.
 
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.
 
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?
 
1Keenan said:
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.
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.
1Keenan said:
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. :(
 
  • #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
 
  • #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...
 
  • #12
Mark44 said:
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.

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.
 
  • #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.
 
  • #14
using the console I enter in the directory with this code

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?
 
  • #15
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?

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.
 
  • #16
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:

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

showdir:
dir

showfiles:
echo $(SOURCES.f)

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 "/".
 
  • #17
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.
 
  • #18
Stephen Tashi said:
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".

...
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 "/".

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.
 

Attachments

  • Immagine.JPG
    Immagine.JPG
    70.2 KB · Views: 456
  • Immagine1.JPG
    Immagine1.JPG
    27.1 KB · Views: 472
  • #19
AlephZero said:
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.

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
 

Attachments

  • Immagine1.JPG
    Immagine1.JPG
    50.4 KB · Views: 458
  • #20
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:
  • #21
hotvette said:
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.

This is my very first attemp, I have never used fortarn language.
I have a bit of experience with C and C# but only for simple calculus code.
 
  • #23
Stephen Tashi said:
The error you had is mentioned here: http://www.g95.org/windows_faq.shtml

I didn't get what to do, sorry.
If I write the command make drelp -v or g95 -v
I have the messages in the attached screenshot, and I'm not able to check if g95 is calling the correct version of ld.exe

the second point on the link you posted says to add a directory, but I already have this dir... :(
 

Attachments

  • Immagine2.JPG
    Immagine2.JPG
    39.1 KB · Views: 510
  • #24
Ok, I have tried with g77 and it seems it worked, but I don't know how to run the program now.
Anyway I have attached the screenshot of what g77 did
 

Attachments

  • Immagine3.JPG
    Immagine3.JPG
    44.4 KB · Views: 452
  • #25
Being realistic about this, if you don't know enough to follow the instructions in that FAQ, there's a limit to how much help we can give you remotely.

From what the code does, I'm guessing that you are at a college or university. There must be somebody around (either IT staff who are paid to give support, or some other students or researchers) who could sort this out in a few minutes if they were actually sitting in front of your PC, but it's hard to tell you what to do "remotely" if the response to "do this" is likely to be "Sorry, I don't understand".

Your college probably has some basic guides to computing and software development availaible for students as well - so find out where they are and start reading.

So far, this is just the easy part. The real problems will start when you have built the program, and it doesn't work!

By all means keep asling questiions here, but you can't really expect us give you a complete "Software development on Windows 101" course.
 
  • #26
1Keenan said:
Ok, I have tried with g77 and it seems it worked, but I don't know how to run the program now.
Anyway I have attached the screenshot of what g77 did

Is there some documentation in what you downloaded? Or are you supposed to buy the book? The obvious way to start the program would be to type
Code:
drelp
or maybe
Code:
.\drelp.exe
but of course we don't have any idea what (if anything) willl happen if you do that...
 
  • #27
AlephZero said:
From what the code does, I'm guessing that you are at a college or university. There must be somebody around (either IT staff who are paid to give support, or some other students or researchers) who could sort this out in a few minutes if they were actually sitting in front of your PC.

That's the big problem, man, no one is around here who knows how to sort this stuff out.

When I try to run the program I have a message saying "abnormal program termination"
 

Attachments

  • Immagine4.JPG
    Immagine4.JPG
    28.9 KB · Views: 446
Last edited:
  • #28
Just as AlephZero had predicted. From the error message it looks like the program is trying to read something from a file. Suggest you look at the driver program (most likely drelp.f) and see what it's trying to do. You might also consult any documentation that came with the code files so you can better understand what it does and needs for input.

I still think it's a good idea to get a simple program working first so you know you have a properly installed Fortran system. Right now it's difficult to tell.
 
Last edited:

Similar threads

Replies
7
Views
4K
Replies
59
Views
9K
  • · Replies 29 ·
Replies
29
Views
8K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K