Skip to content

Commit 94eea42

Browse files
Fixed bounding-box issues with cylinder and rectangles
1 parent 0072f07 commit 94eea42

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/simulation/m_ib_patches.fpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,8 @@ contains
465465
jl = -gp_layers - 1
466466
ir = m + gp_layers + 1
467467
jr = n + gp_layers + 1
468-
corner_distance = sqrt(dot_product(length, length))/2._wp ! maximum distance any marker can be from the center
468+
! maximum distance any marker can be from the center
469+
corner_distance = 0.5_wp*sqrt(patch_ib(patch_id)%length_x**2 + patch_ib(patch_id)%length_y**2)
469470
call get_bounding_indices(center(1) - corner_distance, center(1) + corner_distance, x_cc, il, ir)
470471
call get_bounding_indices(center(2) - corner_distance, center(2) + corner_distance, y_cc, jl, jr)
471472

@@ -622,6 +623,7 @@ contains
622623
center(1) = patch_ib(patch_id)%x_centroid + real(xp, wp)*(x_domain%end - x_domain%beg)
623624
center(2) = patch_ib(patch_id)%y_centroid + real(yp, wp)*(y_domain%end - y_domain%beg)
624625
center(3) = patch_ib(patch_id)%z_centroid + real(zp, wp)*(z_domain%end - z_domain%beg)
626+
length = [patch_ib(patch_id)%length_x, patch_ib(patch_id)%length_y, patch_ib(patch_id)%length_z]
625627
626628
! encode the periodicity information into the patch_id
627629
call s_encode_patch_periodicity(patch_ib(patch_id)%gbl_patch_id, xp, yp, zp, encoded_patch_id)

0 commit comments

Comments
 (0)