@@ -45,15 +45,13 @@ module m_ibm
4545 $:GPU_DECLARE(create= ' [ib_markers]' )
4646
4747 type(ghost_point), dimension (:), allocatable :: ghost_points
48- type(ghost_point), dimension (:), allocatable :: inner_points
49- $:GPU_DECLARE(create= ' [ghost_points,inner_points]' )
48+ $:GPU_DECLARE(create= ' [ghost_points]' )
5049
5150 integer :: num_gps !< Number of ghost points
52- integer :: num_inner_gps !< Number of ghost points
5351#if defined(MFC_OpenACC)
54- $:GPU_DECLARE(create= ' [gp_layers,num_gps,num_inner_gps ]' )
52+ $:GPU_DECLARE(create= ' [gp_layers,num_gps]' )
5553#elif defined(MFC_OpenMP)
56- $:GPU_DECLARE(create= ' [num_gps,num_inner_gps ]' )
54+ $:GPU_DECLARE(create= ' [num_gps]' )
5755#endif
5856 logical :: moving_immersed_boundary_flag
5957
@@ -74,7 +72,7 @@ contains
7472
7573 @:ACC_SETUP_SFs(ib_markers)
7674
77- $:GPU_ENTER_DATA(copyin= ' [num_gps,num_inner_gps ]' )
75+ $:GPU_ENTER_DATA(copyin= ' [num_gps]' )
7876
7977 end subroutine s_initialize_ibm_module
8078
@@ -83,7 +81,7 @@ contains
8381 impure subroutine s_ibm_setup ()
8482
8583 integer :: i, j, k
86- integer :: max_num_gps, max_num_inner_gps
84+ integer :: max_num_gps
8785
8886 call nvtxStartRange(" SETUP-IBM-MODULE" )
8987
@@ -118,19 +116,20 @@ contains
118116 end do
119117
120118 ! find the number of ghost points and set them to be the maximum total across ranks
121- call s_find_num_ghost_points(num_gps, num_inner_gps)
122- call s_mpi_allreduce_integer_sum(num_gps, max_num_gps)
123- call s_mpi_allreduce_integer_sum(num_inner_gps, max_num_inner_gps)
124- max_num_gps = min (max_num_gps, (m + 1 )* (n + 1 )* (p + 1 )/ 2 )
125- max_num_inner_gps = min (max_num_inner_gps, (m + 1 )* (n + 1 )* (p + 1 )/ 2 )
119+ call s_find_num_ghost_points(num_gps)
120+ if (moving_immersed_boundary_flag) then
121+ call s_mpi_allreduce_integer_sum(num_gps, max_num_gps)
122+ max_num_gps = min (max_num_gps* 2 , (m + 1 )* (n + 1 )* (p + 1 ))
123+ else
124+ max_num_gps = num_gps
125+ end if
126126
127127 ! set the size of the ghost point arrays to be the amount of points total, plus a factor of 2 buffer
128- $:GPU_UPDATE(device= ' [num_gps, num_inner_gps]' )
129- @:ALLOCATE(ghost_points(1 :int ((max_num_gps + max_num_inner_gps) * 2.0 )))
130- @:ALLOCATE(inner_points(1 :int ((max_num_gps + max_num_inner_gps) * 2.0 )))
128+ $:GPU_UPDATE(device= ' [num_gps]' )
129+ @:ALLOCATE(ghost_points(1 :max_num_gps))
131130
132- $:GPU_ENTER_DATA(copyin= ' [ghost_points,inner_points ]' )
133- call s_find_ghost_points(ghost_points, inner_points )
131+ $:GPU_ENTER_DATA(copyin= ' [ghost_points]' )
132+ call s_find_ghost_points(ghost_points)
134133 call s_apply_levelset(ghost_points, num_gps)
135134
136135 call s_compute_image_points(ghost_points)
@@ -200,18 +199,16 @@ contains
200199 patch_id = ib_markers%sf(j, k, l)
201200 if (patch_id /= 0 ) then
202201 q_prim_vf(E_idx)%sf(j, k, l) = 1._wp
203- if (patch_ib(patch_id)%moving_ibm > 0 ) then
204- rho = 0._wp
205- do i = 1 , num_fluids
206- rho = rho + q_prim_vf(contxb + i - 1 )%sf(j, k, l)
207- end do
202+ rho = 0._wp
203+ do i = 1 , num_fluids
204+ rho = rho + q_prim_vf(contxb + i - 1 )%sf(j, k, l)
205+ end do
208206
209- ! Sets the momentum
210- do i = 1 , num_dims
211- q_cons_vf(momxb + i - 1 )%sf(j, k, l) = patch_ib(patch_id)%vel(i)* rho
212- q_prim_vf(momxb + i - 1 )%sf(j, k, l) = patch_ib(patch_id)%vel(i)
213- end do
214- end if
207+ ! Sets the momentum
208+ do i = 1 , num_dims
209+ q_cons_vf(momxb + i - 1 )%sf(j, k, l) = patch_ib(patch_id)%vel(i)* rho
210+ q_prim_vf(momxb + i - 1 )%sf(j, k, l) = patch_ib(patch_id)%vel(i)
211+ end do
215212 end if
216213 end do
217214 end do
@@ -401,24 +398,6 @@ contains
401398 $:END_GPU_PARALLEL_LOOP()
402399 end if
403400
404- !Correct the state of the inner points in IBs
405- if (num_inner_gps > 0) then
406- $:GPU_PARALLEL_LOOP(private=' [i,physical_loc,dyn_pres,alpha_rho_IP, alpha_IP,vel_g,rho,gamma,pi_inf,Re_K,innerp,j,k,l,q]' )
407- do i = 1, num_inner_gps
408-
409- innerp = inner_points(i)
410- j = innerp%loc(1)
411- k = innerp%loc(2)
412- l = innerp%loc(3)
413-
414- $:GPU_LOOP(parallelism=' [seq]' )
415- do q = momxb, momxe
416- q_cons_vf(q)%sf(j, k, l) = 0._wp
417- end do
418- end do
419- $:END_GPU_PARALLEL_LOOP()
420- end if
421-
422401 end subroutine s_ibm_correct_state
423402
424403 !> Function that computes the image points for each ghost point
@@ -533,21 +512,19 @@ contains
533512
534513 !> Subroutine that finds the number of ghost points, used for allocating
535514 !! memory.
536- subroutine s_find_num_ghost_points(num_gps_out, num_inner_gps_out )
515+ subroutine s_find_num_ghost_points(num_gps_out)
537516
538517 integer, intent(out) :: num_gps_out
539- integer, intent(out) :: num_inner_gps_out
540518
541519 integer :: i, j, k, ii, jj, kk, gp_layers_z !< Iterator variables
542- integer :: num_gps_local, num_inner_gps_local !< local copies of the gp count to support GPU compute
520+ integer :: num_gps_local !< local copies of the gp count to support GPU compute
543521 logical :: is_gp
544522
545523 num_gps_local = 0
546- num_inner_gps_local = 0
547524 gp_layers_z = gp_layers
548525 if (p == 0) gp_layers_z = 0
549526
550- $:GPU_PARALLEL_LOOP(private=' [i,j,k,ii,jj,kk,is_gp]' , copy=' [num_gps_local,num_inner_gps_local ]' , firstprivate=' [gp_layers,gp_layers_z]' , collapse=3)
527+ $:GPU_PARALLEL_LOOP(private=' [i,j,k,ii,jj,kk,is_gp]' , copy=' [num_gps_local]' , firstprivate=' [gp_layers,gp_layers_z]' , collapse=3)
551528 do i = 0, m
552529 do j = 0, n
553530 do k = 0, p
@@ -568,9 +545,6 @@ contains
568545 if (is_gp) then
569546 $:GPU_ATOMIC(atomic=' update' )
570547 num_gps_local = num_gps_local + 1
571- else
572- $:GPU_ATOMIC(atomic=' update' )
573- num_inner_gps_local = num_inner_gps_local + 1
574548 end if
575549 end if
576550 end do
@@ -579,15 +553,13 @@ contains
579553 $:END_GPU_PARALLEL_LOOP()
580554
581555 num_gps_out = num_gps_local
582- num_inner_gps_out = num_inner_gps_local
583556
584557 end subroutine s_find_num_ghost_points
585558
586559 !> Function that finds the ghost points
587- subroutine s_find_ghost_points(ghost_points_in, inner_points_in )
560+ subroutine s_find_ghost_points(ghost_points_in)
588561
589562 type(ghost_point), dimension(num_gps), intent(INOUT) :: ghost_points_in
590- type(ghost_point), dimension(num_inner_gps), intent(INOUT) :: inner_points_in
591563 integer :: i, j, k, ii, jj, kk, gp_layers_z !< Iterator variables
592564 integer :: xp, yp, zp !< periodicities
593565 integer :: count, count_i, local_idx
@@ -658,20 +630,6 @@ contains
658630 ghost_points_in(local_idx)%DB(3) = 0
659631 end if
660632 end if
661-
662- else
663- $:GPU_ATOMIC(atomic=' capture' )
664- count_i = count_i + 1
665- local_idx = count_i
666- $:END_GPU_ATOMIC_CAPTURE()
667-
668- inner_points_in(local_idx)%loc = [i, j, k]
669- encoded_patch_id = ib_markers%sf(i, j, k)
670- call s_decode_patch_periodicity(encoded_patch_id, patch_id, xp, yp, zp)
671- inner_points_in(local_idx)%ib_patch_id = patch_id
672- ib_markers%sf(i, j, k) = patch_id
673- inner_points_in(local_idx)%slip = patch_ib(patch_id)%slip
674-
675633 end if
676634 end if
677635 end do
@@ -972,8 +930,8 @@ contains
972930
973931 call nvtxStartRange(" COMPUTE-GHOST-POINTS" )
974932 ! recalculate the ghost point locations and coefficients
975- call s_find_num_ghost_points(num_gps, num_inner_gps )
976- call s_find_ghost_points(ghost_points, inner_points )
933+ call s_find_num_ghost_points(num_gps)
934+ call s_find_ghost_points(ghost_points)
977935 call nvtxEndRange
978936
979937 call nvtxStartRange(" COMPUTE-IMAGE-POINTS" )
0 commit comments