@@ -197,19 +197,17 @@ contains
197197 type(ghost_point) :: innerp
198198
199199 ! set the Moving IBM interior Pressure Values
200- do patch_id = 1 , num_ibs
201- if (patch_ib(patch_id)%moving_ibm == 2 ) then
202- do j = 0 , m
203- do k = 0 , n
204- do l = 0 , p
205- if (ib_markers%sf(j, k, l) == patch_id) then
206- q_prim_vf(E_idx)%sf(j, k, l) = 1._wp
207- end if
208- end do
200+ $:GPU_PARALLEL_LOOP(private= ' [i,j,k]' , copyin= ' [E_idx]' , collapse= 3 )
201+ do l = 0 , p
202+ do k = 0 , n
203+ do j = 0 , m
204+ if (ib_markers%sf(j, k, l) /= 0 ) then
205+ q_prim_vf(E_idx)%sf(j, k, l) = 1._wp
206+ end if
209207 end do
210208 end do
211- end if
212- end do
209+ end do
210+ $:END_GPU_PARALLEL_LOOP()
213211
214212 if (num_gps > 0 ) then
215213 $:GPU_PARALLEL_LOOP(private= ' [i,physical_loc,dyn_pres,alpha_rho_IP, alpha_IP,pres_IP,vel_IP,vel_g,vel_norm_IP,r_IP, v_IP,pb_IP,mv_IP,nmom_IP,presb_IP,massv_IP,rho, gamma,pi_inf,Re_K,G_K,Gs,gp,innerp,norm,buf, radial_vector, rotation_velocity, j,k,l,q,qv_K,c_IP,nbub,patch_id]' )
@@ -260,14 +258,15 @@ contains
260258 end if
261259
262260 ! set the pressure
263- do q = 1 , num_fluids
264- if (patch_ib(patch_id)%moving_ibm == 0 ) then
265- q_prim_vf(E_idx)%sf(j, k, l) = pres_IP
266- else
267- ! TODO :: improve for two fluid
268- q_prim_vf(E_idx)%sf(j, k, l) = pres_IP/ (1._wp - 2._wp * abs (levelset%sf(j, k, l, patch_id)* alpha_rho_IP(q)/ pres_IP)* dot_product (patch_ib(patch_id)%force/ patch_ib(patch_id)%mass, levelset_norm%sf(j, k, l, patch_id, :)))
269- end if
270- end do
261+ if (patch_ib(patch_id)%moving_ibm == 0 ) then
262+ q_prim_vf(E_idx)%sf(j, k, l) = pres_IP
263+ else
264+ q_prim_vf(E_idx)%sf(j, k, l) = 0._wp
265+ $:GPU_LOOP(parallelism= ' [seq]' )
266+ do q = 1 , num_fluids
267+ q_prim_vf(E_idx)%sf(j, k, l) = q_prim_vf(E_idx)%sf(j, k, l) + pres_IP/ (1._wp - 2._wp * abs (levelset%sf(j, k, l, patch_id)* alpha_rho_IP(q)/ pres_IP)* dot_product (patch_ib(patch_id)%force/ patch_ib(patch_id)%mass, levelset_norm%sf(j, k, l, patch_id, :)))
268+ end do
269+ end if
271270
272271 if (model_eqns /= 4 ) then
273272 ! If in simulation, use acc mixture subroutines
@@ -1023,8 +1022,8 @@ contains
10231022 else
10241023 radial_vector = [x_cc(i), y_cc(j), 0._wp] - [patch_ib(ib_idx)%x_centroid, patch_ib(ib_idx)%y_centroid, 0._wp]
10251024 end if
1026- dx = x_cc(i+1)- x_cc(i)
1027- dy = y_cc(j+1)- y_cc(j)
1025+ dx = x_cc(i + 1) - x_cc(i)
1026+ dy = y_cc(j + 1) - y_cc(j)
10281027
10291028 ! use a finite difference to compute the 2D components of the gradient of the pressure and cell volume
10301029 pressure_divergence(1) = (pressure(i + 1, j, k) - pressure(i - 1, j, k))/(2._wp*dx)
@@ -1033,7 +1032,7 @@ contains
10331032
10341033 ! add the 3D component, if we are working in 3 dimensions
10351034 if (num_dims == 3) then
1036- dz = z_cc(k+1)- z_cc(k)
1035+ dz = z_cc(k + 1) - z_cc(k)
10371036 pressure_divergence(3) = (pressure(i, j, k + 1) - pressure(i, j, k - 1))/(2._wp*dz)
10381037 cell_volume = cell_volume*dz
10391038 else
@@ -1062,6 +1061,8 @@ contains
10621061 patch_ib(i)%torque(:) = matmul(patch_ib(i)%rotation_matrix_inverse, torques(i, :)) ! torques must be computed in the local coordinates of the IB
10631062 end do
10641063
1064+ print *, forces(1, 1:2)
1065+
10651066 end subroutine s_compute_ib_forces
10661067
10671068 !> Subroutine to deallocate memory reserved for the IBM module
@@ -1096,7 +1097,7 @@ contains
10961097 if (patch_ib(ib_marker)%geometry == 2) then ! circle
10971098 patch_ib(ib_marker)%moment = 0.5*patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%radius)**2
10981099 elseif (patch_ib(ib_marker)%geometry == 3) then ! rectangle
1099- patch_ib(ib_marker)%moment = patch_ib(i )%mass*(patch_ib(ib_marker)%length_x**2 + patch_ib(ib_marker)%length_y**2)/6._wp
1100+ patch_ib(ib_marker)%moment = patch_ib(ib_marker )%mass*(patch_ib(ib_marker)%length_x**2 + patch_ib(ib_marker)%length_y**2)/6._wp
11001101 elseif (patch_ib(ib_marker)%geometry == 8) then ! sphere
11011102 patch_ib(ib_marker)%moment = 0.4*patch_ib(ib_marker)%mass*(patch_ib(ib_marker)%radius)**2
11021103
@@ -1126,7 +1127,7 @@ contains
11261127 ! project the position along the axis to find the closest distance to the rotation axis
11271128 closest_point_along_axis = axis*dot_product(axis, position)
11281129 vector_to_axis = position - closest_point_along_axis
1129- distance_to_axis = sum( vector_to_axis) ! saves the distance to the axis squared
1130+ distance_to_axis = dot_product(vector_to_axis, vector_to_axis) ! saves the distance to the axis squared
11301131
11311132 ! compute the position component of the moment
11321133 $:GPU_ATOMIC(atomic=' update' )
0 commit comments