Fortran运行时错误:文件'Out.out12.2dcl'不存在

时间:2018-10-29 04:22:29

标签: fortran gfortran fortran90

我在SuSE上使用gfortran编译我的代码并收到以下错误:

reading 2d cl
At line 18 of file ./TBW_fesolve_Dev/read2Dcl.f90 (unit = 12162015, file = '')
Fortran runtime error: File 'Out.out12.2dcl' does not exist

此处附有代码的主文件,其中18行显示错误。

该如何解决?

为简化/最小的示例,我在此处添加了代码:

subroutine read2dcl(load_factor, load_factor_case_id, node_coords, n_nodes, &
           cl_vec_struct)

implicit none

include 'fesolve_defs_f90.h'

integer :: i, ivar, last_node_id, n_nodes, n1, load_factor_case_id
double precision :: load_factor, y_vec(MAX_NODES), cl_vec_aero(MAX_NODES), &
  node_coords(MAX_NODES,3)
double precision :: cl_vec_struct(*)  
character(len=14), dimension(6) :: filename
character(len=100):: string

filename = (/'Out.out12.2dcl','Out.out13.2dcl', 'Out.out14.2dcl', 'Out.out15.2dcl', &
           'Out.out16.2dcl', 'Out.out17.2dcl'/) 

open(unit=12162015, file=filename(load_factor_case_id-11), access='sequential', status ='old', action='read')
! reading cl from aero output file
do i=1,MAX_NODES
   read(12162015,*,IOSTAT=ivar)last_node_id, y_vec(i), cl_vec_aero(i)
   IF (ivar > 0)  THEN
       write(*,*)'Error encountered'
       exit
   ELSE IF (ivar < 0) THEN
       write(*,*)'End of file reached'
       exit
   END IF
end do
close(12162015)

!allocate(cl_vec_struct(n_nodes))

! interpolating aero cl on structural mesh

!write(*,*)filename(1)
!write(*,*)last_node_id
!write(*,*)cl_vec_aero


cl_vec_struct(1) = cl_vec_aero(1)/load_factor*1.5D0
do i=2,n_nodes-1

   n1 = ((last_node_id-1)*i)/(n_nodes-1)
   cl_vec_struct(i) = (cl_vec_aero(n1) + (cl_vec_aero(n1+1) - cl_vec_aero(n1))* &
                      (real((last_node_id-1)*i)/real(n_nodes-1) - real(n1)))/load_factor*1.5D0

end do
cl_vec_struct(n_nodes) = cl_vec_aero(last_node_id)/load_factor*1.5D0

return

!deallocate(cl_vec_struct)

end subroutine read2dcl

这里的工况ID = 12。

0 个答案:

没有答案