What is Fortran: Definition and 875 Discussions

Fortran (; formerly FORTRAN, derived from Formula Translation) is a general-purpose, compiled imperative programming language that is especially suited to numeric computation and scientific computing.
Originally developed by IBM in the 1950s for scientific and engineering applications, FORTRAN came to subsequently dominate scientific computing. It has been in use for over six decades in computationally intensive areas such as numerical weather prediction, finite element analysis, computational fluid dynamics, geophysics, computational physics, crystallography and computational chemistry. It is a popular language for high-performance computing and is used for programs that benchmark and rank the world's fastest supercomputers.Fortran has had multiple versions, each adding extensions while largely retaining compatibility with prior versions. Successive versions have added support for structured programming
and processing of character-based data (FORTRAN 77), array programming, modular programming and generic programming (Fortran 90), high performance Fortran (Fortran 95), object-oriented programming (Fortran 2003), concurrent programming (Fortran 2008), and native parallel computing capabilities (Coarray Fortran 2008/2018).
Fortran's design was the basis for many other programming languages. Among the better-known is BASIC, which is based on FORTRAN II with a number of syntax cleanups, notably better logical structures, and other changes to work more easily in an interactive environment.As of June 2021, Fortran was ranked 17th in the TIOBE index, a measure of the popularity of programming languages, climbing 17 positions from its ranking of 34th in January 2020.

