Learn Fortran: Best Way, Textbooks & Resources

  • Fortran
  • Thread starter loourr
  • Start date
  • Tags
    Fortran
In summary, the best way to learn Fortran may be to find a good textbook and then use online resources.
  • #1
loourr
7
0
I've recently found myself in a situation where I need to know Fortran at a fairly decent level. A professor has asked me to translate a large amount of his old Fortran code into C++, and knowing no Fortran at all I excepted the task. I do however consider myself a competent C++ programer. So my questions are,

What is the best way to Learn Fortran?

What are some good textbooks?

online resources?

Thanks
 
Technology news on Phys.org
  • #2
Do you know which version of Fortran the code was written in? Fortran 90 and later have features that don't exist in Fortran 77, so if the code is F77 you should probably avoid F90 resources so that you don't waste time with stuff that you won't have to deal with.
 
  • #3
It is Fortran 90, also any comelier suggestions or IDE's?
 
  • #4
The standards seem to be:
Fortran 90/95 Explained by Michael Metcalf and John Reid or
Introduction To Fortran 90/95 by Stephen Chapman

Some notes here - http://www.mcs.anl.gov/~itf/dbpp/text/node82.html

http://www.nsc.liu.se/~boein/fortran.html

An introduction to programming in Fortran 90
http://www.dur.ac.uk/resources/its/info/guides/138fortran90.pdf

F90 manual - http://smdc.sinp.msu.ru/doc/Fortran90UsersGuide.pdf


There seem to be a lot of folks converting F77 or F90 to C++. Someone should write a textbook. Meanwhile - http://www.math.utah.edu/software/c-with-fortran.html

There maybe be some converters out there, but I don't know of any.
 
Last edited by a moderator:
  • #5
Actually, I would question the reason to translate from Fortran 90 to C++ or to anything else for that matter...what's wrong with Fortran 90? There is a reason why Fortran is still very much alive over 50 years after it was born.

One reason I can think of why such professor may want to translate is simply because his/her resources (students) probably don't know Fortran right off the bat and, hence, he/she cannot use them...sad.

Other than that, you should have a set of input and corresponding output files that tell the programs behaviour...then, when you have your C++ program, you should be able to produce the same results.

Actually, there have been such program that translate from fortran to c, it is called f2c.
 
  • #6
As to the reason, the professor has a book with online code written in Fortran and he wants to offer it in both languages.
 
  • #7
gsal said:
what's wrong with Fortran 90?

Personally I can't think of anything that's right with F90, except the fact that most F77 programs will compile with only a few minor changes.

Maybe it's part of a cunning plan to disable all Fortran programmers by giving them RSI from all the non-value-added extra typing involved?

Do we have any quiche-eaters who can explain exactly why
REAL(KIND=8) DIMENSION(10,10) :: X
is "a better programming language" than
REAL*8 X(10,10)
?
 
  • #8
gsal said:
Actually, I would question the reason to translate from Fortran 90 to C++ or to anything else for that matter...what's wrong with Fortran 90? There is a reason why Fortran is still very much alive over 50 years after it was born.

One reason I can think of why such professor may want to translate is simply because his/her resources (students) probably don't know Fortran right off the bat and, hence, he/she cannot use them...sad.

Other than that, you should have a set of input and corresponding output files that tell the programs behaviour...then, when you have your C++ program, you should be able to produce the same results.

Actually, there have been such program that translate from fortran to c, it is called f2c.
There is a lot of legacy code written in FORTRAN (F77 and F90). Then there was F95. And there was supposed to be new standard - but that got delayed.

http://www.ibiblio.org/pub/languages/fortran/ch1-1.html
http://www.fortran.com/forsaga.html
http://fortranwiki.org/fortran/show/Fortran+History

"Fortran 2003 and 2008 fix the most glaring deficiencies, such as standardized C interoperability and better string support." I believe OOP was also addressed.
Ref: http://fortranwiki.org/fortran/show/Object-oriented+programming


One capability now needed is to be able to handle large problems (e.g., large systems of coupled nonlinear PDEs and ODEs on thousands or millions of elements) on clusters of workstations or large multi-processor supercomputers. Large multi-physics problems are handled with massively parallel computation.
 

Similar threads

Replies
1
Views
3K
Replies
3
Views
2K
Replies
1
Views
3K
Replies
4
Views
1K
Replies
5
Views
2K
Back
Top