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.
 

1. What is Fortran and why should I learn it?

Fortran is a general-purpose, high-level programming language that has been used for scientific and numerical computing since the 1950s. It is still widely used in fields such as engineering, physics, and economics due to its efficient handling of mathematical computations. Learning Fortran can give you a competitive edge in these fields and open up job opportunities.

2. What is the best way to learn Fortran?

The best way to learn Fortran is by practicing and working on projects. Start with the basics of the language and gradually move on to more complex concepts. It is also helpful to read code written by experienced Fortran programmers and to participate in online forums and communities to ask questions and get feedback on your code.

3. Which textbooks are recommended for learning Fortran?

There are several textbooks available for learning Fortran, such as "Modern Fortran Explained" by Michael Metcalf, "Fortran 95/2003 for Scientists and Engineers" by Stephen J. Chapman, and "Fortran 90/95 for Scientists and Engineers" by Brian Hahn and Daniel Valentine. It is important to choose a textbook that matches your learning style and covers the version of Fortran you want to learn.

4. Are there any online resources for learning Fortran?

Yes, there are many online resources for learning Fortran, such as tutorials, video lectures, and interactive coding platforms. Some popular websites for learning Fortran include Codecademy, Coursera, and the Fortran Wiki. It is also helpful to join online communities and forums where you can interact with other Fortran programmers and learn from their experiences.

5. Is Fortran still relevant in today's programming world?

Yes, Fortran is still widely used in scientific and numerical computing, particularly in industries such as aerospace, weather forecasting, and oil and gas. It is a highly efficient language for handling complex mathematical computations and is constantly being updated to keep up with modern programming practices. Many universities and research institutions also continue to use Fortran for their computational needs.

Similar threads

  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
12
Replies
397
Views
13K
  • Computing and Technology
Replies
3
Views
2K
  • Programming and Computer Science
Replies
24
Views
5K
  • Programming and Computer Science
Replies
10
Views
2K
  • Programming and Computer Science
Replies
9
Views
1K
  • STEM Academic Advising
Replies
5
Views
2K
  • Programming and Computer Science
Replies
2
Views
2K
Back
Top