一旦程序被迫停止,是否可以要求Fortran写出一些结果?

一旦程序被迫停止,是否可以要求Fortran写出一些结果?,fortran,gfortran,Fortran,Gfortran,我通过以下算法解决固定点问题: 1. specify grids x1,x2,x3,... xn 2. initial guess f=0 on all grids x1, x2, x3, ..., xn 3. update f according to some mapping T. f'=Tf on all grids. 4. calculate distance ||f'-f||. If greater than tolerance, go back to 3; otherwise, e

我通过以下算法解决固定点问题:

1. specify grids x1,x2,x3,... xn 
2. initial guess f=0 on all grids x1, x2, x3, ..., xn
3. update f according to some mapping T. f'=Tf on all grids.
4. calculate distance ||f'-f||. If greater than tolerance, go back to 3; otherwise, end. 
5. Write a .txt file to record the solution f.
如果说,我想在达到公差之前(即程序从4跳到5之前)检查f和f',那么一旦程序被迫停止,有没有办法让Fortran写出f和f'呢?比如:

IF (stop message received) THEN
   PRINT  f and f' to files
END IF
我知道这样做的一种变体是每次函数更新时都写入f和f'。但这可能太昂贵了,因为该算法一次迭代需要100秒,完成大约200次迭代,大约需要6~7小时

有什么想法和建议吗?谢谢

4. calculate distance ||f'-f||. If greater than tolerance, go back to 3; otherwise, end. 
5. Write a .txt file to record the solution f.


这似乎太明显了,我想我完全没有抓住要点。

这里有一些关于相关问题的有用讨论。澄清你所说的“停止消息”是什么意思来想想,如果迭代需要100秒,简单地写下每一个结果并不重要,是吗?(当然,除非
n
非常大)@agentp我的意思是在Ubuntu终端中使用
ctrl+c
来显示停止消息
n
在当前版本中为12000,文档中还有4个其他变量是用
f
编写的。那么12000*5。也许你是对的。每次迭代不应该超过几秒钟?@francescalus感谢链接。检查站听起来是个好习惯。
4. calculate distance ||f'-f||. If greater than tolerance, go back to 3. 
5. Write a .txt file to record the solution f. end