Learn Fortran: Best Way, Textbooks & Resources

  • Context: Fortran 
  • Thread starter Thread starter loourr
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary

Discussion Overview

The discussion revolves around learning Fortran, specifically Fortran 90, in the context of translating existing code into C++. Participants seek recommendations for effective learning resources, textbooks, and tools, while also exploring the rationale behind the translation from Fortran to C++.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant inquires about the best way to learn Fortran and seeks recommendations for textbooks and online resources.
  • Another participant notes the importance of knowing the version of Fortran used in the existing code, suggesting that resources for Fortran 90 may not be suitable for Fortran 77 code.
  • Several textbooks are proposed, including "Fortran 90/95 Explained" by Michael Metcalf and John Reid, and "Introduction To Fortran 90/95" by Stephen Chapman, along with various online resources.
  • One participant questions the necessity of translating Fortran 90 to C++, arguing that Fortran remains relevant and effective for many applications.
  • Another participant suggests that the professor's motivation for translation may stem from students' unfamiliarity with Fortran.
  • Concerns are raised about the complexity and verbosity of Fortran 90 compared to earlier versions, with some participants expressing skepticism about its advantages.
  • References to existing tools for translating Fortran to C, such as f2c, are mentioned, along with discussions about the evolution of Fortran standards and their implications for modern programming needs.

Areas of Agreement / Disagreement

Participants express differing opinions on the necessity and rationale for translating Fortran 90 to C++. While some question the need for such a translation, others highlight practical reasons related to student familiarity and resource accessibility. The discussion remains unresolved regarding the merits of Fortran 90 versus C++.

Contextual Notes

Some participants note the historical context of Fortran's evolution, mentioning legacy code and the delayed introduction of newer standards. There is also mention of the need for modern capabilities in handling large computational problems, which may influence the choice of programming language.

loourr
Messages
6
Reaction score
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
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.
 
It is Fortran 90, also any comelier suggestions or IDE's?
 
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:
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.
 
As to the reason, the professor has a book with online code written in Fortran and he wants to offer it in both languages.
 
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)
?
 
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
16
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 24 ·
Replies
24
Views
6K
  • · Replies 397 ·
14
Replies
397
Views
21K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K