fortran77

Asterisk and Fortran statement

寵の児 提交于 2019-12-13 08:27:07
问题 I have a Fortran 77 code that shows a comment in the first column and written double precision in the same line. now my text editor (Notepad++) is showing that as a statement. I am confused if it is a statement or a comment. * double precision Ct,Jt,PDt,AeA0t,Zt,Cq,Jq,PDq,AeA0q,Zq, * &Kt,Kq,Eta,J,PD,AeA0 回答1: It's a comment. If there's anything other than a whitespace in the first column of a line in a fixed-form fortran (That is Fortran up to F77), it's a comment. These variables are not

How to write the formatted matrix in a lines with fortran77?

心不动则不痛 提交于 2019-12-13 07:40:21
问题 Suppose I have the matrix c(i,j). I want to write it on the screen on oldest Fortran77 language with three signs after comma. I write do i=1,N write(*,"(F8.3)") ( c(i,j), j=1,N ) end do but the output is in the form c(1,1) c(1,2) ... c(1,10) c(2,1) c(2,2) ... Finally, I may simply write do i=1,N write(*,*) ( c(i,j), j=1,N ) end do and then the output is like the matrix, but, of course, it is not formatted. How to get the correct output in Fortran77? An edit. It seems that one of solutions is

Gfortran does not tell me what type of floating point error it is

依然范特西╮ 提交于 2019-12-13 07:38:47
问题 This is how I have compiled a fortran 77 file with gfortran 4.8.5 gfortran -Wall -O0 -c -g -fbacktrace -ffpe-trap=invalid,denormal,zero,overflow,underflow ${tool}.f ${ncdf_incs} and then I run it and I get this floating point exception Program received signal SIGFPE: Floating-point exception - erroneous arithmetic operation. Backtrace for this error: #0 0x7F9AC3077E08 #1 0x7F9AC3076F90 #2 0x7F9AC29BE4AF #3 0x404894 in psiappsor at inv_cart.f:1221 #4 0x40F7E8 in MAIN__ at inv_cart.f:159

fortran, how to make several copies of a program using module or interface?

点点圈 提交于 2019-12-12 05:44:43
问题 I want to do a double integration using CGAUSS , a FORTRAN program in cernlib . I have to make two copies CGAUSS1 and CGAUSS2 in order to avoid CGAUSS call itself. But I do not find the original CGAUSS code. Is there a way to make copies using module or interface in FORTRAN? 来源: https://stackoverflow.com/questions/12946259/fortran-how-to-make-several-copies-of-a-program-using-module-or-interface

Dynamic array in Fortran 77

瘦欲@ 提交于 2019-12-12 03:05:06
问题 I have to write a subroutine in Fortran 77(i'm using Intel Fortran), which reads the measured values from a text file and stores them in a matrix. Since the number of measured values is always variable, I must dynamically allocate the matrix. I know that the dynamic allocation is only possible from Fortran 90, but at that time people had the same problems, so it is also possible. How would you proceed? I do not want to reserve too much space for the matrix because the method is impractical

Is there a command in Fortran77 or later that decompresses a file?

﹥>﹥吖頭↗ 提交于 2019-12-12 01:17:03
问题 I have a file that is compressed and I want to decompress it. Do you know if there is a command or do I need to follow another path? 回答1: There isn't one built into FORTRAN 77, but you can shell out to the UNIX commands gzip, gunzip to compress/decompress a file (assuming you are running on UNIX). 回答2: Does this help you? 来源: https://stackoverflow.com/questions/680478/is-there-a-command-in-fortran77-or-later-that-decompresses-a-file

Equivalence in fortran 77 (real and complex variable)

依然范特西╮ 提交于 2019-12-11 23:55:08
问题 I am trying to understand Fortran 77 code but stumbled on EQUIVALENCE() statement on the code. Here is part of the code: REAL*8 DATA1(0:N-1) COMPLEX*16 DATA2(0:N/2-1) EQUIVALENCE(DATA1, DATA2) ... ... CALL FFT(DATA1, N/2, -1) Basically FFT subroutine is a one-dimensional complex-to-complex FFT engine. There are some permutation and matrix-vector multiplication on the subroutine. The code calls DATA2 later in this manner: K0=DATA2(0) K1=DCONJG(DATA2(0)) can anyone give me clue about why

Fortran 77 debugger to check array bounds

◇◆丶佛笑我妖孽 提交于 2019-12-11 12:48:46
问题 I am still green to debugging F77 and am having some problems with array bounds. I recently modified a lengthy code to have new array sizes. Everything 'seemed' okay until I noticed methods to alter one array, altered another. Somewhere in this code, I assume, an assignment is out of bounds and writing to the other arrays. Is there a debugger/tool in the linux environment that will 'catch' the out of bounds exception? I am currently using gfortran 回答1: There is a flag for gfortran to insert

Allocatable arrays in fortran 77 and gfortran

帅比萌擦擦* 提交于 2019-12-11 12:27:24
问题 I'm trying to compile some old fortran77 programs with gfortran and getting error with allocatable arrays. If I define arrays in f90-style, like: REAL*8,allocatable::somearray(:) everything is fine, but in those old programs arrays defined as: REAL*8 somearray[ALLOCATABLE](:) which cause gfortran error output: REAL*8,allocatable::somearray[ALLOCATABLE](:) 1 Fatal Error: Coarrays disabled at (1), use -fcoarray= to enable I really wish to avoid rewriting whole programs to f90 style, so, could

Opening a file on unit 5 or 6

末鹿安然 提交于 2019-12-11 11:14:10
问题 I have a read/write operation going on in the Fortran code snippet as follows OPEN(5,FILE='WKDAT.dat', STATUS='OLD') OPEN(6,FILE='WKLST.dat', STATUS='UNKNOWN') I know that by default the unit number 5 is used for input from the keyboard and unit number 6 is used to display on the screen. Also I can use * . But in the above-mentioned Fortran code unit number is 5 and a file name "WKDAT.dat" is given. So this means that the data is being read from "WKDAT.dat" file. Also there is code unit