Homework Statement
I have a program which will sort out three inputted variables into order from lowest to highest. I now must get the program to work out if these 3 values could be the sides of a right angled triangle.
Homework Equations
I am going to use a^2+b^2=c^2 to solve...
Hi, I am trying to compile a code that should work fine, but I am getting errors and also some odd characters are printing on the screen. This is the output:
ENTER INPUT FILE NAME (INCLUDE EXTENSION NAME)
blisw.inp
YOUR INPUT FILE IS
blisw.inp...
I'm updating some particle physics code from Pang's An Introduction to Computational Physics. It looks like he updated F77 code to F90, but kept a lot of iffy practices in like putting all of his functions, subroutines, and modules into one file without the use of a contains.
What I'm aiming...
How can i divide elements of an array into a scalar. I mean, i have read my data file into a matrix in FORTRAN which this matrix is 1*3414. Then, I want that each elements of this matrix is divided to (24480*2).
I will be so grateful if you guide me the appropriate function.
Thanks a lot
This is the troublesome part
eLeftOutFile = 'data/ElonL'//fileNameSuffix(0:25)//'.dat'
OPEN(754,FILE=eLeftOutFile,STATUS='REPLACE',ACCESS='SEQUENTIAL')
First off, fileNameSuffix is a CHARACTER(len=40) just to be safe, I am just cutting it off, since those are the relevant parameters...
Hi,
i am truing to generate a matrix of my big file in which each line must be assigned as a vector into a matrix. on the other word, i have a big file by 24480 row and 6828 column, so i want to define that each row is been as a vector in a big matrix. using below program i was facing by an...
I have a Fortran95 program that I run on my Windows laptop (i7 2.0Ghz); its in serial, so its running on one thread, which seems consistent with task manager results (12.5% processor usage), so I figure it should be using ~1 ghz. I am compiling using the standard one that came with my F95...
I'm trying to write a program in fortran that will create a sequence of numbers (starting with a number that I input) that follow the following constraints: If the number (n) in the sequence is even, then the next number in the sequence will be n/2. If the number (n) in the sequence is odd, then...
Hello everyone ;
I have tried to run a program which has many subrotines so I control each of them.But, when I run one of them, the below error message is seen;
/tmp/ccMqKR9L.o: In function `MAIN__':
getg0.f:(.text+0x73c): undefined reference to `readin_'
collect2: ld returned 1 exit status...
Hi,
I am new to FORTRAN and trying to debug/compile some code passed on to me.
2 questions:
- What purpose does SUBST or DSUBST serve?
- When I run my Makefile I keep getting the following error:
'PGF90-S-0026-Unmatched quote'
According to the PG manual this translates to 'Integer...
Dear all,
I'm write code in Fortran language when compile my program I got error message :
forrtl: severe (71): integer divide by zero
Image PC Routine Line Source
f0511 00000000007536A5 Unknown...
Im writing a program to determine the horizontal distance of a ball but getting this error:
Y(t)=Y0+VY0*t+(1/2)*g*t^2
1
Error: Unclassifiable statement at (1)
Distance=(X(t))^2+(Y(t))^2
1
Error: Unclassifiable error at (1)
My code is as follows:
PROGRAM...
Hi guys,
I am working on a Fortran code for a while. Might seem ridiculous but to better trace it, I split code into three separate parts and trying to compile both using the command 'ifort ss.f singpot.f SNGPOT.f -o ss'. With this command I receive the error
singpot.f(22): error #6236: A...
The following code seems to run ok under fortran 95 (g95 compiler), but I was unsure about the exact nature of the array assignment. As you can see it is a variable sized array, without any explicit "allocate" command. The code works even when the array size could not be known at compile time...
I have a simple iteration program that does something I can't explain. It has to do with the use of if then statements. I can't see why this change would change the outcome. Here are the 2 examples:
This works:
if (guess.eq.target) then
lp=3
write (*,*)...
I am trying to write code so a 2-d array is written to the hard drive (which is later to be read). There are several do loop iterations and I would like the file name to change with every iteration so I get as many files as there are loop iterations. I get one 1-d array that is named A, no...
I want to find a bound for around magnitude 10**270 which is within bounds of double precision but I get
DOUBLE PRECISION :: bound = 10**270
Error: Arithmetic overflow at (1)
.\q2.f03:70.4:
where 1 is beneath the first *.
I am sure it is something simple I am overlooking...
I was looking for a fortran code wherein the stored file in DAT file will be stored once I run the program again. My program is just replacing the saved file.
Hi all,
So I have a program that calls a module that contains a subroutine so I can make a matrix.
When I write the matrix in the subroutine (commented out part in module) I get the right output, but when the main program tries to output it is some insanely small or large numbers.
I am new to...
Hi all, long time lurker: finally have a question I couldn't find already answered.
I'm doing some work with Fortran95 for a research project, and I'm a complete noob, so pardon me. The issue is that I have some data I'd like to read from a text file in double precision that is between 7 and...
hi friends. i don't know how can i write a fortran code for expressing spins in Heisenberg model which have 3 dimension spin operator, sx,sy,sz?
thanks for your help
I am ust beginning a fortran assignment, where I need to get a users input, to get numbers and a true/false statement. These I'm hoping will be able to translate to parameters for a bigger program. So far my code looks like:
integer N,l,Tsteps
logical PBC
print*,"Input Number"
read...
hi i have two data sets one(data1) containing
3
8 2 1 5 7 9
9 2 2 5 7 7
10 3 6 6 6 6
and other(data2) containing
5
1 10
5 20
7 30
6 40
9 50
now i want my program to search the values 1 5 7 9 from (data1) in data 2 column 1 and then take the average of the...
Hi everyone
I am new to Fortran, I am trying to write a program to read a .txt file in which i have 24480 rows and ~ 6000 columns.
In each row (as individuals) i have genotypes indicated as 1 and 2, which if, for example, in row one, i have had 204 genotypes, first half of this genotypes...
Hi all,
I have attached my text file(tab delimited).
I am planning to read those dataset into real array of (30,38). The dataset has variable decimal places like 312.66, 0, 535.696 ,456122.758.
With the following codes,
READ(12,*)((X(I,J),I=1,30),J=1,38)...
hi
i have two file with following data
file-1 (named: xyxp.dat)
6
1 1 0 10
3 2 1 5
3 5 4 8
0 0 0 11
1 2 5 4
5 6 4 12
file-2 (named: xyzn.dat)
6
1 0 0 0
2 1 1 0
3 3 2 1
4 1 2 5
5 3 5 4
6 5 6 4
now i want to match each value of the first three columns of file -1 with the corresponding...
Hello all,
I am working on a Fortran90 code that will give me an approximation of a few mathematical constants. My code will compile and run, however, my outputs are given as 0.000000 for all constants that I am calculating in the loops. Any help would be greatly appreciated. My code is as...
Hello
fortran users
I, have a problem regarding values that my program produces. Let me detailed it to you.
See, i have createrd a separate fortran program to calculete area under a given function i.e.
it perfroms integration. When this program runs independently it gives me area of the...
Hi guys. I want to write fortran programs in eclipse. All I have done so far is install eclipse with Photran (which according to google should allow me to). What do I need to do now to be able to compile and run a sample code?
I am trying to run this:
program hello_world
implicit none...
So I am an Aerospace engineering student and we are learning FORTRAN right now (you can all thank Boeing for that). I had gotten used to writing in Visual studio with the nice visual debugger and compiler. Unfortunately I can't seem to find a student version of the FORTRAN debugger for VS, so I...
hi.
I have a csv file name Relative which has 24 different data set containing characters as well as numbers. It looks like
Date,Hour,Min (RH),Max (RH),Avg (RH)
2012-08-28,0,85.190,87.200,86.325
2012-08-28,1,85.390,88.570,86.775
With reference to one of the thread reply in this forum...
How to read Symbolic equations from a file in fortran ??
I am working on Linux platform. I have a very big equation about two pages. I want to put that equation in a file.txt and then i want my FORTRAN program to read the equation from file.txt instead of making any function or subroutine...
Hey PF, I'm looking for a free and reliable compiler for FORTRAN; the application will be for CFD. Unlike C++, FORTRAN compilers seem harder to find. If anyone can provide some insight besides "do a google search" that would be great, thanks.
Hello.
I'm attempting to write some data in different files (each thread write in each file), but I'm getting an error saying: 'File already opened in another unit'. I'm using the function OMP_get_thread_num() from OpenMP library in order to open individual files in individual threads.
!$OMP...
Homework Statement
I am attempting to modify an original set of code which uses a spline interpolator to plot a curve representing cumulative emissions (and its derivative annual emissions). The goal is to read in the historical emissions (from histem.txt) and then track the cumulative...
In the following code, highlighted in bold, I am using a nested DO loop to create a running sum of the yearly emissions ("emissions") read out of histem.txt, to create a cumulative emissions curve.
The code generates an "Unexpected STATEMENT FUNCTION statement for sum in cem(i) = sum...
Hello All,
I'm new to the forum and new to fortran as well.
I've been trying to create a method for implementing the steepest descent method for optimization.
I've been able to create the code for a fixed step size and it worked beaufitully, but I can not seem to be able to find the optimal...
Hi!
I am completely new to Fortran and I'm trying to compile a source code someone else has written. I get the following error:
[Error] TESTEPH.F(187); type mismatch: intg JPLEPH assigned to char*80 NAMFIL.
The code around line 187:
183 C NAMFIL IS THE EXTERNAL NAME OF THE BINARY...
I have a Fortran (F77) code which I used to use at my previous institution that I am having trouble with at my new job. I used to compile it with ifort on computers running Fedora (14 if I recall correctly). At my new job they don't have ifort so I have had to revert to the use of g77 (f77) on...
I have a fortran program I would like to run on some kind of portable device. Ideally, it would be an older and cheaper device. Does anyone have any advice?
The program takes an input from the user (which is an incorrect luminance value read from a 40 year old light meter) and feeds it...
Hi
Here is my code to get the sum of harmonic series. Harmonic series is
\sum_{i=1}^{\infty}\; \frac{1}{i}
here is the code
program harmonic
implicit none
integer :: i,n
real :: sum=0.0
write(*,*)'How many terms you want to sum ?'
read(*,*) n
do i= 1 ,n...
Hi all,
I am trying to run a long FORTRAN 77 code in my laptop. Document contains a makefile and it is instructed to use 'make pgi' command to compile. Beside many warnings, each time I enter that command, it returns me ' Return type mismatch of function 'cmod' at (1) (REAL(4)/REAL(8))...
I have one main program where I have calculated some array, say A(i,j)
If I want ot use the values in subroutine, and calculate some more values and give back the result to main program, how my syntax should be?
I tried this way. Its not working.
program a...
Hello fellows,
I am writing a computer program in Fortran, to find the perimeter of multiple squares. These squares move as "time" goes along, and if they come in contact with each other, they stick together, forming clusters. The reason why I'm doing this in Fortran is because the original...
hello, I'm trying to write a program with a subroutine that can handle array valued functions of different dimensions, I'm new to fortran 90 so i have some troubles.
Here's what i tried:
program passing
use functions
use sub_mod
implicit none
integer, dimension(2,2):: a2
integer...
Hi everyone,
I have some trouble adapting an existing fortran code for my application.
In the following Module I am optimizing a value for two planes ( i = iplan one&two).
In order to do that, I need to assign ten certain values from an external inp. file for each plane.
I have two loops...
Hi,
I'm currently working on a project that requires me to convert a Fortran code into excel vba.
There are some problems that I've stumbled into, so itll be great if someone could help out.
one of it would be on how to convert a COMMON statement in Fortran to Excel VBA ( as in how would...
Hi,
I need some help with allocating arrays dynamically.
I have an array whose size keeps changing at each step - I start with a row vector and add another row vector at each step of a cycle. I need to use this new array for further calculations.
I've been trying to declare the arrays...