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.
Homework Statement
I'm attempting to write a FORTRAN program that calcuates the magnetic field, B, at any point outside of a bar magnet. I will be using a simple first order euler scheme for numerical surface integration. Homework Equations
Here is the exact method I will be using...
Hello,, I want to know how to buy the Fortran software,? I use Fortran programming to simulate some my work for my study. Do you have any suggestion about that??
Dear, Everyone
I am a new member here, nice to meet you..
First, I want to introduce my self, I am a master student of physics and I am studying CFD right now. It's a new topic for me and I will also do my research about simulation of fluid dynamics related to CFD. Actually, I got this topic...
I have a simulation that involves a lot of dense linear algebra with a lot of complex arrays, that was written in python's numpy and then sped up with cython. Unfortunately I'm stuck with python's GIL (global interpreter lock), which prevents the use of numpy with multi-threaded code.
I'm...
Hi all,
I'm writing a fortran 90 program to simulate the Duffing oscillator. I have it working and have produced a cos wave which I expected for D (the driving force) being set to 0. Here's the code:
program rungekutta
implicit none
integer, parameter :: dp = selected_real_kind(15,300)...
Hi,
I have a main Fortran code (*.f90) which can calculate eigenvalues and eigenvectors using LAPACK library. Unfortunately, i can't excute this program because i can't link it to the library. I'm using Code Blocks as IDE environment. Any help please.
Hello, I'm fortran beginner. I have problem with calling or definition of functions and subroutines. I decided to establish my routine file, where I collect all functions and subroutines who I code (for now I have there function for derivative, only this works).
My first question, is it good...
Assumung adding 3 complex vectrors (cvect1, cvect2 and cvect3).
What is the difference between using command:
CSQRT(cvect1**2+cvect2**2+cvect3**2)
and command:
CABS(cvect1+cvect2+cvect3)
??
The first one produces a complex vector (real and imaginary part), but the second only the real part has a...
Homework Statement
I am working on a code that sends a 6480 x 10 data set into a 64800 line LAT / LON / DATA gridded set.
In part of my code, I'd like to have 2 conditions in 1 DO statement and I am not sure if it is possible.Homework EquationsThe Attempt at a Solution
[/B]
DO x = 1...
Hi everyone.
I'm trying to write a program that reads data from 2 files and then calculates the mean, standard deviation and standard error of both files (separate values for each). I'm struggling to get my head around simple I/O, so excuse the poor attempt, but this is what I have so far: (I'm...
Hi there. I wanted to ask this question, which is about efficiency in matrix times vector multiplication in fortran. When I have some matrix ##\hat A## and vector ##\vec{x}##, and I want to compute the matrix times vector ##\hat A \vec{x}=\vec{b}## in Fortran, what I do is, I build the array...
I'm testing a part of a code and I have a problem. After the subroutine call at line 44 (CALL ZEIGSUB), nothing is written in UNIT NRES. The other units are written correctly. Here's the code:
PROGRAM TEST
IMPLICIT NONE
complex *16, allocatable :: KSTAR(:,:), VR(:,:), CM2(:,:)
real *8...
I am using fortran 90 to solve a elliptic partial differential equation numerically(Poisson's equation) and I have encountered a underflow error. All the arrays involved are stored as real data types. The original expression is highlighted in the comments and the my attempt at refactoring into...
Homework Statement
Create two 5x5 arrays, A & B, and ask the person to fill them out. Save those numbers in matrix_a.txt & matrix_b.txt respectively. Then, save the sum and difference of those numbers in sum.txt & diff.txt respectively.
Basically we need to create two arrays, fill them out...
I have a background of undergraduate physics but I consider myself to be quite weak in programming. I'm aware of the usefulness of computational software/programming software in the sciences, particularly physics. I'd like to ask for recommendations on how to start learning fortran assuming I...
How does Fortran execute this statement?
x = 0
read(5, *, end = 10) x
if (x.eq.1) then
...
endif
10 ...
The ellipsis stands for a list of commands, i.e the 'if' condition and line 10 have several lines. I have looked in Google and if my understanding is correct, the 'read' statement will be...
Hi, guys. For my project this week I have to code a cipher, and I am just getting used to what, what with the code. The problem I am having is that I have assinged my key and instered that into the repeat function but I only get one output of maths and not seven, why is this?
program Jason...
Hi guys, I am playing around with different functions on Fortran 90. I tried to create a simply program that would take five number that I select in a do loop and write to the screen the Max number in that list and the min number in the list. My code is below along with my output:
what I...
Hi, guys I am very new to programming in fortran90 and I am just experimenting with stuff. I have been trying to get my output of my loop program to a text file. But for some reason it will not work. Could someone please advise.
Code displayed below:
PROGRAM loop
IMPLICIT NONE
integer ...
Hi there. I am working with a numerical quadrature in some scheme to solve a set of equations. At this point I am working in two dimensions. The thing is that I have some function ##\psi_m(x,y,\Omega_m)## with ##\Omega_m=(\Omega_{x,i},\Omega_{y,j})## with ##\displaystyle...
I have trouble understanding how Fortran knows the inputs and outputs of a subroutine. I am studying a code written in Fortran, but I do not have a compiler, so I cannot check how it works.
Here is my problem; for example, I have a subroutine,
subroutine test(x, y, z, a, b, c)
The variables...
Hi i have a problem in solving the maccormack algorithm for the following :
∂p/∂t+8*∂p/∂x=0,x∈(-10,10)
p(x,t=0)=e**-3x
the exact solution is u exact(x,t)=e**-3(x-8t)
I have to verify the solution with the exact solution at t=50* dt
This is what I've done so far:
implicit none...
So I am doing a chemical simulation of titans atmosphere and I have potentially 1000 data files to sort through to retrieve concentration values written in Double format. The issue is that each chemical has its own line with well over 80 columns (1993 currently, though it is subject to...
My program only requires that I take C++ or Fortran. It seems like most students I have asked are only taking C++, I'm thinking of doing both. I'm planning on asking my advisor as well, but so far I've been really underwhelmed with my meetings with him. Thoughts? Thanks in advance!
Hello
I am very new to programming and fortran. I have a text file formatted the following way:
Name Peter John Sally Joseph Luke Vader etc...
age XXXX XXXX XXXX XXXX XXXX XXXX XXXX
height XXXX XXXX XXXX XXXX XXXX XXXX XXXX
weigh...
Hey guys, I have an assignment on fortran, which basically is supposed to read grades of a class and print them in alphabetical order and wether if the student failed or passed the class. We're supposed to do everything using our basic knowledge of fortran.
When I run it it says 'integer...
The statement:
In every ABC triangle, the laws of sine (a/sinA = b/sinB = c/sinC) & cosine (c2 = a2 + b2 -2*a*b*cosC) are valid, where a, b & c are the sides opposite to A, B & C respectively.
Write a program that calculates and prints on the computer's screen, the length of c, and also the...
I am trying to calculate and draw a relation between (IL) and the Growth rate (m).
I have used Il as range from 10^15 to 10^18 in the calculation and when I draw the relation (x-axis ) is Il and (y-axis ) is m. I converted the IL to be in log scale.
I noticed unacceptable output.
So, I am...
Hi there. I'm trying to solve a linear system which I have constructed with the aim of learning how to do this in fortran. The idea is to solve:
##A\vec{x}=\vec{b}##
The thing is that when I call the subroutine degsv from lapack to solve the linear system, and then write the solution, it only...
this is bairstow's method , i need to put Newton-raphson in a subroutine and i don't know what's wrong i keep getting the wrong answer when i execute please help
parameter (np=100)
parameter (eps=1e-3)
real a(np) ,b(np),c(np)
real r ,s ,ri,si
integer n,i
write(*,*)'n,r,s'
read(*,*)n,r,s...
Hi.. I am stuck up with a double integration where one of the integration limit is infinity. I know quadpack (qagi) can handle integration over infinite intervals. But how to make it work for the double integration. Or if there is any other routine that can handle both double integration and...
i wanted to ask you after high school passing grade 12
when we do computer engineering courses like Bachelor of computer applications, Bachelor in computer science,,B of technology
we can do self study or classes is required for these courses
as computer engineering courses will have subjects...
Homework Statement
For my research we need to utilize a MINUIT (fortran based) code to compute error values.
We are working on an 'example' minuit library to further our understanding of the code. I am not well-versed in FORTRAN, but we are currently having a problem:
1. Understanding where...
This isn't really a question for which the template is useful..
Can anyone explain to me why the value of the variable 'seed' in location 1 is different from the value in location 2? The only thing happening in between is the defining of the varaible v(1) using the real function. I don't see...
Not really a question suited for the template...maybe shouldn't put this in Homework section, but it's for a class.
My write files were being weird so I started some investigating. Below is an excerpt from the code.
58 OPEN(unit=33,file='random2.txt',status='unknown')
59...
This is the line:
read(A, *) B
The variable A is defined earlier in the code. I searched around the internet, and the 'read' syntax requires an input from the keyboard. However, the syntax I saw is read(*, *) var, so the two arguments are both asterisks. What if the first asterisk is defined...
Hi there, first of all i am new to the forum, my name is Ivan and i am on 4th year of grade in Physics, i am doing my final work to finish the grade and i need some help in fortran.
The first thing is that i can't even run it, i am using windows 8, i don't know what compiler use or even how to...
I was trying to implement a variable grid mesh in Numerov's method, while playing with fortran. Numerov method was working well with a standard discretization, but when I tried to implement this variable grid, things came to look as if the 'metric' of the function were depending on the...
Hi,
I have a project for a class in numerics, where I have to write a program with FORTRAN 90 that calculates the determinant of a matrix using Laplace.
The program itself works now, but I have added a function that finds the row/column with most zeroes and reorganizes the matrix, so that they...
Hello
I have to search for a few solved examples in fortran and understand them so next week i can make a presentation and explain into the other students. It is a homework for everyone and i don't know which programm i should use. there are few homepages which have many examples but they are...
Homework Statement
Working on a FORTRAN based code for some work.
Not sure what's wrong with it.
Homework EquationsThe Attempt at a Solution
The section of the code that is causing the problem is:
OPEN( UNIT = 17,FILE='updateddata.txt',STATUS='UNKNOWN')
DO I = 1, 146
READ( 17, 703)...
Hey!
I'm currently making a program which is a three body problem. I managed to get working results which I can plot to gnuplot. The question is, how can I write this within the program itself, so it can automatically plot the information to gnuplot if the user wants it to? (I'm being lazy :P)...
I learned Fortran from ancient people who disregard modern standards. As such, my code consists mainly of that older syntax. I am wondering how well this meshes with current Fortran environments, specifically regarding double precision calculations. This comes up mainly because I have been...
Hello, I have data in file and I want to read the data into variable in fortran to save memory caculation. I want to know: When I open file inputdata, whether fortran have any notices about the way it read data into variables? (like mathematica: each open file, we just read in the order anyway)
Homework Statement
First of all, I used the Window xp & Compaq Visual Fortran 6.6 installed in VMware workstation.
In my case, there are no compile and link errors in source code, and excuting that program is also done.
But I want to generate 300 random numbers by using my program (Log-normally...
Hey so I'm getting the error message:
Euler_Method.f90:43.1:
fun=(c)(1-c)/(d+2)
1
Error: Unclassifiable statement at (1)
And here is my code:
PROGRAM Euler_Method
!-------------------------------------------------------------------
! The purpose of this program is to read in endpoints...
Hello everyone! I've been wondering if it is possible in Fortran to 'read' a function.For instance when I code this:
contains
function f(x)
double precision :: f
double precision ::x
f=(whatever the function)
return
end function
end program
It would be ideal if the program allowed...
I got a problem running my FORTRAN program in high performance computer cluster. It runs well in my PC but I want to have mass production of data with different initial conditions so I put it in a cluster node with eight cores, simulate eight sets of data.
The program can run without problem...