fortran

Fortran “Error: The shapes of the array expressions do not conform.”

牧云@^-^@ 提交于 2021-02-17 06:34:06
问题 I know someone has asked a similar question. It said that the error maybe come from trying to assign an array to a scalar. I checked my program again and again as it said but I really don't find any wrong with my program. The specific error message is: D:\src\fortran\Kramers\kramers.f90(54) : Error: The shapes of the array expressions do not conform. [Y2] y2(1)=sqrt(2.0d0*T)*[h*omega(2)-h1*omega(3)+h1*h*omega(4)-h1*h1*omega(6)+& ----------------^ D:\src\fortran\Kramers\kramers.f90(65) : Error

Evaluating a specific letter of a string defined in a derived type in Fortran90 [duplicate]

走远了吗. 提交于 2021-02-17 06:27:25
问题 This question already has answers here : Extract substring of Fortran string array (3 answers) Extract a single character from a Fortran string (1 answer) Access character at specific index in a string in Fortran (1 answer) Closed 1 year ago . I would like to evaluate if the 3rd letter of variable myline is 'C' or not. I try this: program main implicit none type line integer :: count = 5 character(len=48) :: list = 'ABCDE' end type type(line) :: myline character(len=1) :: letter = 'C' write(*

Fortran: Reading and printing 2D array from text file

那年仲夏 提交于 2021-02-17 06:22:27
问题 I am new to fortran and all I am trying to do is read a 3x3 array and print it out but I am getting an end of line error: The text file contains the following array: 1 2 3 4 5 6 7 8 9 Here is my code: program myfile implicit none ! Declare Variables integer i,j !real, dimension(1:3,1:3) :: A integer, parameter :: M = 3, N =3 real, dimension(1:M,1:N) :: A ! Open and read data open(unit=10, file = 'test_file_cols.txt', status = 'old') do i =1,M do j =1,N read(unit=10,FMT=*) A(i,j) print *,A(i,j

Compiling using gfortran in Mac

╄→尐↘猪︶ㄣ 提交于 2021-02-17 06:10:03
问题 So bear with me as I am very new to coding. I'm trying to compile a Fortran file but I keep getting this issue in my terminal. I am using GNU Fortran (GCC) 9.2.0 and I believe I have all other prerequisites updated Xcode and atom. Appreciate any and all help spent went way too long just to say hello world. % gfortran -o myprog hello.f90 ld: library not found for -lSystem collect2: error: ld returned 1 exit status 来源: https://stackoverflow.com/questions/63032579/compiling-using-gfortran-in-mac

Compiling using gfortran in Mac

寵の児 提交于 2021-02-17 06:09:09
问题 So bear with me as I am very new to coding. I'm trying to compile a Fortran file but I keep getting this issue in my terminal. I am using GNU Fortran (GCC) 9.2.0 and I believe I have all other prerequisites updated Xcode and atom. Appreciate any and all help spent went way too long just to say hello world. % gfortran -o myprog hello.f90 ld: library not found for -lSystem collect2: error: ld returned 1 exit status 来源: https://stackoverflow.com/questions/63032579/compiling-using-gfortran-in-mac

Compiling using gfortran in Mac

房东的猫 提交于 2021-02-17 06:08:51
问题 So bear with me as I am very new to coding. I'm trying to compile a Fortran file but I keep getting this issue in my terminal. I am using GNU Fortran (GCC) 9.2.0 and I believe I have all other prerequisites updated Xcode and atom. Appreciate any and all help spent went way too long just to say hello world. % gfortran -o myprog hello.f90 ld: library not found for -lSystem collect2: error: ld returned 1 exit status 来源: https://stackoverflow.com/questions/63032579/compiling-using-gfortran-in-mac

Compiling using gfortran in Mac

橙三吉。 提交于 2021-02-17 06:08:02
问题 So bear with me as I am very new to coding. I'm trying to compile a Fortran file but I keep getting this issue in my terminal. I am using GNU Fortran (GCC) 9.2.0 and I believe I have all other prerequisites updated Xcode and atom. Appreciate any and all help spent went way too long just to say hello world. % gfortran -o myprog hello.f90 ld: library not found for -lSystem collect2: error: ld returned 1 exit status 来源: https://stackoverflow.com/questions/63032579/compiling-using-gfortran-in-mac

How to iterate over character strings with numbers, words and blancks in Fortran90?

随声附和 提交于 2021-02-17 06:00:07
问题 Description of the file: The STL file consists of solid <solid_name> facet normal n1 n2 n3 (the triangles normal vector) outerloop (one of the markers I want to read) v1 x1 y1 z1 v2 x2 y2 z2 (three vertex of the triangle/facet) v3 x3 y3 z3 endloop end facet endsolid The idea is to read the information in each line. First, I'm trying !to read the first line:solid program Leitura !use, intrinsic :: trim implicit none integer ilo, ierror, ihi, ios, iunit, num_text, len_blanck, len_word, len_text

Contents of a f77 unformatted binary file

青春壹個敷衍的年華 提交于 2021-02-17 05:14:00
问题 I have an f77 unformatted binary file. I know that the file contains 2 floats and a long integer as well as data. The size of the file is 536870940 bytes which should include 512^3 float data values together with the 2 floats and the long integer. The 512^3 float data values make up 536870912 bytes leaving a further 28 bytes. My problem is that I need to work out where the 28 bytes begins and how to skip this amount of storage so that I can directly access the data. I prefer to use C to

Contents of a f77 unformatted binary file

▼魔方 西西 提交于 2021-02-17 05:12:04
问题 I have an f77 unformatted binary file. I know that the file contains 2 floats and a long integer as well as data. The size of the file is 536870940 bytes which should include 512^3 float data values together with the 2 floats and the long integer. The 512^3 float data values make up 536870912 bytes leaving a further 28 bytes. My problem is that I need to work out where the 28 bytes begins and how to skip this amount of storage so that I can directly access the data. I prefer to use C to