Skip to content

Commit 5b7d49c

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 2274551 commit 5b7d49c

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
@@ -790,7 +790,11 @@ contains
790790
do l = 0, p
791791
do k = 0, n
792792
do j = 0, m
793-
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+
if (p > 0) then
794+
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))
795+
else
796+
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))
797+
end if
794798
q_prim_vf(psi_idx)%sf(j, k, l) = q_cons_vf(psi_idx)%sf(j, k, l)
795799
end do
796800
end do

0 commit comments

Comments
 (0)