Skip to content

Commit aafd5bc

Browse files
authored
Enable Restart Probe Files
This allows data to be appended in the existing probe files instead of overwriting them when the simulation restarts.
1 parent 8aaf0d6 commit aafd5bc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/simulation/m_data_output.fpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ contains
175175
!! Relative path to the probe data file in the case directory
176176

177177
integer :: i !< Generic loop iterator
178+
logical :: file_exist
178179

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

184185
! Creating the formatted data file and setting up its
185186
! structure
186-
open (i + 30, FILE=trim(file_path), &
187-
FORM='formatted', &
188-
STATUS='unknown')
187+
inquire(file=trim(file_path), exist=file_exist)
188+
189+
if (file_exist) then
190+
open (i + 30, FILE=trim(file_path), &
191+
FORM='formatted', &
192+
STATUS='old', &
193+
POSITION='append')
194+
else
195+
open (i + 30, FILE=trim(file_path), &
196+
FORM='formatted', &
197+
STATUS='unknown')
198+
endif
199+
189200
! POSITION = 'append', &
190201
!WRITE(i+30,'(A,I0,A)') 'Probe ',i, ' located at:'
191202
!WRITE(i+30,'(A,F10.6)') 'x = ',probe(i)%x

0 commit comments

Comments
 (0)