Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,9 @@ row = t_step / ib_force_stride - t_step_start / ib_force_stride - 1
offset = (row * num_ibs + ib_id - 1) * 353
```

Rows count from the first step the run records, not from `t_step`, so row 0 is the first row of the file whether the run starts at step 0 or resumes from a restart. The first recorded step is the first multiple of `ib_force_stride` after `t_step_start`; `t_step_start` itself is skipped, because at that point the force is still the one from before the run began.
Rows count from the first step the run records, not from `t_step`, so row 0 is the first row of the file whether the run starts at step 0 or resumes from a restart. The first recorded step is the first multiple of `ib_force_stride` after `t_step_start`; `t_step_start` itself is skipped, because at that point the force is still the one from before the run began. The last row is the run's final step if that step is a multiple of `ib_force_stride`, and otherwise the last multiple before it.

A resumed run writes `D/ib_forces_<t_step_start>.dat` (`D/ib_forces_n<n_start>.dat` with `cfl_dt`) instead of overwriting `D/ib_forces.dat`. When each run resumes from the final step of the run before it, the files concatenate in order with no row repeated and none of the `ib_force_stride` sampling missing. This holds for any stride with a fixed `dt`. With `cfl_dt` the step counter restarts at 0 in each run, so only `ib_force_stride = 1` gives an unbroken history; a larger stride can leave up to `ib_force_stride - 1` unrecorded steps at the end of each run. A run killed mid-way has no final row and may hold rows past the restart it is resumed from.

Rows are written in global body-id order, so the file is byte-identical however the domain is decomposed, and no merge step is needed after a parallel run.

Expand Down
9 changes: 8 additions & 1 deletion src/simulation/m_data_output.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,14 @@ contains
@:PROHIBIT(len_trim(probe) /= IB_REC_BODY, &
& "IB force record width disagrees with IB_REC_BODY; IB_REC_FMT and IB_REC_BODY must be changed together")

file_loc = trim(case_dir) // '/D/ib_forces.dat'
! A resumed run writes its own file rather than overwriting the history of the runs before it
if (cfl_dt .and. n_start > 0) then
write (file_loc, '(A,I0,A)') trim(case_dir) // '/D/ib_forces_n', n_start, '.dat'
else if (t_step_start > 0) then
write (file_loc, '(A,I0,A)') trim(case_dir) // '/D/ib_forces_', t_step_start, '.dat'
Comment thread
sbryngelson marked this conversation as resolved.
else
file_loc = trim(case_dir) // '/D/ib_forces.dat'
end if
#ifdef MFC_MPI
! MPI_MODE_CREATE does not truncate, so a shorter run following a longer one in the same
! directory would keep the old tail past its last record. Delete first, as the ib_state
Expand Down
4 changes: 4 additions & 0 deletions src/simulation/p_main.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ program p_main
use m_global_parameters
use m_start_up
use m_time_steppers
use m_data_output, only: s_write_ib_force_history
use m_nvtx

implicit none
Expand Down Expand Up @@ -90,6 +91,9 @@ program p_main
call system_clock(cpu_end)
end do

! Step N's IB force record is written at the start of step N, which the loop never reaches for its last step
if (ib_state_wrt) call s_write_ib_force_history(t_step)

call nvtxEndRange ! Simulation

deallocate (proc_time, io_proc_time)
Expand Down
2 changes: 1 addition & 1 deletion tests/135F548B/golden.txt

Large diffs are not rendered by default.

147 changes: 72 additions & 75 deletions tests/1D4832F8/golden-metadata.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading