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

Io Fortran自由格式无法读取输入文件,io,fortran,Io,Fortran,我已经从这里下载了代码 当我尝试Test2、Tesst3、Test6中的例子时,一切都很好 Reading model from MODEL... 24 1 202 1 202 1 202 1 202 1 202 1 202

我已经从这里下载了代码

当我尝试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
我已经创建了包含更多单元格的模型文件

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
我的模型文件

我的网格文件

我的开始.txt


为什么free format无法正确读取我的输入文件?

您发布的模型文件是否正是您使用的?因为它不符合预期。应该有24层,你只有一层,那一层应该有202列,它没有…@haraldkl没有,但我将粘贴我的模型文件、网格和启动。在你的模型文件中,你每层有102列,但你告诉应用程序需要202列。@haraldkl Ok,将改变这一点。