From 77272732febc6dd7f1627ef5223b9f097940e76e Mon Sep 17 00:00:00 2001 From: Billy Cao Date: Thu, 27 Aug 2026 04:08:53 +0000 Subject: [PATCH] m_bubbles_EL: delete non-finite bubbles in the boundary enforcement s_enforce_EL_bubbles_boundary_conditions deletes out-of-range bubbles with pos >= x_cb(m) / pos < x_cb(-1) which are both FALSE for a NaN position, so a bubble whose state went non-finite survives, and its NaN mtn_s reaches s_get_cell/s_compute_stddsv, where int(NaN)=INT_MIN indexes dx out of bounds (CUDA_ERROR_ILLEGAL_ADDRESS on GPU at ~step 96). Fold each pair into a single .not.(in-range) guard, bit-identical for finite positions (and +/-Inf, already caught) but also removing NaN. Reproduced and fixed on 80CC6F73 at 200 steps. --- src/simulation/m_bubbles_EL.fpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/simulation/m_bubbles_EL.fpp b/src/simulation/m_bubbles_EL.fpp index 62a512ef1..42191ee62 100644 --- a/src/simulation/m_bubbles_EL.fpp +++ b/src/simulation/m_bubbles_EL.fpp @@ -1361,9 +1361,7 @@ contains & 2) <= pcomm_coords(1)%end) then wrap_bubble_dir(k, 1) = 1 wrap_bubble_loc(k, 1) = 1 - else if (mtn_pos(k, 1, 2) >= x_cb(m)) then - keep_bubble(k) = 0 - else if (mtn_pos(k, 1, 2) < x_cb(-1)) then + else if (.not. (mtn_pos(k, 1, 2) >= x_cb(-1) .and. mtn_pos(k, 1, 2) < x_cb(m))) then keep_bubble(k) = 0 end if @@ -1381,9 +1379,7 @@ contains & 2) <= pcomm_coords(2)%end) then wrap_bubble_dir(k, 2) = 1 wrap_bubble_loc(k, 2) = 1 - else if (mtn_pos(k, 2, 2) >= y_cb(n)) then - keep_bubble(k) = 0 - else if (mtn_pos(k, 2, 2) < y_cb(-1)) then + else if (.not. (mtn_pos(k, 2, 2) >= y_cb(-1) .and. mtn_pos(k, 2, 2) < y_cb(n))) then keep_bubble(k) = 0 end if @@ -1402,9 +1398,7 @@ contains & 2) <= pcomm_coords(3)%end) then wrap_bubble_dir(k, 3) = 1 wrap_bubble_loc(k, 3) = 1 - else if (mtn_pos(k, 3, 2) >= z_cb(p)) then - keep_bubble(k) = 0 - else if (mtn_pos(k, 3, 2) < z_cb(-1)) then + else if (.not. (mtn_pos(k, 3, 2) >= z_cb(-1) .and. mtn_pos(k, 3, 2) < z_cb(p))) then keep_bubble(k) = 0 end if end if