Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Learning Fortran!

  1. Jun 9, 2012 #1
    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 text books?

    online resources?

    Thanks
     
  2. jcsd
  3. Jun 9, 2012 #2

    jtbell

    User Avatar

    Staff: Mentor

    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.
     
  4. Jun 10, 2012 #3
    It is Fortran 90, also any comelier suggestions or IDE's?
     
  5. Jun 10, 2012 #4

    Astronuc

    User Avatar

    Staff: Mentor

    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 [Broken]

    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: May 6, 2017
  6. Jun 10, 2012 #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.
     
  7. Jun 10, 2012 #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.
     
  8. Jun 10, 2012 #7

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

    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)
    ?
     
  9. Jun 10, 2012 #8

    Astronuc

    User Avatar

    Staff: Mentor

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Learning Fortran!
  1. Learning FORTRAN (Replies: 1)

  2. Learning Fortran (Replies: 1)

Loading...