@@ -637,6 +637,42 @@ contains
637637 z_cc(0 :amr_fine%p) = amr_fine%z_cc(0 :amr_fine%p)
638638 dz(0 :amr_fine%p) = amr_fine%dz(0 :amr_fine%p)
639639 end if
640+ ! Extend the fine grid into the ghost shell (s_build_level_coords only fills the interior 0 :m).
641+ ! The viscous velocity gradient divides by ghost cell- center spacings (x_cc(j+- 1 ) - x_cc(j)), so at
642+ ! a rank seam the fine subdomain- edge cell would otherwise use a stale coarse spacing and diverge
643+ ! from the np= 1 (fully- owned) result. Uniform 2 :1 continuation of the (locally- uniform) base region.
644+ block
645+ integer :: jg
646+ real (wp) :: sp
647+ sp = amr_fine%dx(amr_fine%m)
648+ do jg = amr_fine%m + 1 , amr_fine%m + buff_size
649+ dx(jg) = sp; x_cb(jg) = x_cb(jg - 1 ) + sp; x_cc(jg) = x_cc(jg - 1 ) + sp
650+ end do
651+ sp = amr_fine%dx(0 )
652+ do jg = - 1 , - buff_size, - 1
653+ dx(jg) = sp; x_cb(jg - 1 ) = x_cb(jg) - sp; x_cc(jg) = x_cc(jg + 1 ) - sp
654+ end do
655+ if (n_glb > 0 ) then
656+ sp = amr_fine%dy(amr_fine%n)
657+ do jg = amr_fine%n + 1 , amr_fine%n + buff_size
658+ dy(jg) = sp; y_cb(jg) = y_cb(jg - 1 ) + sp; y_cc(jg) = y_cc(jg - 1 ) + sp
659+ end do
660+ sp = amr_fine%dy(0 )
661+ do jg = - 1 , - buff_size, - 1
662+ dy(jg) = sp; y_cb(jg - 1 ) = y_cb(jg) - sp; y_cc(jg) = y_cc(jg + 1 ) - sp
663+ end do
664+ end if
665+ if (p_glb > 0 ) then
666+ sp = amr_fine%dz(amr_fine%p)
667+ do jg = amr_fine%p + 1 , amr_fine%p + buff_size
668+ dz(jg) = sp; z_cb(jg) = z_cb(jg - 1 ) + sp; z_cc(jg) = z_cc(jg - 1 ) + sp
669+ end do
670+ sp = amr_fine%dz(0 )
671+ do jg = - 1 , - buff_size, - 1
672+ dz(jg) = sp; z_cb(jg - 1 ) = z_cb(jg) - sp; z_cc(jg) = z_cc(jg + 1 ) - sp
673+ end do
674+ end if
675+ end block
640676 ! sync the swapped extents/ bounds/ coordinates to the device: RHS kernels read the
641677 ! device copies of these GPU_DECLARE' d globals (stale coarse bounds = OOB kernels)
642678 call s_amr_sync_grid_state_to_device()
0 commit comments