Help with source codes for numerical simulation

  • Thread starter 1Keenan
  • Start date
  • #1
100
3
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:

Answers and Replies

  • #2
100
3
No one has any idea about that stuf? :(
 
  • #3
phyzguy
Science Advisor
4,739
1,670
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.
 
  • #4
100
3
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. :(
 
  • #5
phyzguy
Science Advisor
4,739
1,670
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/
 
  • #6
100
3
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.
 
  • #7
phyzguy
Science Advisor
4,739
1,670
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.
 
  • #8
100
3
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?
 
  • #9
34,671
6,384
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. :(
 
  • #10
100
3
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
100
3
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
phyzguy
Science Advisor
4,739
1,670
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
100
3
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
Stephen Tashi
Science Advisor
7,571
1,465
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
100
3
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
Stephen Tashi
Science Advisor
7,571
1,465
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
AlephZero
Science Advisor
Homework Helper
6,994
292
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
100
3
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

  • #19
100
3
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

  • #20
hotvette
Homework Helper
996
5
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
100
3
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
100
3
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

  • #24
100
3
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

  • #25
AlephZero
Science Advisor
Homework Helper
6,994
292
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.
 

Related Threads on Help with source codes for numerical simulation

  • Last Post
Replies
15
Views
2K
Replies
6
Views
3K
  • Last Post
Replies
4
Views
1K
  • Last Post
Replies
17
Views
3K
Replies
8
Views
2K
  • Last Post
Replies
7
Views
5K
  • Last Post
Replies
8
Views
29K
  • Last Post
Replies
1
Views
341
Replies
2
Views
2K
Replies
4
Views
469
Top