View More On Wikipedia.org
  1. A

    Comp Sci What could be causing a segmentation fault in this Fortran function?

    1. I have a segmentation fault when I try to run a program I have written in Fortran. The compiler I used is gfortran. What typically causes a segmentation fault, and how do I find where the problem is? I know I should use a debugger, but I don't know which debugger I should use, how to get it...
  2. L

    Fortran Fortran 95 question about dimension error

    error 542, J appears in the dimension of a variable,yet is not a dummy argument,a variable available through USE or CONTAINS association,a COMMON variable,a PARAMETER,or a PURE FUNCTION the same error about I i am using i,j in order to point the temperature in length and time T(i,j) it is a...
  3. N

    Fortran Differential equation in fortran

    I need to do numerical computation by fourth order Runge Kutta Algorithm in fortran. But I stuck in programming because the differential equation contains imaginary part. Take for e.g. the set of diff.equation are x'=(i)y *exp(iwt) ;where i is imaginary no. and w is constant...
  4. O

    Help Needed: #Game in Fortran - Newbie Asks for Assistance

    Hello, I'm from Brazil, and at my university the teacher told me to do a hashtag(#) game, built in Fortran, but I started to use this a few time ago, so I don't know how to do that! I need to do that, the faster that I can and I hope a hand from you guys. Thank you so much, Danilo.
  5. C

    Fortran Trouble with format in fortran

    Hi all I am trying to use fortran to write a .pvd file, an example of what one line of such a file should look like is <DataSet timestep="1.00000E-07" part="0" file="Psb000001.vtu"/> however with the following code: write(90,2000) ttim,fname 2000 format('<DataSet...
  6. fluidistic

    Fortran Goto statement, mostly regarding Fortran

    Hey guys, I've read that Borek (a member here) was told that the goto statement was "bad" during the 80's. I myself did some research on the Internet about that and it seems that: 1)Fortran used to have the goto statement up till Fortran 90. 2)It has been eradicated since Fortran 95. 3)In...
  7. B

    Fortran Fortran program can't find input file

    My gfortran compiler gives me the following message when I try to open a file in order to read it:Fortran runtime error: No such file or directory logout The line in the program where this file is is written in this way: OPEN(UNIT = 7, FILE = 'GPROP.DAT', STATUS = 'OLD')...
  8. H

    Choosing a Degree: Physics/Astrophysics & Fortran

    Which one is better for a physics/astrophysics major? I will be taking Fortran as well.
  9. Saladsamurai

    Fortran How to Avoid Leading Whitespace When Writing to a Text File in FORTRAN?

    I am writing to a text file and a do not want any leading whitespace on each line. I have been trying the Write(*,'(a)') statement. This works just fine: Program MyTest Open(2,File = 'testFile.inp') Write(2,'(a)')'DIAG' Write(2,'(a)')'REAC C2H4F2 2.00000000000' Close(2) End However, the...
  10. fluidistic

    Fortran Fortran 90. Euler and Runge-Kutta's method

    I've successfully (well I think so) made 2 different programs that can numerically solve an ODE using Euler and Runge-Kutta's methods. Here they are: program test implicit none real(8)::a,b,h,y_0,t write(*,*)"Enter the interval a,b, the value of the step-size h and the value of y_0"...
  11. F

    Fortran Reading a file repeatedly in each iteration of a do loop in fortran

    Hi everybody, I have just joined this forum and I have a problem in fortran programming. I want to do a program in fortran where in the do loop it will read an input file from the first line upto a line and again it will go to the starting line of the file in the next loop and read...
  12. N

    Fortran FORTRAN 90 command line arrgument

    Hi All, I am very new to FORTRAN Programming. The problem is related to commandline argument. i have a executable program which take 3 command line argument as an input. one is text file and two is variable. I want to write a script were i can execute this script and save in different file and...
  13. Saladsamurai

    Fortran FORTRAN: I have no idea what is happening

    I am freaking out man :smile: I have this program and in it I have the variable nPT declared as Integer. Somehow, after nPT is passed to subroutine, its value changes to a very large negative integer value. I cannot make sense of it. In the subroutine pasted at the bottom, the value of N (which...
  14. fluidistic

    Fortran Fortran, interpolating polynomial program doesn't compile

    I want to interpolate a set of points (x(i),y(i)) for i=0, n; using Newton's polynomial of degree n. I've Kincaid's book of numerical analysis. He gives an algorithm that doesn't make entirely sense to me. He says for i=0, n do di <- f(xi) end for j=1, n do etc. Basically I'm stuck...
  15. Saladsamurai

    Fortran Why are there Two Ways to End a 'Do' Loop in Fortran: 'End Do' vs 'Continue'?

    Can someone tell me why there exist 2 different ways of indicating the end of a 'Do' loop? Is one advantageous over the other? Or is one just an older way of doing it? What do you tend to use?
  16. Saladsamurai

    Fortran FORTRAN: Basic Question about declaring variables

    If you call a subroutine from the MAIN code, is it standard to declare the variables used in the subroutine in the subroutine itself or in the main code? My gut tells me the former, but the horrendously written code before me tells me the latter. Any thoughts?
  17. D

    Fortran Input a polynomial into FORTRAN?

    Input a polynomial into FORTRAN? Hello all, I took a Fortran programming class last semester and can write Fortran well. However, I never recall anyone ever asking if there would be a way to input a polynomial into the command prompt. I'm assuming there is not. It would be great though. I have...
  18. fluidistic

    Fortran Fortran 90, problem with reading a file

    Here's a part of my program in which I'm having an error while compiling: open(unit=1,file="tabla.dat") allocate (x(n),y(n),f(n)) do i=0,n x=(2*i)/n-1 f=1/(1+25*x**2) write(1,*)x,f end do do i=0,n read(1,*)x(i), y(i) end do close(1) I'm having the error with gfortran: "Fortran runtime error...
  19. B

    Fortran Fortran functions as arguments of functions

    Hi all, It is my first time to resort to the help of members of this forum :) My question is related to programming in fortran but I am rather new with it. So here is the question:Can I use user defined functions as arguments of a user defined functions in Fortran? I have written a simple...
  20. B

    Fortran Fortran Compiling Help: Balaji's Physics Forum Inquiry

    Dear Physics forum I tried to compile fortran program using the command "g77-ffree-form program.for", while compiling it shows following error. C:\Documents and Settings\Balaji\Desktop\Fortaran>gfortran -ffree-form program.f or program.for:1.64...
  21. M

    Fortran How to solve iteration issues in FORTRAN 90 and allocate values for later use?

    I have problems with my code.As a result of calculation I got rank2 l(21,1) array.Due to the THE ITERATIVE PROCESS I will get the same array in every iteration.How to allocate values and use them later.Should I create new array like do iter=1,n lbig(iter,nmax,1)=l(nmax,1)?
  22. M

    Fortran How can I store values for every iteration in FORTRAN 90 using arrays?

    Well the issue here is that I will have 21 numerical values written into one array,but then goes iterative procedure and get 21 values for model 2.How to write l(m0),l(m1)?I will need these arrays later for calculations.
  23. T

    Fortran Solving Fortran Lapack Compilation Issues

    Can you please help me I can't compile using lapack libraries and I can't find anyone who can tell me how to compile. I have blas_LINUX.a and lapack_LINUX.a and I am trying to use ifort to compile my program but I always get the below error. Please help. These are the libraries I have in...
  24. M

    Fortran Join 2 FORTRAN Codes: Problem Solved w/ Intel Compiler & Linux

    I have a problem,actually I want to join two FORTRAN codes.One of them is main and the other calculates some issues(geophysics stuff).I am not sure that the second code can be represented as subroutine because it has 2000+ lines,with 10 subroutines inside itself.How to solve this?Is it possible...
  25. D

    Comp Sci Fortran 77 reading from text file, printing

    Homework Statement Write a program that reads the time, temperature, pressure, and volume measurements from a data file like : 0900015001990700 1000019602210877 1100021202790925 1234034203221015 1300038803221121 1400044803241425 1503051303201520 1604055503181665 1700061303191865...
  26. fluidistic

    Fortran Fixing Goto Error in Fortran 90 Program

    I don't understand why I get an error when I use the goto "command" like this: (...) goto 11 (...) 11 end program ---------------------------------------------------------- The (...) represent the other part of my program. I tried to change the place of the 11. Because if I...
  27. D

    Fortran FORTRAN 95 Problem - junk error

    I have a 3D ising model simulation, what i am trying to do is look up each column in the array and if all the values of that column are -1 then i wish to write the i and j coordinates of that column to a file. the section of code I am having problems with is: OPEN (10, FILE='holes.dat')...
  28. E

    Comp Sci Fortran 2d arrays/connect 4 game

    Hi, i have an assignment to make a code for a connect 4 game,using module and subroutines, but as of now I am stuck, and do not now where to go. Any help would be great. here's what I have so far. I'm stuck on how to declare where the X's and O's will show up and how to determine when 4 in a row...
  29. D

    Fortran Hide User Input in FORTRAN 95: Solve Password Problem

    This might be a stupid question but my TAs in my lab could not answer it so I thought I would try to ask it here. What I want to do is for the user to enter some string of characters for something such as a password and for the input not to show up on the screen or for it to be replaced by...
  30. S

    Fortran What are the Differences Between Fortran 77 and Fortran 90?

    Hi All, I have an interview concerning Fortran programming. Actually one section of the interview will be on Fortran programming. First, i am trying to get differences between Fortran 77 and Fortran 90 and have the following questions. The differences are: 1) Control Structures...
  31. S

    Fortran Learning Fortran: Compilers, Debugging & More

    Hi guys Im quite proficient when it comes to Matlab, and am now scheduled to learn Fortran 90/95 for a PhD-project (OS: winXP/win7) and I want to ease the transition as much as possible. I have been scouring the internet to learn more about what I am faced with and one thing keeps bugging me...
  32. C

    Solving Diffusion PDE By Finite difference Method in fortran

    Hey, I want to solve a parabolic PDE with boundry conditions by using FINITE DIFFERENCE METHOD in fortran. (diffusion) See the attachment for the problem The problem is that there is a droplet on a leaf and it is diffusing in the leaf the boundry conditions are dc/dn= 0 at the upper...
  33. C

    Solving Diffusion Equation By Finite difference Method in fortran

    Hey, I want to solve a parabolic PDE with boundry conditions by using FINITE DIFFERENCE METHOD in fortran. (diffusion) See the attachment for the problem The problem is that there is a droplet on a leaf and it is diffusing in the leaf the boundry conditions are dc/dn= 0 at the upper...
  34. Q

    Fortran How to Compile Fortran Code on Mac and Unix Systems?

    I have several fortran code files which can be correctly compiled and run in Windows XP using gfortran. But, when I use the gfortran 4.2.1 compile these files on Mac(10.6), the code files can be compiled, but, it reports errors when I run the compiled file. the error is related to the...
  35. C

    Fortran Understanding Fortran Memory & Page Usage

    Hello, I am am confused about how fortran code is being executed and how are the variables in the memory updated during the execution. My code in simple terms looks like this: give some values to a matrix psi(lx,ly) (initialization) main loop do n=1,nend nt=psi^3 make Fourier...
  36. T

    Fortran Simple Fortran Program Help: Calling Precision Function | Program Alpha

    Hello, I'm writing a really simple program in fortran which is a part of a bigger program. It is not working at the moment, but I really don't know why. I am calling a function called precision, but the program does not enter it ( I know it since I use write statements inside). I compared...
  37. A

    Fortran Fortran, subroutine with allocatable, intent(out) array

    Hi, I have a rather large program written in fortran 77/90. In one of the subroutines a lot of local dynamic arrays are declared. In order to make this program able to calculate more stuff, I need to bring these dynamic arrays back into the main program. I have tried to define the...
  38. M

    Fortran Solving FORTRAN 90 2D Arrays Program Pr2

    program pr2 implicit none integer:: i,j real, dimension(21,80) :: istat open(7,file='sens.dat',status='old',action='read') read(7,*)((istat(i,j),i=1,21),j=1,80) write(*,*)istat end Where is the problem?Input file has 1680 values.But I get...
  39. S

    Fortran Where can I find a demo or trial of LF95 fortran compiler?

    I have a fortran program and need to compile it with LF95 (Lahey/Fujitsu fortran 95). Anyone knows where to download a demo or trial version of LF95? Or if you can upload to rapidshare or megaupload or send me a private message. That would be very helpfull.
  40. W

    Fortran Help with declaring arrays in Fortran 90/95

    I have an assignment to calculate the least squares fit line to a set of points, and I have to read in an arbitrary number of points from the user So my plan was to have the user enter how many elements they have, and then create an array with that many elements. So let's say I read the...
  41. S

    Fortran Fortran: Pointer to array section with vector subscripts

    Hi. I'm trying to make a pointer point to sections of a rank-2 array given by specific values of it's second index. I other words: given a table I wan't a pointer to point to specific columns, making of it a "filtered" table. The method I was trying was like DOUBLE PRECISION...
  42. M

    Fortran Fortran Transpose: Transform a 4D Array into 2D

    Here is the problem.I have this array zmdsens(iper,i,1,iprd) where iper is period,i site,1 mt function and iprd conductivity.This array stores MT functions for all above mentioned.I need tot find transpose of MT function,but fortran 90 can easily do that only with 2dimensional arrays.How to...
  43. A

    What programming languages are used in computational astrophysics?

    Hi, just wanted to know which version of FORTRAN is best to learn for one studying astrophysics...and whether C++ is of any importance in computational astrophysics...Thanks
  44. X

    Fortran Silverfrost FTN95, Programma written in Fortran and giving error 299

    Hello everybody.I have a problem with a program I wrote in Fortran.The program is this and it is giving me the error 299 at line 4(parameter (n-100001)) saying -Statement ordering error - PARAMETER cannot appear after executable statements. What can I do to fix the problem?? :-( program...
  45. N

    Fortran Which Fortran Compiler is Best for Windows and Linux?

    Any suggestion for a windows Fortran compiler? I've seen many around but it is somewhat difficult to choose when you don't know much about the subject! If you have any suggestion for Linux feel free to add them anyway! Leo
  46. C

    Fortran Strange results using dgesv (lapack) via fortran 90

    Hello all, I am trying to learn fortran 90 by rewriting some simple MATLAB codes I have in fortran. I tried to rewrite a linear, 1D finite element code for an elliptic equation and my fortran and MATLAB codes both end up assembling the same system matrixes (K and f), but the solution to...
  47. C

    Comp Sci I don't understand logical variables in fortran

    I found the following program in a textbook and I don't understand how logical variables are used for the sorting function. I understand that variables is supposed to tell the program to keep functioning until the sorting is complete, I just don't understand the specifics. The logical variable...
  48. A

    Fortran What is the Syntax for Reading a Dataset in Fortran 90?

    I feel somewhat embarassed to ask for help concerning this. I am a C/C++ programmer, but I am currently learning Fortran 90 on the fly and in a hurry. I am going to have to read in a 32x25600 dataset into a 1-d array (I know, not especially efficicent). I decided to start with a more...
  49. J

    Fortran Fortran 77 - subroutine in separate file

    Hi all I am currently using subroutines, and placing them at the end of the main program. However, I was wondering if it is possible to save them to a separate file, which the main program then calls? For example, in the program below I call the subroutine 'SUB', which is located at the end of...
  50. T

    Fortran Fortran: Problems with dummy variables in functions

    I have a function that seems to be ignoring the first of 3 dummy variables. These variables are arrays with integer elements, should that be important. For example, the call in the program is something like: A = F(b,c,d) and this transfers control to a function F, that is similar to...
Back
Top