0

我正在尝试读取流场快照的列(uvw 堆叠,其中约 24k)并将多个快照(保存到单独的 .dat 文件中,如发布的代码中所示)组合成矩阵(列是速度timesteps, i=1 first timestep, ect) 用于 SVD/POD。我按照这里的一些教程进行了格式化(我认为),但现在我遇到了这个 sigsegv 错误,所以我被卡住了。非常感谢任何输入。谢谢!

       program matrix2       
!      Creates rectangular matrix by adding columns of individual
!      Timesteps for use in Singular Value Decomposition (in MatLAB)

!      Allocate
       double precision, dimension(:,:), allocatable :: POD
       integer, parameter :: tend = 700
       integer, parameter :: length = 23925
       character(:), allocatable :: fn, fm
       integer :: it, idt
       character(len=5) :: t, dt
       character(len=10) :: fmt
       character(len=40) :: fmm

!      Create format discriptors
       fmt = '(i5.5)'
       fmm = '(a19,i5.5,a4)'

!      Create data file to save matrix
       fn = 'POD_Data_Matrix.dat'
       open(unit=1,file=fn,status='unknown',form='formatted')

!      Loop to open column files and write data
       do j = 1,tend

!      Open corresponding column file, add to POD matrix
!      and close every timestep column
!      Convert integer to string using internal file
         it=00001
         idt=00001
         write(t,fmt) it
         write(dt,fmt) idt
         fm = 'U-Matrix-Column-Eq-'//trim(t)//'.dat'
         open(unit=11,file=fm,status='unknown',form='formatted')  
         do i = 0,length
           read (11,*) POD(j,i)
         enddo
         close(11)
         it = it + idt
       enddo

!      Write and close final POD matrix
       write(1,*) POD(j,i)
       close(1)

!      Deallocate
!       deallocate(POD)
!       deallocate(fn,fm)
       endprogram
4

1 回答 1

0

POD被声明为可分配的,但它从未在 READ 语句中的尝试定义之前分配。ALLOCATE(POD(tend,length))也许你忘了在阅读循环之前给它分配一些东西 ?

于 2013-04-08T04:33:47.993 回答