Help with source codes for numerical simulation

In summary, the code is available for download from the website I posted, but I'm not able to compile it. Force 2.0 compiler doesn't work either.
  • #1
1Keenan
101
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
  • #2
No one has any idea about that stuf? :(
 
  • #3
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
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
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
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
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
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
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: 384
  • Immagine1.JPG
    Immagine1.JPG
    27.1 KB · Views: 383
  • #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: 396
  • #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: 435
  • #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: 383
  • #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: 370
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:

1. What is numerical simulation?

Numerical simulation is a technique used in scientific research to model and analyze complex systems using mathematical algorithms and computer programs. It involves creating a computer model of a real-world system and using mathematical equations to simulate its behavior under different conditions.

2. How do source codes help with numerical simulation?

Source codes are sets of instructions written in a programming language that help to create and run numerical simulations. They contain the mathematical algorithms and equations necessary to model the system and can be modified to study different scenarios and variables.

3. What are the benefits of using numerical simulation in scientific research?

Numerical simulation allows scientists to study complex systems that may be difficult or impossible to observe in real life. It also allows for the manipulation of variables and conditions, making it easier to understand the underlying principles and behavior of the system. Additionally, numerical simulation can save time and resources compared to conducting physical experiments.

4. What are some common challenges when working with source codes for numerical simulation?

One of the main challenges when working with source codes for numerical simulation is ensuring their accuracy and reliability. A small error in the code can lead to significant discrepancies in the results. Additionally, understanding and debugging complex source codes can be time-consuming and requires a strong background in programming and mathematics.

5. Are there any resources available for learning about source codes for numerical simulation?

Yes, there are many resources available for learning about source codes for numerical simulation. Online tutorials, textbooks, and workshops are all great options for gaining knowledge and improving skills in this area. It is also helpful to collaborate with other scientists and programmers who have experience with numerical simulation and source codes.

Similar threads

  • Programming and Computer Science
Replies
7
Views
651
  • Programming and Computer Science
Replies
29
Views
5K
  • Programming and Computer Science
2
Replies
59
Views
5K
  • Programming and Computer Science
Replies
13
Views
3K
  • Programming and Computer Science
Replies
14
Views
4K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
2
Views
1K
  • Nuclear Engineering
Replies
26
Views
4K
  • Programming and Computer Science
Replies
6
Views
2K
Back
Top