# Help with source codes for numerical simulation

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:

No one has any idea about that stuf? :(

phyzguy
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. :(

phyzguy
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.

phyzguy
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?

Mark44
Mentor
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.
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. :(

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

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

phyzguy
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.

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.

Stephen Tashi
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?

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.

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

AlephZero
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.

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

• 72.1 KB Views: 297
• 27.8 KB Views: 305
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

• 51.7 KB Views: 313
hotvette
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:
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.

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

• 40.2 KB Views: 353
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

• 45.3 KB Views: 300
AlephZero
Homework Helper
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.