@@ -46,17 +46,19 @@ module output
4646 use inputs, only: nx,ny,nz, time_step, grid, NA, Check_Steady_State, ntime, WriteToTxt
4747 use inputs, only: Test_Run, freq, RunName, FullRestart, IVERB, write_every
4848 use inputs, only: start_ix, end_ix, start_iy, end_iy, start_iz, end_iz
49- use globe_data, only: Temp_p,Temp_pp, heat, heated_volume
49+ use globe_data, only: Temp_p,Temp_pp, heat, heated_volume, logname
5050 implicit none
5151
5252contains
5353 subroutine data_write (itime )
5454 implicit none
5555 integer (int12), intent (in ) :: itime
5656 real (real12), dimension (nx,ny,nz) :: CT, Temp_cur
57- integer (int12) :: ix, iy, iz, indexA, logunit
58- character (len= 1024 ) :: file_prefix, file_extension, outdir, logname
57+ integer (int12) :: ix, iy, iz, indexA
58+ character (len= 1024 ) :: file_prefix, file_extension, outdir
59+ integer :: logunit
5960
61+ logunit = 20
6062 file_prefix = ' Temperture_'
6163 outdir= ' ./outputs/'
6264 file_extension = ' .out'
@@ -90,9 +92,12 @@ subroutine data_write(itime)
9092 ! find most recent log file and open it
9193 !- --------------------------------------
9294 CALL last_log(logname,outdir)
93- open (newunit= logunit,file= logname)
95+ open (logunit,file= logname)
96+ ! print*, logunit
97+ ! print*, logname
9498 write (logunit,* ) real ((itime-1 )* (time_step)), &
9599 (Temp_cur(start_ix:end_ix, start_iy:end_iy, start_iz:end_iz))
100+ close (logunit)
96101 ! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97102 end if
98103 end if
@@ -108,8 +113,12 @@ subroutine data_write(itime)
108113 if (WriteToTxt) then
109114 if (mod (itime, write_every) .eq. 0 ) then
110115 write (* , * ) ' Writing Temperature difference to file'
116+ ! print*, logunit
117+ ! print*, logname
118+ open (logunit,file= logname, status= ' old' , position= ' append' )
111119 write (logunit,* ) real ((itime-1 )* (time_step)), &
112120 (Temp_cur(start_ix:end_ix, start_iy:end_iy, start_iz:end_iz))
121+ close (logunit)
113122 end if
114123 endif
115124 end if
0 commit comments