Skip to content

Commit e12a666

Browse files
arjunj05TheFlying12sbryngelson
authored
Fix adding footer output to runtimeinfo Fixes #574 (#576)
Co-authored-by: TheFlying12 <[email protected]> Co-authored-by: Spencer Bryngelson <[email protected]>
1 parent 4c4fb74 commit e12a666

File tree

1 file changed

+33
-45
lines changed

1 file changed

+33
-45
lines changed

src/simulation/m_data_output.fpp

Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -120,50 +120,39 @@ contains
120120
character(LEN=8) :: file_date !<
121121
!! Creation date of the run-time information file
122122

123-
logical :: file_exist !<
124-
!! Logical used to check existence of run-time information file
125-
126123
! Opening the run-time information file
127124
file_path = trim(case_dir)//'/'//trim(file_name)
128125

129-
inquire (FILE=trim(file_path), EXIST=file_exist)
130-
131-
open (1, FILE=trim(file_path), &
126+
open (3, FILE=trim(file_path), &
132127
FORM='formatted', &
133-
POSITION='append', &
134-
STATUS='unknown')
135-
136-
! Generating file header for a new run-time information file
137-
if (file_exist .neqv. .true.) then
138-
139-
write (1, '(A)') 'Description: Stability information at '// &
140-
'each time-step of the simulation. This'
141-
write (1, '(13X,A)') 'data is composed of the inviscid '// &
142-
'Courant–Friedrichs–Lewy (ICFL)'
143-
write (1, '(13X,A)') 'number, the viscous CFL (VCFL) number, '// &
144-
'the capillary CFL (CCFL)'
145-
write (1, '(13X,A)') 'number and the cell Reynolds (Rc) '// &
146-
'number. Please note that only'
147-
write (1, '(13X,A)') 'those stability conditions pertinent '// &
148-
'to the physics included in'
149-
write (1, '(13X,A)') 'the current computation are displayed.'
150-
151-
call date_and_time(DATE=file_date)
152-
153-
write (1, '(A)') 'Date: '//file_date(5:6)//'/'// &
154-
file_date(7:8)//'/'// &
155-
file_date(3:4)
128+
STATUS='replace')
156129

157-
end if
130+
write (3, '(A)') 'Description: Stability information at '// &
131+
'each time-step of the simulation. This'
132+
write (3, '(13X,A)') 'data is composed of the inviscid '// &
133+
'Courant–Friedrichs–Lewy (ICFL)'
134+
write (3, '(13X,A)') 'number, the viscous CFL (VCFL) number, '// &
135+
'the capillary CFL (CCFL)'
136+
write (3, '(13X,A)') 'number and the cell Reynolds (Rc) '// &
137+
'number. Please note that only'
138+
write (3, '(13X,A)') 'those stability conditions pertinent '// &
139+
'to the physics included in'
140+
write (3, '(13X,A)') 'the current computation are displayed.'
141+
142+
call date_and_time(DATE=file_date)
158143

159-
write (1, '(A)') ''; write (1, '(A)') ''
144+
write (3, '(A)') 'Date: '//file_date(5:6)//'/'// &
145+
file_date(7:8)//'/'// &
146+
file_date(3:4)
147+
148+
write (3, '(A)') ''; write (3, '(A)') ''
160149

161150
! Generating table header for the stability criteria to be outputted
162151
if (any(Re_size > 0)) then
163-
write (1, '(A)') '==== Time-steps ====== Time ======= ICFL '// &
152+
write (3, '(A)') '==== Time-steps ====== Time ======= ICFL '// &
164153
'Max ==== VCFL Max ====== Rc Min ======='
165154
else
166-
write (1, '(A)') '=========== Time-steps ============== Time '// &
155+
write (3, '(A)') '=========== Time-steps ============== Time '// &
167156
'============== ICFL Max ============='
168157
end if
169158

@@ -426,12 +415,12 @@ contains
426415
! Outputting global stability criteria extrema at current time-step
427416
if (proc_rank == 0) then
428417
if (any(Re_size > 0)) then
429-
write (1, '(6X,I8,6X,F10.6,6X,F9.6,6X,F9.6,6X,F10.6)') &
418+
write (3, '(6X,I8,6X,F10.6,6X,F9.6,6X,F9.6,6X,F10.6)') &
430419
t_step, t_step*dt, icfl_max_glb, &
431420
vcfl_max_glb, &
432421
Rc_min_glb
433422
else
434-
write (1, '(13X,I8,14X,F10.6,13X,F9.6)') &
423+
write (3, '(13X,I8,14X,F10.6,13X,F9.6)') &
435424
t_step, t_step*dt, icfl_max_glb
436425
end if
437426

@@ -1637,23 +1626,22 @@ contains
16371626
subroutine s_close_run_time_information_file
16381627

16391628
real(kind(0d0)) :: run_time !< Run-time of the simulation
1640-
16411629
! Writing the footer of and closing the run-time information file
1642-
write (1, '(A)') '----------------------------------------'// &
1630+
write (3, '(A)') '----------------------------------------'// &
16431631
'----------------------------------------'
1644-
write (1, '(A)') ''
1632+
write (3, '(A)') ''
16451633

1646-
write (1, '(A,F9.6)') 'ICFL Max: ', icfl_max
1647-
if (any(Re_size > 0)) write (1, '(A,F9.6)') 'VCFL Max: ', vcfl_max
1648-
if (any(Re_size > 0)) write (1, '(A,F10.6)') 'Rc Min: ', Rc_min
1634+
write (3, '(A,F9.6)') 'ICFL Max: ', icfl_max
1635+
if (any(Re_size > 0)) write (3, '(A,F9.6)') 'VCFL Max: ', vcfl_max
1636+
if (any(Re_size > 0)) write (3, '(A,F10.6)') 'Rc Min: ', Rc_min
16491637

16501638
call cpu_time(run_time)
16511639

1652-
write (1, '(A)') ''
1653-
write (1, '(A,I0,A)') 'Run-time: ', int(anint(run_time)), 's'
1654-
write (1, '(A)') '========================================'// &
1640+
write (3, '(A)') ''
1641+
write (3, '(A,I0,A)') 'Run-time: ', int(anint(run_time)), 's'
1642+
write (3, '(A)') '========================================'// &
16551643
'========================================'
1656-
close (1)
1644+
close (3)
16571645

16581646
end subroutine s_close_run_time_information_file
16591647

0 commit comments

Comments
 (0)