Skip to content
Merged
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: 4 additions & 0 deletions src/post_process/m_data_input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ impure subroutine s_read_serial_data_files(t_step)
STATUS='old', ACTION='read')
read (1) q_cons_vf(i)%sf(0:m, 0:n, 0:p)
close (1)
else if (bubbles_lagrange .and. i == beta_idx) then
! beta (Lagrangian void fraction) is not written by pre_process
! for t_step_start; initialize to zero.
Comment on lines +315 to +317
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fallback initializes beta to zero whenever the beta file is missing, for any t_step. That can silently hide real I/O/data corruption for later steps (and yield incorrect post-processed results). Consider restricting the zero-initialization to the known pre_process-only step (e.g., t_step == t_step_start / the first step being processed), and keep aborting for missing beta files at other timesteps (or at least emit a clear warning).

Suggested change
else if (bubbles_lagrange .and. i == beta_idx) then
! beta (Lagrangian void fraction) is not written by pre_process
! for t_step_start; initialize to zero.
else if (bubbles_lagrange .and. i == beta_idx .and. t_step == t_step_start) then
! beta (Lagrangian void fraction) is not written by pre_process
! for t_step_start; initialize to zero only on that timestep.

Copilot uses AI. Check for mistakes.
q_cons_vf(i)%sf(0:m, 0:n, 0:p) = 0._wp
else
call s_mpi_abort('File q_cons_vf'//trim(file_num)// &
'.dat is missing in '//trim(t_step_dir)// &
Expand Down
13 changes: 13 additions & 0 deletions src/simulation/m_data_output.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,19 @@ contains
write (2) q_cons_vf(i)%sf(0:m, 0:n, 0:p); close (2)
end do

! Lagrangian beta (void fraction) written as q_cons_vf(sys_size+1) to
! match the parallel I/O path and allow post_process to read it.
if (bubbles_lagrange) then
write (file_path, '(A,I0,A)') trim(t_step_dir)//'/q_cons_vf', &
sys_size + 1, '.dat'

open (2, FILE=trim(file_path), &
FORM='unformatted', &
STATUS='new')

write (2) beta%sf(0:m, 0:n, 0:p); close (2)
end if
Comment on lines +479 to +490
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beta is an OPTIONAL dummy argument, but this block dereferences beta%sf guarded only by bubbles_lagrange. If s_write_serial_data_files is called without the optional beta actual argument (even if bubbles_lagrange is true due to input/state), this will be an invalid reference at runtime. Guard the write with present(beta) (and optionally also bubbles_lagrange) to match the parallel I/O path’s logic.

Copilot uses AI. Check for mistakes.

if (qbmm .and. .not. polytropic) then
do i = 1, nb
do r = 1, nnode
Expand Down
Loading