Skip to content

Commit a314b0b

Browse files
authored
Fix post_process silo coord corruption from assumed-shape re-mapping (#1389)
1 parent ef86023 commit a314b0b

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/post_process/m_data_input.f90

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,17 @@ impure subroutine s_read_serial_data_files(t_step)
211211
call s_assign_default_bc_type(bc_type)
212212
end if
213213

214-
call s_read_grid_data_direction(t_step_dir, 'x', x_cb, dx, x_cc, m)
214+
! Pass explicit slices so the dummy `dimension(-1:)` / `dimension(0:)` arguments map to the correct interior indices of the
215+
! actual arrays. Without slicing, when offset_x%beg or buff_size > 0 (i.e. format=1 parallel 3D ranks), Fortran's
216+
! assumed-shape re-mapping shifts the read by that many slots and leaves the last interior cells uninitialized - corrupting
217+
! downstream ghost-cell extrapolation.
218+
call s_read_grid_data_direction(t_step_dir, 'x', x_cb(-1:m), dx(0:m), x_cc(0:m), m)
215219

216220
if (n > 0) then
217-
call s_read_grid_data_direction(t_step_dir, 'y', y_cb, dy, y_cc, n)
221+
call s_read_grid_data_direction(t_step_dir, 'y', y_cb(-1:n), dy(0:n), y_cc(0:n), n)
218222

219223
if (p > 0) then
220-
call s_read_grid_data_direction(t_step_dir, 'z', z_cb, dz, z_cc, p)
224+
call s_read_grid_data_direction(t_step_dir, 'z', z_cb(-1:p), dz(0:p), z_cc(0:p), p)
221225
end if
222226
end if
223227

0 commit comments

Comments
 (0)