IRI 2016 模型的 Fortran 77 编译

Fortran 77 compilation for IRI 2016 model

提问人:Chloé Benz 提问时间:1/20/2022 最后编辑:Chloé Benz 更新时间:1/25/2022 访问量:268

问:

我最近一直在尝试编译 IRI 模型,但有些不成功。我已经下载了 IRI 2016 + 通用文件 + 索引文件,并使用测试文件进行测试。我正在使用带有 -std=legacy 标志的 gfortran(尽管代码在 fortran 77 中)(以删除不必要的警告,但我认为代码被编译为 fortran 2003 或其他东西)。我使用的链接/编译命令是:

gfortran -std=legacy -o iri iritest.for irisub.for irifun.for iritec.for iridreg.for igrf.for cira.for iriflip.for

这给了我可执行文件,并产生了一些形式的警告:iri.exe

Warning: Array reference at (1) out of bounds in loop beginning at (2)

(在编译时)。

当我运行可执行文件并通过控制台输入输入时,我收到以下标志:

Note: The following floating-point exceptions are signalling: IEEE_UNDERFLOW_FLAG IEEE_DENORMAL

代码显然做了它应该做的事情(输出一个以结果命名的非空文件)。我读到我得到的IEEE标志相当常见,我可以忽略它们,但超出范围的警告对我来说更令人担忧。 我还收到以下警告:fort.7

igrf.for:298:10:

  296 |       DO 3 N=3,3333
      |                                                                        2
  297 | C*****CORRECTOR (FIELD LINE TRACING)
  298 |       P(1,N)=P(1,N-1)+STEP12*(5.*P(4,N)+8.*P(4,N-1)-P(4,N-2))
      |          1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:298:17:

  296 |       DO 3 N=3,3333
      |                                                                        2
  297 | C*****CORRECTOR (FIELD LINE TRACING)
  298 |       P(1,N)=P(1,N-1)+STEP12*(5.*P(4,N)+8.*P(4,N-1)-P(4,N-2))
      |                 1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)
igrf.for:298:37:

  296 |       DO 3 N=3,3333
      |                                                                        2
  297 | C*****CORRECTOR (FIELD LINE TRACING)
  298 |       P(1,N)=P(1,N-1)+STEP12*(5.*P(4,N)+8.*P(4,N-1)-P(4,N-2))
      |                                     1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:298:47:

  296 |       DO 3 N=3,3333
      |                                                                        2
  297 | C*****CORRECTOR (FIELD LINE TRACING)
  298 |       P(1,N)=P(1,N-1)+STEP12*(5.*P(4,N)+8.*P(4,N-1)-P(4,N-2))
      |                                               1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)
igrf.for:298:56:

  296 |       DO 3 N=3,3333
      |                                                                        2
  297 | C*****CORRECTOR (FIELD LINE TRACING)
  298 |       P(1,N)=P(1,N-1)+STEP12*(5.*P(4,N)+8.*P(4,N-1)-P(4,N-2))
      |                                                        1
Warning: Array reference at (1) out of bounds (3331 > 100) in loop beginning at (2)
igrf.for:299:10:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  299 |       P(2,N)=P(2,N-1)+STEP12*(5.*P(5,N)+8.*P(5,N-1)-P(5,N-2))
      |          1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:299:17:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  299 |       P(2,N)=P(2,N-1)+STEP12*(5.*P(5,N)+8.*P(5,N-1)-P(5,N-2))
      |                 1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)
igrf.for:299:37:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  299 |       P(2,N)=P(2,N-1)+STEP12*(5.*P(5,N)+8.*P(5,N-1)-P(5,N-2))
      |                                     1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:299:47:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  299 |       P(2,N)=P(2,N-1)+STEP12*(5.*P(5,N)+8.*P(5,N-1)-P(5,N-2))
      |                                               1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)
igrf.for:299:56:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  299 |       P(2,N)=P(2,N-1)+STEP12*(5.*P(5,N)+8.*P(5,N-1)-P(5,N-2))
      |                                                        1
Warning: Array reference at (1) out of bounds (3331 > 100) in loop beginning at (2)
igrf.for:302:10:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  302 |       P(8,N)=STEP2*(P(1,N)*P(4,N)+P(2,N)*P(5,N))
      |          1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:302:24:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  302 |       P(8,N)=STEP2*(P(1,N)*P(4,N)+P(2,N)*P(5,N))
      |                        1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:302:31:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  302 |       P(8,N)=STEP2*(P(1,N)*P(4,N)+P(2,N)*P(5,N))
      |                               1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:302:38:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  302 |       P(8,N)=STEP2*(P(1,N)*P(4,N)+P(2,N)*P(5,N))
      |                                      1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:302:45:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  302 |       P(8,N)=STEP2*(P(1,N)*P(4,N)+P(2,N)*P(5,N))
      |                                             1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:303:13:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  303 |       C0=P(1,N-1)**2+P(2,N-1)**2
      |             1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)
