From 625a616319e90ebd3469483431f07d3b7f8d26f7 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Fri, 9 Oct 2026 23:10:37 -0400 Subject: [PATCH] Read 2D chemistry probe species after locating the probe In the 2D branch of s_write_probe_files the species partial densities were read from q_cons_vf(j-2, k-2, l) before j, k and l were computed for the current probe and outside the ownership check, so they used the previous probe's cell or, for the first probe, uninitialized indices. A gfortran debug run of a 2D chemistry case with probes aborted on an out-of-bounds index. Move the read inside the ownership branch after the indices are set, as in the 1D and 3D branches. --- src/simulation/m_data_output.fpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/simulation/m_data_output.fpp b/src/simulation/m_data_output.fpp index 112ea52a2..c6474469a 100644 --- a/src/simulation/m_data_output.fpp +++ b/src/simulation/m_data_output.fpp @@ -1659,12 +1659,6 @@ contains accel = accel_mag(j - 2, k, l) end if else if (p == 0) then - if (chemistry) then - do d = 1, num_species - rhoYks(d) = q_cons_vf(eqn_idx%species%beg + d - 1)%sf(j - 2, k - 2, l) - end do - end if - if (f_probe_owned(probe(i)%x, x_cb(-1), x_cb(m), 1)) then if (f_probe_owned(probe(i)%y, y_cb(-1), y_cb(n), 2)) then do s = -1, m @@ -1694,6 +1688,12 @@ contains dyn_p = 0.5_wp*rho*dot_product(vel, vel) + if (chemistry) then + do d = 1, num_species + rhoYks(d) = q_cons_vf(eqn_idx%species%beg + d - 1)%sf(j - 2, k - 2, l) + end do + end if + if (hypoelasticity) then if (cont_damage) then ! Recover D = U_D/m_s, clamped to [0, 1]