@@ -77,7 +77,7 @@ contains
7777 integer :: global_id
7878 real (wp), dimension (3 ) :: dist_vec
7979
80- real (wp), dimension (1 :3 ) :: xy_local !< x and y coordinates in local IB frame
80+ real (wp), dimension (1 :3 ) :: xy_local, offset !< x and y coordinates in local IB frame
8181 real (wp), dimension (1 :2 ) :: center
8282 real (wp), dimension (1 :3 , 1 :3 ) :: rotation, inverse_rotation
8383
@@ -87,14 +87,15 @@ contains
8787 center(2 ) = patch_ib(ib_patch_id)%y_centroid
8888 inverse_rotation(:, :) = patch_ib(ib_patch_id)%rotation_matrix_inverse(:, :)
8989 rotation(:, :) = patch_ib(ib_patch_id)%rotation_matrix(:, :)
90+ offset(:) = patch_ib(ib_patch_id)%centroid_offset(:)
9091
9192 $:GPU_PARALLEL_LOOP(private= ' [i,j,xy_local,k,dist_vec,dist,global_dist,global_id]' , &
92- & copyin= ' [ib_patch_id,center,rotation,inverse_rotation,airfoil_grid_u,airfoil_grid_l]' , collapse= 2 )
93+ & copyin= ' [ib_patch_id,center,rotation,inverse_rotation,offset, airfoil_grid_u,airfoil_grid_l]' , collapse= 2 )
9394 do i = 0 , m
9495 do j = 0 , n
9596 xy_local = [x_cc(i) - center(1 ), y_cc(j) - center(2 ), 0._wp ] ! get coordinate frame centered on IB
9697 xy_local = matmul (inverse_rotation, xy_local) ! rotate the frame into the IB' s coordinate
97- xy_local = xy_local - patch_ib(ib_patch_id)%centroid_offset ! airfoils are a patch that require a centroid offset
98+ xy_local = xy_local - offset ! airfoils are a patch that require a centroid offset
9899
99100 if (xy_local(2) >= 0._wp) then
100101 ! finds the location on the airfoil grid with the minimum distance (closest)
@@ -165,7 +166,7 @@ contains
165166 real(wp) :: lz, z_max, z_min
166167 real(wp), dimension(3) :: dist_vec
167168
168- real(wp), dimension(1:3) :: xyz_local, center !< x, y, z coordinates in local IB frame
169+ real(wp), dimension(1:3) :: xyz_local, center, offset !< x, y, z coordinates in local IB frame
169170 real(wp), dimension(1:3, 1:3) :: rotation, inverse_rotation
170171
171172 real(wp) :: length_z
@@ -178,19 +179,20 @@ contains
178179 lz = patch_ib(ib_patch_id)%length_z
179180 inverse_rotation(:, :) = patch_ib(ib_patch_id)%rotation_matrix_inverse(:, :)
180181 rotation(:, :) = patch_ib(ib_patch_id)%rotation_matrix(:, :)
182+ offset(:) = patch_ib(ib_patch_id)%centroid_offset(:)
181183
182184 z_max = center(3) + lz/2
183185 z_min = center(3) - lz/2
184186
185187 $:GPU_PARALLEL_LOOP(private=' [i,j,l,xyz_local,k,dist_vec,dist,global_dist,global_id,dist_side,dist_surf]' , &
186- & copyin=' [ib_patch_id,center,rotation,inverse_rotation,airfoil_grid_u,airfoil_grid_l,z_min,z_max]' , collapse=3)
188+ & copyin=' [ib_patch_id,center,rotation,inverse_rotation,offset, airfoil_grid_u,airfoil_grid_l,z_min,z_max]' , collapse=3)
187189 do l = 0, p
188190 do j = 0, n
189191 do i = 0, m
190192
191193 xyz_local = [x_cc(i) - center(1), y_cc(j) - center(2), z_cc(l) - center(3)] ! get coordinate frame centered on IB
192194 xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB' s coordinates
193- xyz_local = xyz_local - patch_ib(ib_patch_id)%centroid_offset ! airfoils are a patch that require a centroid offset
195+ xyz_local = xyz_local - offset ! airfoils are a patch that require a centroid offset
194196
195197 if (xyz_local(2 ) >= center(2 )) then
196198 do k = 1 , Np
@@ -239,12 +241,12 @@ contains
239241 if (dist_side < dist_surf) then
240242 levelset%sf(i, j, l, ib_patch_id) = dist_side
241243 if (f_approx_equal(dist_side, abs (z_cc(l) - z_min))) then
242- levelset_norm%sf(i, j, l, ib_patch_id, :) = (/ 0 , 0 , - 1 / )
244+ levelset_norm%sf(i, j, l, ib_patch_id, :) = (/ 0._wp , 0._wp , - 1._wp / )
243245 else
244- levelset_norm%sf(i, j, l, ib_patch_id, :) = (/ 0 , 0 , 1 / )
246+ levelset_norm%sf(i, j, l, ib_patch_id, :) = (/ 0._wp , 0._wp , 1._wp / )
245247 end if
246248 levelset_norm%sf(i, j, l, ib_patch_id, :) = &
247- matmul (rotation, levelset_norm%sf(i, j, l, ib_patch_id, :)/ dist_surf )
249+ matmul (rotation, levelset_norm%sf(i, j, l, ib_patch_id, :))
248250 else
249251 levelset%sf(i, j, l, ib_patch_id) = dist_surf
250252 if (f_approx_equal(dist_surf, 0._wp )) then
0 commit comments