4

特に時間がかかるコードを実行しようとしています。完了するために、データをダンプしてから次のループのために再読み込みできるように、タイム ステップ ループを分離しました。

do 10 n1 = 1, 10
  OPEN(unit=11,file='Temperature', status='replace')
  if (n1.eq.1) then
    (set initial conditions)
  elseif (n1.gt.1) then
  READ(11,*) (reads the T values from 11)
  endif

  do 20 n = 1, 10000
    (all the calculations for new  T values)
    WRITE(11,*) (overwrites the T values in 11 -  the file isn't empty to begin with)
20    continue

10    continue

私の問題は、これが 2 回の n1 時間ステップでのみ機能することです。ファイル 11 を 1 回置き換えた後は、その値を置き換えずに繰り返すだけです。

オープンステートメントに何か問題がありますか?同じコードでファイル 11 を複数回置換できる方法はありますか?

4

1 に答える 1