Fortran自由格式无法读取输入文件

时间:2016-04-12 19:33:01

标签: io fortran

我已经从这里下载了代码

http://marineemlab.ucsd.edu/Projects/Occam/2DMT/index.html

当我尝试来自Test2,Tesst3,Test6的示例时,一切正常。但是以我的例子,我得到了

 Reading model from MODEL...
          24
           1         202
           1         202
           1         202
           1         202
           1         202
           1         202
           1         202
           1         202
           1         202
           1         202
           1         202
           2         202
  Error reading model file

这是工作正常的模型文件的示例

FORMAT:           OCCAM2MTMOD_1.0
MODEL NAME:       TEST MODEL 2
DESCRIPTION:      TEST 2, no frills inversion for conductive prism
MESH FILE:        MESH.TEST2
MESH TYPE:        PW2D
STATICS FILE:     none
PREJUDICE FILE:   none
BINDING OFFSET:   -22000.
NUM LAYERS:       12
2  24
 7 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 7
2  24
 7 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 7
1  24
 7 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 7
1  24
 7 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 7
1  13
 7 4 4 4 4 4 4 4 4 4 4 4 7
1  13
 7 4 4 4 4 4 4 4 4 4 4 4 7
1  13
 7 4 4 4 4 4 4 4 4 4 4 4 7
1  13
 7 4 4 4 4 4 4 4 4 4 4 4 7
1  13
 7 4 4 4 4 4 4 4 4 4 4 4 7
1  13
 7 4 4 4 4 4 4 4 4 4 4 4 7
1  13
 7 4 4 4 4 4 4 4 4 4 4 4 7
4  13
 7 4 4 4 4 4 4 4 4 4 4 4 7
NO. EXCEPTIONS:   0

我创建了包含更多单元格的MODEL文件

BINDING OFFSET:   -5000.
NUM LAYERS:       24
1  202
6 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 6

这是出现问题的代码的相关部分

 write(*,*)nlay

  ! Allocate vars related to the # of layers
  Allocate( irz(nlay)           &
          , nrcol(nlay)         &
          , stat=nAllocErr )
  if (nAllocErr .ne. 0) then
    write(*,*) 'Out of memory.  Try reducing the model size.'
    stop
  endif

  ! Don't know how many cols there are.  So pre-read through the layers
  ! and keep the max #.  Then allocate local vars to hold the data, and
  ! re-read through the layer data.
  do i = 1,nlay
    read (iof,*,end=198,err=199) irz(i), nrcol(i)
    write(*,*)irz(i), nrcol(i)
    read (iof,*,end=198,err=199) (ii, j=1,nrcol(i)) ! discard these for now
  enddo

我的模特档案 http://pastebin.com/PJMYz52T

我的网格文件 http://pastebin.com/yNcTrmM4

我的start.txt http://pastebin.com/4UKjNkEQ

为什么自由格式无法正确读取我的输入文件?

0 个答案:

没有答案
相关问题