Fortran Definition and 876 Threads

  1. D

    Comp Sci Fortran: How to work out if 3 variables make a right angled triangle

    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...
  2. Z

    Fortran [FORTRAN] Strange Characters in output

    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...
  3. S

    Fortran [Fortran] Bad Programming Practices

    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...
  4. D

    Fortran Divide an Array into a Scalar in FORTRAN: Get Help Here!

    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
  5. P

    Fortran [Fortran] String variable for output filenames

    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...
  6. D

    Fortran Help in Fortran: Get Assistance to Solve Integer Overflow Error

    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...
  7. R

    Fortran Why is Fortran running much slower on Linux?

    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...
  8. D

    Fortran Fortran: Creating a sequence with constraints

    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...
  9. S

    Fortran [Fortran] Problem with subroutine

    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...
  10. N

    Fortran FORTRAN - SUBST help and error

    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...
  11. A

    Fortran Troubleshooting Fortran Errors: How to Fix Code Compilation Issues

    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...
  12. C

    Fortran Fortran: determine the horizontal distance of a ball

    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...
  13. P

    Fortran Fortran: specification statement cannot appear in the executable section

    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...
  14. U

    Fortran Automatic array allocation in Fortran 95?

    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...
  15. J

    Fortran Solving FORTRAN Strange Issue with Iteration Program

    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 (*,*)...
  16. A

    Fortran Fortran: opening variable file names

    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...
  17. A

    Fortran What is the correct way to assign a bound of magnitude 10**270 in Fortran?

    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...
  18. Y

    Fortran Storing Data in Fortran: Solving the File Replacement Problem

    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.
  19. A

    Fortran How can I fix incorrect output from my Fortran subroutine for a test matrix?

    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...
  20. R

    Fortran Fortran Help. Reading space delimited floats

    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...
  21. Q

    Fortran Fortran code for spins in heisenberg hamiltonian

    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
  22. D

    Fortran Getting Started with Fortran: Questions & Answers

    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...
  23. T

    Comp Sci How to Search and Replace Values in Fortran Arrays?

    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...
  24. D

    Fortran Help with Fortran Programming for .txt File Reading

    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...
  25. F

    Fortran Problem on reading dataset with variable decimal places as it is using fortran

    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)...
  26. T

    Fortran Fortran Help: Matching Data and writing values

    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...
  27. S

    Fortran Fortran Help - Do loops not calculating.

    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...
  28. H

    Fortran Why fortran program produces different values, when used as a subroutine ?

    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...
  29. R

    Fortran How to Compile and Run Fortran Programs in Eclipse?

    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...
  30. R

    Fortran What do I need to create FORTRAN programs?

    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...
  31. F

    Fortran [Fortran] problem on reading the csv file

    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...
  32. H

    Fortran How to read Symbolic equations from a file in fortran ?

    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...
  33. A

    Fortran Top Free FORTRAN Compiler for CFD Applications

    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.
  34. E

    Fortran Fortran OpenMP parallelization and writing in multiple files.

    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...
  35. T

    Comp Sci FORTRAN 90 Tracking cumulative emissions read in as annual emissions from a txt file

    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...
  36. T

    Fortran FORTRAN 90 Unexpected Statement Function Statement in Nested Do Loop

    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...
  37. M

    Fortran Optimizing Steepest Descent in Fortran: How to Find the Optimal Step Size?

    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...
  38. T

    Fortran New to FORTRAN, Error message I don't understand

    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...
  39. W

    Fortran Issues with porting Fortran code

    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...
  40. G

    Fortran Compiling fortran on portable device

    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...
  41. I

    Fortran FORTRAN program for harmonic series sum

    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...
  42. P

    Fortran Type mismatch problem FORTRAN 77

    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))...
  43. V

    Fortran [Fortran] Passing elements of array to subroutine

    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...
  44. D

    Comp Sci Finding the perimeter of evolving objects in Fortran

    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...
  45. T

    Fortran Fortran 90: dinamic matrix valued function as argument

    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...
  46. G

    Fortran Programming trouble with fortran optimization code

    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...
  47. K

    Fortran Fortran code conversion into Excel VBA

    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...
  48. S

    Fortran Need some help with dynamic memory allocation in Fortran

    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...
  49. E

    Fortran Use C functions with Watcom Fortran

    Is there a way to use C functions from Watcom Fortran?
  50. I

    Fortran Fortran intrinsic functions source code

    Hi How can I see the source codes used for defining intrinsic functions in Fortran 90/95 ? e.g. what is the actual program for sqrt ? thanks
Back
Top