From c6a638c1ab111d67d7a24bef972b4e4b450d3aa9 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sat, 21 Feb 2026 00:02:40 -0500 Subject: [PATCH 1/3] Fix hyper_cleaning psi initialization only covering k=0 plane Co-Authored-By: Claude Opus 4.6 --- src/pre_process/m_start_up.fpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pre_process/m_start_up.fpp b/src/pre_process/m_start_up.fpp index 3b45547c29..b631211ef5 100644 --- a/src/pre_process/m_start_up.fpp +++ b/src/pre_process/m_start_up.fpp @@ -767,7 +767,7 @@ contains real(wp), intent(inout) :: start, finish - integer :: j, k + integer :: j, k, l ! Setting up the grid and the initial condition. If the grid is read in from ! preexisting grid data files, it is checked for consistency. If the grid is @@ -787,10 +787,12 @@ contains ! hard-coded psi if (hyper_cleaning) then - do j = 0, m + do l = 0, p do k = 0, n - q_cons_vf(psi_idx)%sf(j, k, 0) = 1d-2*exp(-(x_cc(j)**2 + y_cc(k)**2)/(2.0*0.05**2)) - q_prim_vf(psi_idx)%sf(j, k, 0) = q_cons_vf(psi_idx)%sf(j, k, 0) + do j = 0, m + 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)) + q_prim_vf(psi_idx)%sf(j, k, l) = q_cons_vf(psi_idx)%sf(j, k, l) + end do end do end do end if From 3cba77caa9ae5b5b05831aec2cc2f7b613913bb2 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sat, 21 Feb 2026 00:11:44 -0500 Subject: [PATCH 2/3] 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 --- src/pre_process/m_start_up.fpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pre_process/m_start_up.fpp b/src/pre_process/m_start_up.fpp index b631211ef5..f02dc27f65 100644 --- a/src/pre_process/m_start_up.fpp +++ b/src/pre_process/m_start_up.fpp @@ -790,7 +790,11 @@ contains do l = 0, p do k = 0, n do j = 0, m - 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)) + if (p > 0) then + 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)) + else + 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)) + end if q_prim_vf(psi_idx)%sf(j, k, l) = q_cons_vf(psi_idx)%sf(j, k, l) end do end do From 116d256d535b94c00aab4c45d93d958dcf3bd22a Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sat, 21 Feb 2026 01:13:27 -0500 Subject: [PATCH 3/3] Fix mixed-precision literals in hyper_cleaning psi initialization Replace `1d-2` (hard double precision) and bare `2.0`/`0.05` (default real) with `_wp`-suffixed literals so the Gaussian initialization is consistent with the working precision across single and double builds. Co-Authored-By: Claude Sonnet 4.6 --- src/pre_process/m_start_up.fpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pre_process/m_start_up.fpp b/src/pre_process/m_start_up.fpp index f02dc27f65..1f349ab139 100644 --- a/src/pre_process/m_start_up.fpp +++ b/src/pre_process/m_start_up.fpp @@ -791,9 +791,9 @@ contains do k = 0, n do j = 0, m if (p > 0) then - 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)) + q_cons_vf(psi_idx)%sf(j, k, l) = 1.0e-2_wp*exp(-(x_cc(j)**2 + y_cc(k)**2 + z_cc(l)**2)/(2.0_wp*0.05_wp**2)) else - 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)) + q_cons_vf(psi_idx)%sf(j, k, l) = 1.0e-2_wp*exp(-(x_cc(j)**2 + y_cc(k)**2)/(2.0_wp*0.05_wp**2)) end if q_prim_vf(psi_idx)%sf(j, k, l) = q_cons_vf(psi_idx)%sf(j, k, l) end do