Hello, I need help for programming my first program in Fortran, because it doesn't run. I think it's a problem with the compiler. What do you think?
This is my code
program Steifigkeitsmatrix
implicit none
real :: E,I,l,p
real...
Hi all,
Suppose I declare X in the main program.
Then in the following subroutine:
Call example(list of arguments)
------------------------------------
subroutine example(list of arguments)
x=y+z
end subroutine
-------------------------------------
I have two options:
(a)...
Dear all,
I can not figure out why I got negative infinity in my output, so please help. Here is my calculation for FAMAX:
FAMAG=SQRT(FX**2+FY**2+FZ**2)
FAMAX=MAXVAL(FAMAG(1:NATOM))
and for FPBPMAX...
I am sitting down and working my way through a Fortran 90/95 book for a research project I will be involved in at my university in a few weeks. However, I can't even seem to get the most basic program to work even when copying the template directly from the book. It always says invalid character...
My group at work uses several pieces of legacy Fortran code which we've always compiled using Compaq Visual Fortran. Since CVF has not been supported for while now and is not (easily) compatible with Windows 7, I'd like to move to a more up-to-date compiler and IDE. I'm trying Simply Fortran...
I'm new to Fortran, trying to run this program but when I enter the variables it gives me an error 112.
Please help me find where is the mistake. I copied the program from an old book.
DIMENSION S(50),V(50) ! Element stress and velocity
DIMENSION U(51) ! Nodal displacement
! Double...
Identify "explicit shape spec list" in the FORTRAN code
Hi,
I'm trying to do some source code analysis using the ROSE compiler infrastructure on some of the kernels in NAS Parallel benchmark.
I get an error while parsing the Embarrassingly Parallel kernel. Digging further, I gathered that...
FORTRAN Problem! "Runtime Error: End of File"
Hey everyone, back again with another Fortran question.
I am getting the runtime error in Fortran "End of Line". I have tried to simply understand what this means, but I am not getting much help from Google.
I have pasted my code below, and...
Hey everyone,
I have written a Fortran code for a project I am working on, but am having an issue: I can't get the code to output my data to the file I have opened. Here is what I am trying to do.
I am setting up a Monte-Carlo code that selects a random x- and y-value. These values are...
In my Fortran program, I want to read data from various files whose size I do not know in prior. The input files which I am trying to read may contain different number of entries. If I have same and known number of entries in all files (say 386), I can use something like...
Hi Forum users
I have a velocity autocorrelation code which was made to read a three component velocity vectors and I have modified to read a 9 component stress tensor data. I can compile it successfully but when I try to run it and compute a stress correlation function I get an error: i.e...
I am trying to read a binary file using fortran.
this is how the binary file looks like.
1901 109.1000 241.4000 284.2000 121.9000
1902 104.0000 283.7000 202.6000 201.9000
1903 114.8000 293.0000 279.6000...
Hi all,
I have been running mpi fortran code on Linux based systems without any trouble for some time but making the same code run on a Mac is causing me some headaches. I installed mpi using the guide at: http://www.macresearch.org/compiling-mpi-f90-support-snow-leopard
I am trying to run...
Hi guys,
I am kind of a newbie to fortran and I'd like to ask a simple question.
In the code below, I have a main program with one subroutine. It's a simple one.
In the main code I am filling an array with elements from 1 to 10. Then I am passing this array to a subroutine "sub", where...
Hello,
I had started an earlier thread on porting this same program to linux. In that thread I had asked about padding (align) issues. It may turn out that the padding messages may only be warnings and I have shelved that problem. A more critical issue is the one error on ambiguous use of...
Hello,
I must start by stating that I know almost nothing about fortran. I am trying to help port a fortran program to linux. It compiles and runs fine on irix (64 bit sgi origin 2000). There are two make files and both of them give padding warnings.
---------
Padding of 4 bytes required...
I am trying to use this subroutine which I found online in my model but I am not experienced in programming and I need to know how can I check for errors or debug the code and try to find the mistakes or syntax errors , I have attached the code for your review
Thank you
I have many subroutines which I want to compile individually using makefile. But the memory allocation is not specified in ".INC" file but as separate subroutine depending on the user input. The "gfortran" compiler is showing the following error...
Hi all,
I am working on a Fortran 90 program that has many subroutines within the same module. The question is "are all the variables of a called subroutine are available to the calling subroutine without declaring them in the argument list of the called surboutine"? even though they are...
Hi,
I am trying to run a simulation written mostly in Fortran on Linux. The User's Manual says that "To run a simulation one needs to read several input files." Then, it lists a bunch of files. I was wondering what it means by that and how I "read" the files?
Thanks in advance,
Naomi
Hi! I'm trying to write a function that will integrate a user given function. I am having trouble with reading the function. Here is a section of my code:
function f(x)
implicit none
real :: x,f,p
print *,'Type a probability density function'
read *, p
!It doesn't like line 34...
f = p...
I'm having trouble allocating memory for a dynamic two dimensional array in FORTRAN 90; the odd thing is that when I did the same thing using three on dimensional arrays instead of an array with the dimensions 3*x, I didn't have a problem.
read (1,*) ndat1 !The first line of every file is...
Fortran / Visual Basic ??
I wrote more then few dosens programs in all flavors of Basics, mostly in DOS. Unfortunatelly with the new Windows systems, 32, 64 bit they are no longer usable. I would like to rewrite some of them. It is mostly structural engineering, cams, linkages. The codes are...
Getting an "unclassifiable statement" error in Fortran 95
I am trying to integrate the function x from 0 to 1. Here is my code:
program myownmonte
!This program will integrate the function x from 0 to 1
implicit none
real :: ans0,y,f,x,xmax
integer :: icount,nmax,i,iseed
iseed = 89237...
I am trying to write a program that in Fortran 95 will integrate x^2 from 0 to 1. Easy right?? I'm getting errors, though, that I really don't understand. Here is my code:
program montecarlo2
implicit none
real :: fmax,iseed,srand,xmax,x2,x,y
!why do we need pi??
integer ...
I have a program that makes a histogram from data taken in a file but it only works if the data is an array (nx1 matrix).
I've downloaded a data file which is a 159663x12 matrix but only the 8th column contains numbers I'm interested it. The other columns contain either letters and/or numbers...
I have a data file with 21 values in it, which range from 2 to 10 by integers values.
I would like to know whether it's possible to write a Fortran code to count the number of times a particular value (for instance "6") appear in the file. Let's call x_i the number of times the value i appears...
Hi,
I'm having trouble with some FORTRAN code I'm trying to use.
I receive an error:
At line 769 of file ../src/mpolar.f (unit = 11, file = 'polarx.387')
Fortran runtime error: Sequential READ or WRITE not allowed after EOF marker, possibly use REWIND or BACKSPACE
Upon inspection...
Hi, I have a program written in Fortran 77 that I need to include in my Fortran 95 program. I don't have an F77 compiler, but I was told that F95 should be able to read F77 programs. I'd like to write
INCLUDE 'vegas.f'
in the first line of my program, but it's not compiling. I keep getting...
I'm trying to work with big integers but for some reason this program won't compile:
program prob003
implicit none
integer, parameter :: k32 = selected_int_kind(32)
integer(kind=k32) :: num = 600851475143
end program prob003
The file name is prob003.f90 and I'm trying to...
I've got a Fortran 95 program (which basically does few calculations) and I'd like to use it online. So that, the users will input data into a HTML form, the program will run, and it will display the results.
Would it be possible to do it in the following way?
To run a little program (e.g...
Hi.
Write an external function that takes two matrices, multiplies them and returns the resulting matrix.
Matrices can be of any dimension.
Print the resulting matrix
The above is what I have to do.
http://paste.servut.us/pgmm
This is what I've done so far. But it seems like...
Hello all,I have a small doubt. I use F95/90 and IBM compiler.This is a portion of my text file
-----------------------
Alpha Singles Amplitudes
15 3 23 4 -0.186952
15 3 26 4 0.599918
15 3 31 4 0.105048
15 3 23 4...
Hello I am currently working on a program that will take the values from a .csv file containing multiple data and analyzing them. The file can be found here: https://docs.google.com/file/d/0BzuDEPd26OcheVhiWlZ3STlZU0k/edit?usp=sharing The data in question starts in row 11 and is in the first 4...
Problem Statement: Do the sieve of Eratosthenes from 2 to 100 and find all the primesSo I'm trying to do the sieve of Eratosthenes in fortran 90 (I'm using Plato IDE)My efforts to solve this/ method to use:
Obviously, I want the program to do a LOOP starting with every whole number from 2...
How can I have an open statement:
OPEN(Unit=1,File='data.txt',...)
and be able to later have a write statement:
WRITE(*,15)
15 FORMAT('Data was collected from ',?,'file:')
where the ? would call in the file name. Also, when I type 'file:', it creates a link to something. How...
Write a program that creates a phone-book (Name, Surname, Phone Number).
Ask the user the number of entries
Read user input to an array
Write this array into a file in the hard-disk
Your program should avoid multiple entries! If a record already exists in the phone-book, the program should...
I'm rusty with fortran and programming in general. I can't see my "error" in a code that I wrote from scratch.
Basically I wanted to get some fun and solve for a temperature in thermodynamics where I must get "T_f" which appear in a transcendental equation: ##A\ln \left ( \frac{T_f^2}{T_1T_2}...
Hi!
I have the next expression and I don't know what exactly mean the commands
a= dexp ((const1)* (b-298) / (b*298))
This one, I guess it's to calculate the exponential value of the expression giving a double precission.
But i didn't find any info about the command expg,
i.e: a =...
Does FORTRAN support use of hardware serial ports? I need to write and read to a COM port.
If so, can you configure the port as well? (ie baud rate , parity ,data bits, stop bits )
Thanks,
Jim
Hello,
I am dealing with the code below and i am receiving 'runtime error M6104:MATH floating point error:overflow'. i searched the error online and it is written the output values have high range than input values that i represent as input. I am using Microsoft Developer Studio and since my...
Hello all,
I need to learn to code in fortran 77 preferably or fortran 99 if 77 isn't available easily for a scientific computing course this fall. Does anyone know where I can obtain one of these compliers for somewhere between free and a few hundred dollars?
Say the focus point - the Sun - is at P(0,0), would I then determine the apoapsis (periapsis) by implementing the Pythagorean Theorem on each point to determine which point's distance is largest (smallest for periapsis) from the origin, then output the coordinates for each? Each coordinate to be...
How would I go about extracting the 3 substrings delimited by the slashes in the date?
The date is a string in the format "d/m/y"
This subprogram checks if there are at least 2 slashes for correct format, and then, if the format is correct, the program would then extract the day, month, and...
Hello,
I'm new using fortran and I don't know what does it mean:
write (4,*) ' '
write (4,310)
write (4,311)
this lines go consecutive in the programm I have to understand.
- might say that 4 is not a reference to a line of the code.
- 310,311 are references about how the...
This is my own code, and it won't compile with gfortran. All I want to do is extract the location of the cell with the minimum value in an array. A seemingly simple task but one that does not work with the intrinsic function minloc, for reasons I do not understand.
The error message...