Skip to content

Commit c07b6a0

Browse files
Deleted buggy deprecated code
1 parent 05fbe8f commit c07b6a0

1 file changed

Lines changed: 8 additions & 56 deletions

File tree

src/simulation/m_ib_patches.fpp

Lines changed: 8 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ module m_ib_patches
2121

2222
implicit none
2323

24-
private; public :: s_apply_ib_patches, s_update_ib_rotation_matrix, f_convert_cyl_to_cart, s_instantiate_STL_models, &
25-
& s_decode_patch_periodicity
26-
27-
real(wp) :: cart_y, cart_z
28-
$:GPU_DECLARE(create='[cart_y, cart_z]')
29-
! Variables to be used to hold cell locations in Cartesian coordinates if 3D simulation is using cylindrical coordinates
24+
private; public :: s_apply_ib_patches, s_update_ib_rotation_matrix, s_instantiate_STL_models, s_decode_patch_periodicity
3025

3126
contains
3227

@@ -542,18 +537,12 @@ contains
542537
543538
! Checking whether the sphere covers a particular cell in the domain and verifying whether the current patch has permission
544539
! to write to that cell. If both queries check out, the primitive variables of the current patch are assigned to this cell.
545-
$:GPU_PARALLEL_LOOP(private='[i, j, k, cart_y, cart_z]', copyin='[encoded_patch_id, center, radius]', collapse=3)
540+
$:GPU_PARALLEL_LOOP(private='[i, j, k]', copyin='[encoded_patch_id, center, radius]', collapse=3)
546541
do k = kl, kr
547542
do j = jl, jr
548543
do i = il, ir
549-
if (grid_geometry == 3) then
550-
call s_convert_cylindrical_to_cartesian_coord(y_cc(j), z_cc(k))
551-
else
552-
cart_y = y_cc(j)
553-
cart_z = z_cc(k)
554-
end if
555544
! Updating the patch identities bookkeeping variable
556-
if (((x_cc(i) - center(1))**2 + (cart_y - center(2))**2 + (cart_z - center(3))**2 <= radius**2)) then
545+
if (((x_cc(i) - center(1))**2 + (y_cc(j) - center(2))**2 + (z_cc(k) - center(3))**2 <= radius**2)) then
557546
ib_markers%sf(i, j, k) = encoded_patch_id
558547
end if
559548
end do
@@ -603,19 +592,12 @@ contains
603592
! Checking whether the cuboid covers a particular cell in the domain and verifying whether the current patch has permission
604593
! to write to to that cell. If both queries check out, the primitive variables of the current patch are assigned to this
605594
! cell.
606-
$:GPU_PARALLEL_LOOP(private='[i, j, k, xyz_local, cart_y, cart_z]', copyin='[encoded_patch_id, center, length, &
607-
& inverse_rotation]', collapse=3)
595+
$:GPU_PARALLEL_LOOP(private='[i, j, k, xyz_local]', copyin='[encoded_patch_id, center, length, inverse_rotation]', &
596+
& collapse=3)
608597
do k = kl, kr
609598
do j = jl, jr
610599
do i = il, ir
611-
if (grid_geometry == 3) then
612-
! TODO :: This does not work and is not covered by any tests. This should be fixed
613-
call s_convert_cylindrical_to_cartesian_coord(y_cc(j), z_cc(k))
614-
else
615-
cart_y = y_cc(j)
616-
cart_z = z_cc(k)
617-
end if
618-
xyz_local = [x_cc(i), cart_y, cart_z] - center ! get coordinate frame centered on IB
600+
xyz_local = [x_cc(i), y_cc(j), z_cc(k)] - center ! get coordinate frame centered on IB
619601
xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinates
620602
621603
if (-0.5*length(1) <= xyz_local(1) .and. 0.5*length(1) >= xyz_local(1) .and. -0.5*length(2) <= xyz_local(2) &
@@ -672,18 +654,12 @@ contains
672654
! Checking whether the cylinder covers a particular cell in the domain and verifying whether the current patch has the
673655
! permission to write to that cell. If both queries check out, the primitive variables of the current patch are assigned to
674656
! this cell.
675-
$:GPU_PARALLEL_LOOP(private='[i, j, k, xyz_local, cart_y, cart_z]', copyin='[encoded_patch_id, center, length, radius, &
657+
$:GPU_PARALLEL_LOOP(private='[i, j, k, xyz_local]', copyin='[encoded_patch_id, center, length, radius, &
676658
& inverse_rotation]', collapse=3)
677659
do k = kl, kr
678660
do j = jl, jr
679661
do i = il, ir
680-
if (grid_geometry == 3) then
681-
call s_convert_cylindrical_to_cartesian_coord(y_cc(j), z_cc(k))
682-
else
683-
cart_y = y_cc(j)
684-
cart_z = z_cc(k)
685-
end if
686-
xyz_local = [x_cc(i), cart_y, cart_z] - center ! get coordinate frame centered on IB
662+
xyz_local = [x_cc(i), y_cc(j), z_cc(k)] - center ! get coordinate frame centered on IB
687663
xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinates
688664
689665
if (((.not. f_is_default(length(1)) .and. xyz_local(2)**2 + xyz_local(3)**2 <= radius**2 .and. &
@@ -963,30 +939,6 @@ contains
963939

964940
end subroutine s_update_ib_rotation_matrix
965941

966-
!> Convert cylindrical (r, theta) coordinates to Cartesian (y, z)
967-
subroutine s_convert_cylindrical_to_cartesian_coord(cyl_y, cyl_z)
968-
969-
$:GPU_ROUTINE(parallelism='[seq]')
970-
971-
real(wp), intent(in) :: cyl_y, cyl_z
972-
973-
cart_y = cyl_y*sin(cyl_z)
974-
cart_z = cyl_y*cos(cyl_z)
975-
976-
end subroutine s_convert_cylindrical_to_cartesian_coord
977-
978-
!> Convert a 3D cylindrical coordinate vector (x, r, theta) to Cartesian (x, y, z)
979-
pure function f_convert_cyl_to_cart(cyl) result(cart)
980-
981-
$:GPU_ROUTINE(parallelism='[seq]')
982-
983-
real(wp), dimension(1:3), intent(in) :: cyl
984-
real(wp), dimension(1:3) :: cart
985-
986-
cart = (/cyl(1), cyl(2)*sin(cyl(3)), cyl(2)*cos(cyl(3))/)
987-
988-
end function f_convert_cyl_to_cart
989-
990942
subroutine get_bounding_indices(left_bound, right_bound, cell_centers, left_index, right_index)
991943

992944
real(wp), intent(in) :: left_bound, right_bound

0 commit comments

Comments
 (0)