Skip to content

Commit

Permalink
Enable Restart Probe Files
Browse files Browse the repository at this point in the history
This allows data to be appended in the existing probe files instead of overwriting them when the simulation restarts.
  • Loading branch information
haochey authored Nov 5, 2024
1 parent 8aaf0d6 commit aafd5bc
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/simulation/m_data_output.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ contains
!! Relative path to the probe data file in the case directory

integer :: i !< Generic loop iterator
logical :: file_exist

do i = 1, num_probes
! Generating the relative path to the data file
Expand All @@ -183,9 +184,19 @@ contains

! Creating the formatted data file and setting up its
! structure
open (i + 30, FILE=trim(file_path), &
FORM='formatted', &
STATUS='unknown')
inquire(file=trim(file_path), exist=file_exist)

if (file_exist) then
open (i + 30, FILE=trim(file_path), &
FORM='formatted', &
STATUS='old', &
POSITION='append')
else
open (i + 30, FILE=trim(file_path), &
FORM='formatted', &
STATUS='unknown')
endif

! POSITION = 'append', &
!WRITE(i+30,'(A,I0,A)') 'Probe ',i, ' located at:'
!WRITE(i+30,'(A,F10.6)') 'x = ',probe(i)%x
Expand Down

0 comments on commit aafd5bc

Please sign in to comment.