@@ -76,14 +76,17 @@ contains
7676
7777 call nvtxStartRange(" SETUP-IBM-MODULE" )
7878
79+ $:GPU_UPDATE(device= ' [patch_ib(1:num_ibs)]' )
80+
7981 ! do all set up for moving immersed boundaries
82+ $:GPU_PARALLEL_LOOP(private= ' [i]' )
8083 do i = 1 , num_ibs
8184 if (patch_ib(i)%moving_ibm /= 0 ) then
8285 call s_compute_moment_of_inertia(i, patch_ib(i)%angular_vel)
8386 end if
8487 call s_update_ib_rotation_matrix(i)
8588 end do
86- $:GPU_UPDATE(device = ' [patch_ib(1:num_ibs)] ' )
89+ $:END_GPU_PARALLEL_LOOP( )
8790
8891 ! allocate some arrays for MPI communication, if required by this simulation
8992#ifdef MFC_MPI
@@ -868,13 +871,13 @@ contains
868871 $:END_GPU_PARALLEL_LOOP()
869872
870873 ! recalulcate the rotation matrix based upon the new angles
874+ $:GPU_PARALLEL_LOOP(private= ' [i]' )
871875 do i = 1 , num_ibs
872876 if (patch_ib(i)%moving_ibm /= 0 ) then
873877 call s_update_ib_rotation_matrix(i)
874878 end if
875879 end do
876-
877- $:GPU_UPDATE(device= ' [patch_ib]' )
880+ $:END_GPU_PARALLEL_LOOP()
878881
879882 ! recompute the new ib_patch locations and broadcast them.
880883 call nvtxStartRange(" APPLY-IB-PATCHES" )
@@ -933,7 +936,7 @@ contains
933936 $:GPU_PARALLEL_LOOP(private= ' [ib_idx, ib_idx_temp, encoded_ib_idx, fluid_idx, radial_vector, local_force_contribution, &
934937 & cell_volume, local_torque_contribution, dynamic_viscosity, viscous_stress_div, &
935938 & viscous_stress_div_1, viscous_stress_div_2, dx, dy, dz]' , copy= ' [forces, torques]' , &
936- & copyin= ' [patch_ib, dynamic_viscosities]' , collapse= 3 )
939+ & copyin= ' [dynamic_viscosities]' , collapse= 3 )
937940 do i = 0 , m
938941 do j = 0 , n
939942 do k = 0 , p
@@ -1122,6 +1125,8 @@ contains
11221125 !> Computes the moment of inertia for an immersed boundary
11231126 subroutine s_compute_moment_of_inertia (ib_idx , axis )
11241127
1128+ $:GPU_ROUTINE(parallelism= ' [seq]' )
1129+
11251130 real (wp), dimension (3 ), intent (in ) :: axis !< the axis about which we compute the moment. Only required in 3D .
11261131 integer , intent (in ) :: ib_idx
11271132 real (wp) :: moment, distance_to_axis, cell_volume
@@ -1158,13 +1163,10 @@ contains
11581163
11591164 ib_marker = patch_ib(ib_idx)%gbl_patch_id
11601165
1161- $:GPU_PARALLEL_LOOP(private= ' [position, closest_point_along_axis, vector_to_axis, distance_to_axis]' , copy= ' [moment, &
1162- & count]' , copyin= ' [ib_marker, cell_volume, normal_axis]' , collapse= 3 )
11631166 do i = 0 , m
11641167 do j = 0 , n
11651168 do k = 0 , p
11661169 if (ib_markers%sf(i, j, k) == ib_marker) then
1167- $:GPU_ATOMIC(atomic= ' update' )
11681170 count = count + 1 ! increment the count of total cells in the boundary
11691171
11701172 ! get the position in local coordinates so that the axis passes through 0 , 0 , 0
@@ -1182,7 +1184,6 @@ contains
11821184 distance_to_axis = dot_product (vector_to_axis, vector_to_axis) ! saves the distance to the axis squared
11831185
11841186 ! compute the position component of the moment
1185- $:GPU_ATOMIC(atomic= ' update' )
11861187 moment = moment + distance_to_axis
11871188 end if
11881189 end do
0 commit comments