Skip to content

Commit

Permalink
Write file version to datfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisteunissen committed Oct 16, 2023
1 parent 867b39a commit 192c3cf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/streamer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ program streamer

integer, parameter :: int8 = selected_int_kind(18)
integer, parameter :: max_attemps_per_time_step = 10
integer, parameter :: datfile_version = 30
integer(int8) :: t_start, t_current, count_rate
real(dp) :: wc_time, inv_count_rate
real(dp) :: time_last_print, time_last_output
Expand Down Expand Up @@ -492,6 +493,8 @@ end subroutine set_initial_conditions
subroutine write_sim_data(my_unit)
integer, intent(in) :: my_unit

write(my_unit) datfile_version

write(my_unit) it
write(my_unit) output_cnt
write(my_unit) time
Expand All @@ -501,10 +504,15 @@ subroutine write_sim_data(my_unit)

write(my_unit) ST_global_rates
write(my_unit) ST_global_JdotE
write(my_unit) fraction_steps_rejected
end subroutine write_sim_data

subroutine read_sim_data(my_unit)
integer, intent(in) :: my_unit
integer :: version

read(my_unit) version
if (version /= datfile_version) error stop "Different datfile version"

read(my_unit) it
read(my_unit) output_cnt
Expand All @@ -513,9 +521,9 @@ subroutine read_sim_data(my_unit)
read(my_unit) photoi_prev_time
read(my_unit) global_dt

! Data is stored in location of first thread
read(my_unit) ST_global_rates
read(my_unit) ST_global_JdotE
read(my_unit) fraction_steps_rejected

dt = global_dt
end subroutine read_sim_data
Expand Down

0 comments on commit 192c3cf

Please sign in to comment.