igrf.for:303:25:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  303 |       C0=P(1,N-1)**2+P(2,N-1)**2
      |                         1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)
igrf.for:304:13:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  304 |       C1=P(8,N-1)
      |             1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)
igrf.for:305:14:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  305 |       C2=(P(8,N)-P(8,N-2))*0.25
      |              1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:305:21:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  305 |       C2=(P(8,N)-P(8,N-2))*0.25
      |                     1
Warning: Array reference at (1) out of bounds (3331 > 100) in loop beginning at (2)
igrf.for:306:14:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  306 |       C3=(P(8,N)+P(8,N-2)-C1-C1)/6.0
      |              1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:306:21:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  306 |       C3=(P(8,N)+P(8,N-2)-C1-C1)/6.0
      |                     1
Warning: Array reference at (1) out of bounds (3331 > 100) in loop beginning at (2)
igrf.for:307:13:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  307 |       D0=P(6,N-1)
      |             1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)
igrf.for:308:14:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  308 |       D1=(P(6,N)-P(6,N-2))*0.5
      |              1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:308:21:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  308 |       D1=(P(6,N)-P(6,N-2))*0.5
      |                     1
Warning: Array reference at (1) out of bounds (3331 > 100) in loop beginning at (2)
igrf.for:309:14:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  309 |       D2=(P(6,N)+P(6,N-2)-D0-D0)*0.5
      |              1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:309:21:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  309 |       D2=(P(6,N)+P(6,N-2)-D0-D0)*0.5
      |                     1
Warning: Array reference at (1) out of bounds (3331 > 100) in loop beginning at (2)
igrf.for:310:13:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  310 |       E0=P(7,N-1)
      |             1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)
igrf.for:311:14:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  311 |       E1=(P(7,N)-P(7,N-2))*0.5
      |              1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:311:21:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  311 |       E1=(P(7,N)-P(7,N-2))*0.5
      |                     1
Warning: Array reference at (1) out of bounds (3331 > 100) in loop beginning at (2)
igrf.for:312:14:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  312 |       E2=(P(7,N)+P(7,N-2)-E0-E0)*0.5
      |              1
Warning: Array reference at (1) out of bounds (3333 > 100) in loop beginning at (2)
igrf.for:312:21:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  312 |       E2=(P(7,N)+P(7,N-2)-E0-E0)*0.5
      |                     1
Warning: Array reference at (1) out of bounds (3331 > 100) in loop beginning at (2)
igrf.for:314:15:

  296 |       DO 3 N=3,3333
      |                                                                        2
......
  314 | 4     T=(Z-P(3,N-1))/STEP
      |               1
Warning: Array reference at (1) out of bounds (3332 > 100) in loop beginning at (2)

这就是我用编译器得到的。使用英特尔 Fortran 编译器时,我没有得到任何信息。gfortran

现在,当我尝试使用自定义脚本而不是测试脚本编译相同的模型时,我在编译时收到相同的超出范围警告,在运行时收到一些错误,以及仅包含 -1 的文件(这是“无值/结果”的值)。运行时的错误/标志包括:iritest.forfort.7

Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG

201301** OUT OF RANGE **
     The file IG_RZ.DAT which contains the indices Rz12 and IG12
     currently only covers the time period (yymm) :      0-     0

在该自定义脚本中,我只调用文件中存在的子例程,并在脚本中声明输入+从文本文件中读取。我已确保包含必须包含的行(请参阅)。文本文件中的输入确实被读取(用一些验证)。我知道自定义脚本在某个时间点起作用,因为它来自我目前正在工作的实验室中完成的论文。我已经没有想法可以尝试调试它了。我在 IRI 2012 上尝试了相同的方法,但得到了完全相同的标志/警告/错误。有谁知道我接下来可以尝试什么?IRI_SUBirisub.foriritest.forWRITE

编辑:我已经能够让自定义脚本产生结果,但我不确定它们是否正确,因为我使用了英特尔 Fortran 编译器(这个不再给我任何警告)。

福特兰 Gfortran Fortran77

评论

2赞 Vladimir F Героям слава 1/20/2022
当然完全无视.这只是陈述引起的噪音。我不喜欢代码。它真的很老式,但也以固定的形式混合了空间和 TAB。Note: The following floating-point exceptions...STOP
0赞 Vladimir F Героям слава 1/20/2022
您必须显示完整的错误输出。请参阅如何提问最小可重现示例。编译器肯定会显示这些警告的位置。不是“表格中的一些警告”,而是实际的完整警告。
1赞 Vladimir F Героям слава 1/20/2022
除此之外,您还必须找到打印“201301** OUT OF RANGE **”的代码位置并回溯。当然,请检查上述输入数据文件中的这些索引。
0赞 Holmz 1/20/2022
我确定我已经下载了这个,所以我会尝试检查。
0赞 Chloé Benz 1/21/2022
@VladimirF 完整的错误输出是我在指向 igrf.for 文件的特定行收到的警告的 13 倍 + 我切换到英特尔编译器,这显然解决了我的问题!

答: 暂无答案