Fortran 正在运行程序/未在终端中显示
所以我运行这个程序来检查确保所有内容都被正确读取,并且我有一个输出文件来写出与我读取的内容完全相同的内容。我需要这样做的几个文件,并没有任何问题,检查它。然而,我在上一个文档中,当我在终端中运行它时,在我运行之后,什么也不会显示。/a.out。有没有可能我的程序太大了以至于无法显示?我真的很困惑 以下是该程序的代码:Fortran 正在运行程序/未在终端中显示,fortran,gfortran,fortran90,Fortran,Gfortran,Fortran90,所以我运行这个程序来检查确保所有内容都被正确读取,并且我有一个输出文件来写出与我读取的内容完全相同的内容。我需要这样做的几个文件,并没有任何问题,检查它。然而,我在上一个文档中,当我在终端中运行它时,在我运行之后,什么也不会显示。/a.out。有没有可能我的程序太大了以至于无法显示?我真的很困惑 以下是该程序的代码: program final implicit none integer :: i real, parameter :: & g=9.81
program final
implicit none
integer :: i
real, parameter :: &
g=9.81 !Value of gravity acceleration
! Declaration of arrays specific to Dec. 6, 1973
integer, dimension(60) :: direction73, speedconv73, speed73, rh73
real, dimension (60) :: pressure73, height73, temp73, dewpt73, mixr73
! Declaration of arrays specific to Dec. 6, 1983
integer, dimension(45) :: direction83, speedconv83, speed83, rh83
real, dimension (45) :: pressure83, height83, temp83, dewpt83, mixr83
! Declaration of arrays specific to Dec. 6, 1990
integer, dimension(70) :: direction90, speedconv90, speed90, rh90
real, dimension (70) :: pressure90, height90, temp90, dewpt90, mixr90
! Declaration of arrays specific to Dec. 6, 1996
integer, dimension(82) :: direction96, speedconv96, speed96, rh96
real, dimension (82) :: pressure96, height96, temp96, dewpt96, mixr96
! Declaration of arrays specific to Dec. 6, 2003
integer, dimension(79) :: direction03, speedconv03, speed03, rh03
real, dimension (79) :: pressure03, height03, temp03, dewpt03, mixr03
! Declaration of arrays specific to Dec. 6, 2009
integer, dimension(140) :: direction09, speedconv09, speed09, rh09
real, dimension (140) :: pressure09, height09, temp09, dewpt09, mixr09
! Declaration of arrays specific to Dec. 6, 2016
integer, dimension(121) :: direction16, speedconv16, speed16, rh16
real, dimension (121) :: pressure16, height16, temp16, dewpt16, mixr16
real :: average, knots, radians, ucomp, vcomp, PW, avgrh
real :: ucompsum, vcompsum, avgucomp, avgvcomp, layermag=0.0
open(1,file='1973Dec6.txt', status='old', action='read')
10 format (F7.1, T9, F6.1, T17, F5.1, T24, F5.1, T34, I2, T39, F4.2, T47, I3, T54, I3)
do i=1,60
read(1,10) pressure73(i), height73(i), temp73(i), dewpt73(i), rh73(i), mixr73(i), direction73(i), speed73(i)
end do
close (1)
open(2,file='1983Dec6.txt', status='old', action='read')
do i=1,45
read(2,10) pressure83(i), height83(i), temp83(i), dewpt83(i), rh83(i), mixr83(i), direction83(i), speed83(i)
end do
close (2)
open(3,file='1990Dec6.txt', status='old', action='read')
do i=1,70
read(3,10) pressure90(i), height90(i), temp90(i), dewpt90(i), rh90(i), mixr90(i), direction90(i), speed90(i)
end do
close (3)
open(4,file='1996Dec6.txt', status='old', action='read')
do i=1,82
read(4,10) pressure96(i), height96(i), temp96(i), dewpt96(i), rh96(i), mixr96(i), direction96(i), speed96(i)
end do
close (4)
open(5,file='2003Dec6.txt', status='old', action='read')
do i=1,79
read(5,10) pressure03(i), height03(i), temp03(i), dewpt03(i), rh03(i), mixr03(i), direction03(i), speed03(i)
end do
close (5)
open(6,file='2009Dec6.txt', status='old', action='read')
do i=1,140
read(6,10) pressure09(i), height09(i), temp09(i), dewpt09(i), rh09(i), mixr09(i), direction09(i), speed09(i)
end do
close (6)
open(7,file='2016Dec6.txt', status='old', action='read')
do i=1,121
read(7,10) pressure16(i), height16(i), temp16(i), dewpt16(i), rh16(i), mixr16(i), direction16(i), speed16(i)
end do
close (7)
!Output File
open(9, file='finaloutput.txt', status='new', action='write')
do i=1,121
write (*, 20) pressure16(i), height16(i), temp16(i), dewpt16(i), rh16(i), mixr16(i), direction16(i), speed16(i)
20 format (F7.1, T9, F6.1, T17, F5.1, T24, F5.1, T34, I2, T39, F4.2, T47, I3, T54, I3)
end do
close (9)
end program final
转到“活动监视器”应用程序。如果程序“a.out”处于活动状态(您可以在cpu使用年限为%的进程列表中看到它),那么它正在做一些事情。它是否陷入了一个循环,或者实际上做了一些有用的事情是另一个问题。是的,它不在那里。这是否意味着它根本不运行?如果是这样,我该怎么办?是的,我基本上一直在使用相同的代码,只是复制和粘贴代码,并更改一些变量以匹配相应的文件。当我取出其他文件而不是全部放在那里时,它可以很好地处理这一个文件。我还将显示代码。问题在于标记为#7的文件。在此之前,它将正确输出。但一旦我加上最后一个,我就遇到了我的问题。永远不要使用从1到10的单位数。尤其是数字5和6几乎肯定会引起麻烦。试着把你的程序改成更高的单位数,看看它能做什么。在Fortran 2008中,可以使用
newunit=
。