Skip to content

Commit efced0f

Browse files
committed
AMR batched IB correction: hold amr_bat_n at 1 while the members are corrected (s_amr_swap_to_fine extends the grid into the slab for amr_bat_n > 1, and the correction kernel must see the member's extents -- ib_markers is sized to a block); the validator keeps moving particle clouds out of batching as it does moving bodies
1 parent a984dab commit efced0f

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

src/simulation/m_amr.fpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8593,7 +8593,7 @@ contains
85938593
type(scalar_field), intent(inout) :: q_T_sf
85948594
real(stp), dimension(:,:,:,:,:), intent(inout) :: pb_in, mv_in
85958595
real(wp), dimension(:,:,:,:,:), intent(inout) :: rhs_pb, rhs_mv
8596-
integer :: i, j, g, h, ibm, loc
8596+
integer :: i, j, g, h, ibm, loc, nb
85978597
logical, allocatable :: done(:)
85988598
logical :: last_batch
85998599
real(wp) :: tb0, tb1, tb2, tb3, tb4
@@ -8671,11 +8671,15 @@ contains
86718671
! the per-block path corrects the body/ghost cells right after each block's RK update (s_amr_fine_stage_rk);
86728672
! here once per member after the batch's update, in the member's own frame -- the correction reads only the
86738673
! member's own cells, so the order across members does not matter. Ledger 99 found what its absence did.
8674-
do ibm = 1, amr_bat_n
8674+
! amr_bat_n = 1 while the members are corrected: s_amr_swap_to_fine extends the installed grid into the slab
8675+
! whenever amr_bat_n > 1, and the correction must see the MEMBER's extents (ib_markers is sized to a block).
8676+
nb = amr_bat_n; amr_bat_n = 1
8677+
do ibm = 1, nb
86758678
call s_amr_select_slot(amr_bat_blk(ibm))
86768679
call s_amr_bat_member_prim(ibm, amr_scr_prim, amr_scr_prim_blk)
86778680
call s_amr_ib_correct_fine(amr_scr_prim_blk)
86788681
end do
8682+
amr_bat_n = nb
86798683
end if
86808684
call s_phase_toc(PH_RK)
86818685
tb4 = f_amr_wtime()

toolchain/mfc/case_validator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,8 +1750,12 @@ def check_amr(self):
17501750
# static bodies: the batched advance applies s_amr_ib_correct_fine per member after the batch update; the moving-body
17511751
# update (s_amr_update_mib_fine) is still a per-block hook
17521752
self.prohibit(
1753-
self.get("ib", "F") == "T" and any((self.get(f"patch_ib({i})%moving_ibm") or 0) != 0 for i in range(1, int(self.get("num_ibs") or 0) + 1)),
1754-
"amr_batched_advance supports static immersed bodies only (moving_ibm /= 0 is a per-block hook in the fine advance)",
1753+
self.get("ib", "F") == "T"
1754+
and (
1755+
any((self.get(f"patch_ib({i})%moving_ibm") or 0) != 0 for i in range(1, int(self.get("num_ibs") or 0) + 1))
1756+
or any((self.get(f"particle_cloud({i})%moving_ibm") or 0) != 0 for i in range(1, int(self.get("num_particle_clouds") or 0) + 1))
1757+
),
1758+
"amr_batched_advance supports static immersed bodies only (a moving body or particle cloud is a per-block hook in the fine advance)",
17551759
)
17561760
self.prohibit(
17571761
not (amr_max_grid_size is not None and amr_max_grid_size > 0),

0 commit comments

Comments
 (0)