From 9892f4394b2bd6ea75136374456734ceeae7bde4 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Thu, 26 Feb 2026 21:19:45 -0500 Subject: [PATCH] Fix serial I/O missing beta for bubbles_lagrange in post_process With parallel_io=F (serial), s_write_serial_data_files did not write the Lagrangian void fraction (beta) to p_all/ as q_cons_vf(sys_size+1), while s_write_parallel_data_files correctly does so via alt_sys=sys_size+1. This caused post_process to abort with "q_cons_vf8.dat is missing" for any serial Lagrangian bubble case. Two changes: 1. m_data_output.fpp: write beta as q_cons_vf(sys_size+1) in serial path, mirroring the parallel I/O path. 2. m_data_input.f90: t_step_start output is written by pre_process, which does not know about Lagrangian beta; initialize beta to zero for that timestep rather than aborting. Co-Authored-By: Claude Sonnet 4.6 --- src/post_process/m_data_input.f90 | 4 ++++ src/simulation/m_data_output.fpp | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/post_process/m_data_input.f90 b/src/post_process/m_data_input.f90 index a3e3f22886..6eee4e3f8b 100644 --- a/src/post_process/m_data_input.f90 +++ b/src/post_process/m_data_input.f90 @@ -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. + 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)// & diff --git a/src/simulation/m_data_output.fpp b/src/simulation/m_data_output.fpp index 5051d5e15d..096b16d91d 100644 --- a/src/simulation/m_data_output.fpp +++ b/src/simulation/m_data_output.fpp @@ -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 + if (qbmm .and. .not. polytropic) then do i = 1, nb do r = 1, nnode