Skip to content

IB markers: index each save by the save count under CFL time stepping - #1961

Closed
sbryngelson wants to merge 1 commit into
MFlowCode:masterfrom
sbryngelson:fix-ib-markers-cfl
Closed

sbryngelson wants to merge 1 commit into
MFlowCode:masterfrom
sbryngelson:fix-ib-markers-cfl

Conversation

@sbryngelson

@sbryngelson sbryngelson commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Summary

With CFL-based time stepping (cfl_adap_dt or cfl_const_dt) and parallel_io = T (shared file, not file_per_process), post_process shows the wrong immersed-boundary markers for moving IBs: every save in a block of 100 shows the markers of that block's last save.

The simulation writes each save's ib_markers into restart_data/lustre_ib.dat at an offset set by the save number, computed as time_step/t_step_save, and post_process reads it back the same way. Under CFL stepping the caller already passes the save count (save_count = int(mytime/t_save)), and t_step_save keeps its default of −100. So k/(-100) is 0 for saves 1–99, −1 for 100–199, and so on: saves overwrite one slot. Fixed-dt runs are unaffected.

Change

  • f_save_index(t_step, cfl_mode, t_step_save) in m_helper_basic returns t_step under CFL stepping, else t_step/t_step_save. The writer (s_write_parallel_ib_data) and the reader (s_read_ib_data_files) both use it, so the two cannot drift apart.
  • The file layout is unchanged, so existing fixed-dt output still reads.

Verification

A 2D moving cylinder, 100×100, cfl_adap_dt = T, 8 saves, parallel_io = T, 2 ranks. For each save, the centroid of the post_process ib_markers field was compared with the IB centre in restart_data/ib_state_<save>.dat.

Marker centroid error vs IB centre
master saves 1–7 all show save 7's markers; errors of 4.24, 3.52, 2.80, 2.08 and 1.36 cells at saves 1–5
this PR ≤ 0.17 cells at every save

Found while rendering a 201-save shock–particle-curtain run with 38 moving reacting particles, where markers at save 40 sat 0.5 mm from the particles.

./mfc.sh test -o IBM: 61 passed. No regression test is added: the suite has no pattern for checking post_process output against IB state.

The bug was found and verified as described above.

Acknowledgement

  • I confirm this PR meets the above expectations and reflects my own understanding and real-world context.

Consolidated into #1960. The source changes are retained as separate commits, and this original description is reproduced in full there. Original discussion remains available here.

Under cfl_dt the caller passes the save count and t_step_save is left at its
default, so t_step/t_step_save collapsed saves 1-99 onto one slot in
lustre_ib.dat. Share one f_save_index between writer and post_process reader.
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Lines of Code

File Lines Diff
src/common/m_helper_basic.fpp 123 +5
src/post_process/m_data_input.f90 440 +1
Directory Lines Diff
common 10453 +5
post_process 3500 +1
total 47432 +6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant