Skip to content

Commit b1b14cd

Browse files
sbryngelsonclaude
andcommitted
Guard z_cc access in hyper_cleaning init for 2D case (p=0)
z_cc is only allocated when p > 0. The previous commit accessed z_cc(l) unconditionally, which would crash or read garbage in 2D runs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4b34ed9 commit b1b14cd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/pre_process/m_start_up.fpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,11 @@ contains
788788
do l = 0, p
789789
do k = 0, n
790790
do j = 0, m
791-
q_cons_vf(psi_idx)%sf(j, k, l) = 1d-2*exp(-(x_cc(j)**2 + y_cc(k)**2 + z_cc(l)**2)/(2.0*0.05**2))
791+
if (p > 0) then
792+
q_cons_vf(psi_idx)%sf(j, k, l) = 1d-2*exp(-(x_cc(j)**2 + y_cc(k)**2 + z_cc(l)**2)/(2.0*0.05**2))
793+
else
794+
q_cons_vf(psi_idx)%sf(j, k, l) = 1d-2*exp(-(x_cc(j)**2 + y_cc(k)**2)/(2.0*0.05**2))
795+
end if
792796
q_prim_vf(psi_idx)%sf(j, k, l) = q_cons_vf(psi_idx)%sf(j, k, l)
793797
end do
794798
end do

0 commit comments

Comments
 (0)