我正在通过以下算法解决定点问题:
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.
如果让我们说,我有兴趣查看f和f&f;在达到容差之前(即在程序从4跳到5之前),有没有办法让Fortran写出f和f&f;一旦程序被迫停止?类似的东西:
IF (stop message received) THEN
PRINT f and f' to files
END IF
我知道这样做的一个变体是写f和f'每次更新功能。但这可能成本太高,因为算法需要100秒进行1次迭代,大约200次迭代才能完成,这大约是。 6~7个小时。
有什么想法和建议吗?谢谢!
答案 0 :(得分:1)
所以替换
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. calculate distance ||f'-f||. If greater than tolerance, go back to 3.
5. Write a .txt file to record the solution f. end
这似乎很明显,我希望我完全忽略了这一点。