Skip to content

Commit 3dc61e0

Browse files
author
Daniel Vickers
committed
Intermittend commit
1 parent eae1974 commit 3dc61e0

File tree

2 files changed

+17
-30
lines changed

2 files changed

+17
-30
lines changed

src/common/m_compute_levelset.fpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ contains
4343
center(1) = patch_ib(ib_patch_id)%x_centroid
4444
center(2) = patch_ib(ib_patch_id)%y_centroid
4545

46-
$:GPU_PARALLEL_LOOP(private='[i,j,dist_vec,dist]', copy='[levelset,levelset_norm]',&
46+
$:GPU_PARALLEL_LOOP(private='[i,j,dist_vec,dist]', copy='[levelset%sf,levelset_norm%sf]',&
4747
& copyin='[ib_patch_id,center,radius]', collapse=2)
4848
do i = 0, m
4949
do j = 0, n
@@ -86,7 +86,7 @@ contains
8686
inverse_rotation(:, :) = patch_ib(ib_patch_id)%rotation_matrix_inverse(:, :)
8787
rotation(:, :) = patch_ib(ib_patch_id)%rotation_matrix(:, :)
8888

89-
$:GPU_PARALLEL_LOOP(private='[i,j,xy_local,k,dist_vec,dist,global_dist,global_id]', copy='[levelset,levelset_norm]',&
89+
$:GPU_PARALLEL_LOOP(private='[i,j,xy_local,k,dist_vec,dist,global_dist,global_id]', copy='[levelset%sf,levelset_norm%sf]',&
9090
& copyin='[ib_patch_id,center,rotation,inverse_rotation,airfoil_grid_u,airfoil_grid_l]', collapse=2)
9191
do i = 0, m
9292
do j = 0, n
@@ -178,7 +178,7 @@ contains
178178
z_max = center(3) + lz/2
179179
z_min = center(3) - lz/2
180180
181-
$:GPU_PARALLEL_LOOP(private='[i,j,l,xyz_local,k,dist_vec,dist,global_dist,global_id,dist_side,dist_surf]', copy='[levelset,levelset_norm]',&
181+
$:GPU_PARALLEL_LOOP(private='[i,j,l,xyz_local,k,dist_vec,dist,global_dist,global_id,dist_side,dist_surf]', copy='[levelset%sf,levelset_norm%sf]',&
182182
& copyin='[ib_patch_id,center,rotation,inverse_rotation,airfoil_grid_u,airfoil_grid_l,z_min,z_max]', collapse=3)
183183
do l = 0, p
184184
do j = 0, n
@@ -257,14 +257,14 @@ contains
257257
end subroutine s_3D_airfoil_levelset
258258

259259
!> Initialize IBM module
260-
pure subroutine s_rectangle_levelset(ib_patch_id, levelset, levelset_norm)
260+
subroutine s_rectangle_levelset(ib_patch_id, levelset, levelset_norm)
261261

262262
type(levelset_field), intent(INOUT), optional :: levelset
263263
type(levelset_norm_field), intent(INOUT), optional :: levelset_norm
264264

265265
integer, intent(in) :: ib_patch_id
266266
real(wp) :: top_right(2), bottom_left(2)
267-
real(wp) :: min_dist, initial_min_dist
267+
real(wp) :: min_dist
268268
real(wp) :: side_dists(4)
269269

270270
real(wp) :: length_x, length_y
@@ -286,10 +286,9 @@ contains
286286
top_right(2) = length_y/2
287287
bottom_left(1) = -length_x/2
288288
bottom_left(2) = -length_y/2
289-
initial_min_dist = initial_distance_buffer
290289

291-
$:GPU_PARALLEL_LOOP(private='[i,j,k,min_dist,idx,side_dists,xy_local,dist_vec]', copy='[levelset,levelset_norm]',&
292-
& copyin='[ib_patch_id,center,bottom_left,top_right,initial_min_dist,inverse_rotation,rotation]', collapse=2)
290+
$:GPU_PARALLEL_LOOP(private='[i,j,k,min_dist,idx,side_dists,xy_local,dist_vec]', copy='[levelset%sf,levelset_norm%sf]',&
291+
& copyin='[ib_patch_id,center,bottom_left,top_right,inverse_rotation,rotation,x_cc,y_cc]', collapse=2)
293292
do i = 0, m
294293
do j = 0, n
295294
xy_local = [x_cc(i) - center(1), y_cc(j) - center(2), 0._wp]
@@ -302,10 +301,10 @@ contains
302301
side_dists(2) = top_right(1) - xy_local(1)
303302
side_dists(3) = bottom_left(2) - xy_local(2)
304303
side_dists(4) = top_right(2) - xy_local(2)
305-
min_dist = initial_min_dist
304+
min_dist = side_dists(1)
306305
idx = 1
307306

308-
do k = 1, 4
307+
do k = 2, 4
309308
if (abs(side_dists(k)) < abs(min_dist)) then
310309
idx = k
311310
min_dist = side_dists(idx)
@@ -368,7 +367,7 @@ contains
368367
Front = length_z/2
369368
Back = -length_z/2
370369

371-
$:GPU_PARALLEL_LOOP(private='[i,j,k,min_dist,side_dists,xyz_local,dist_vec]', copy='[levelset,levelset_norm]',&
370+
$:GPU_PARALLEL_LOOP(private='[i,j,k,min_dist,side_dists,xyz_local,dist_vec]', copy='[levelset%sf,levelset_norm%sf]',&
372371
& copyin='[ib_patch_id,center,inverse_rotation,rotation,Right,Left,Top,Bottom,Front,Back]', collapse=3)
373372
do i = 0, m
374373
do j = 0, n
@@ -457,7 +456,7 @@ contains
457456
center(2) = patch_ib(ib_patch_id)%y_centroid
458457
center(3) = patch_ib(ib_patch_id)%z_centroid
459458
460-
$:GPU_PARALLEL_LOOP(private='[i,j,k,dist_vec,dist]', copy='[levelset,levelset_norm]',&
459+
$:GPU_PARALLEL_LOOP(private='[i,j,k,dist_vec,dist]', copy='[levelset%sf,levelset_norm%sf]',&
461460
& copyin='[ib_patch_id,center,radius]', collapse=3)
462461
do i = 0, m
463462
do j = 0, n
@@ -521,7 +520,7 @@ contains
521520
dist_surface_vec = (/1, 1, 0/)
522521
end if
523522
524-
$:GPU_PARALLEL_LOOP(private='[i,j,k,side_pos,dist_side,dist_surface,xyz_local]', copy='[levelset,levelset_norm]',&
523+
$:GPU_PARALLEL_LOOP(private='[i,j,k,side_pos,dist_side,dist_surface,xyz_local]', copy='[levelset%sf,levelset_norm%sf]',&
525524
& copyin='[ib_patch_id,center,radius,inverse_rotation,rotation,dist_sides_vec,dist_surface_vec]', collapse=3)
526525
do i = 0, m
527526
do j = 0, n

src/common/m_ib_patches.fpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -503,24 +503,12 @@ contains
503503
lit_gamma = (1._wp + gamma)/gamma
504504

505505
! Transferring the rectangle's centroid and length information
506-
x_centroid = patch_ib(patch_id)%x_centroid
507-
y_centroid = patch_ib(patch_id)%y_centroid
508-
length_x = patch_ib(patch_id)%length_x
509-
length_y = patch_ib(patch_id)%length_y
506+
center(1) = patch_ib(patch_id)%x_centroid
507+
center(2) = patch_ib(patch_id)%y_centroid
508+
length(1) = patch_ib(patch_id)%length_x
509+
length(2) = patch_ib(patch_id)%length_y
510510
inverse_rotation(:, :) = patch_ib(patch_id)%rotation_matrix_inverse(:, :)
511511
512-
! Computing the beginning and the end x- and y-coordinates of the
513-
! rectangle based on its centroid and lengths
514-
x_boundary%beg = -0.5_wp*length_x
515-
x_boundary%end = 0.5_wp*length_x
516-
y_boundary%beg = -0.5_wp*length_y
517-
y_boundary%end = 0.5_wp*length_y
518-
519-
length(1) = length_x
520-
length(2) = length_y
521-
center(1) = x_centroid
522-
center(2) = y_centroid
523-
524512
! Since the rectangular patch does not allow for its boundaries to
525513
! be smoothed out, the pseudo volume fraction is set to 1 to ensure
526514
! that only the current patch contributes to the fluid state in the
@@ -532,7 +520,7 @@ contains
532520
! to write to that cell. If both queries check out, the primitive
533521
! variables of the current patch are assigned to this cell.
534522
$:GPU_PARALLEL_LOOP(private='[i,j, xy_local]', copy='[ib_markers_sf]',&
535-
& copyin='[patch_id,center,length,inverse_rotation]', collapse=2)
523+
& copyin='[patch_id,center,length,inverse_rotation,x_cc,y_cc]', collapse=2)
536524
do j = 0, n
537525
do i = 0, m
538526
! get the x and y coordinates in the local IB frame

0 commit comments

Comments
 (0)