Skip to content

Commit ade6d5e

Browse files
Resolved airfoil case failure
1 parent cc849cf commit ade6d5e

2 files changed

Lines changed: 11 additions & 29 deletions

File tree

src/simulation/m_ib_patches.fpp

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -207,23 +207,18 @@ contains
207207
integer, intent(in) :: patch_id
208208
type(integer_field), intent(inout) :: ib_markers
209209
integer, intent(in) :: xp, yp !< integers containing the periodicity projection information
210-
real(wp) :: f, ca_in, pa, ma
211-
real(wp) :: xa, yc, dycdxc
210+
real(wp) :: f, ca_in
212211
integer :: i, j, k, il, ir, jl, jr
213212
integer :: Np_local, airfoil_id
214213
integer :: encoded_patch_id
215214
real(wp), dimension(1:3) :: xy_local, offset !< x and y coordinates in local IB frame
216215
real(wp), dimension(1:2) :: center !< x and y coordinates in local IB frame
217-
real(wp), dimension(1:3,1:3) :: inverse_rotation
218216
219217
airfoil_id = patch_ib(patch_id)%airfoil_id
220218
center(1) = patch_ib(patch_id)%x_centroid + real(xp, wp)*(x_domain%end - x_domain%beg)
221219
center(2) = patch_ib(patch_id)%y_centroid + real(yp, wp)*(y_domain%end - y_domain%beg)
222220
ca_in = ib_airfoil(airfoil_id)%c
223-
pa = ib_airfoil(airfoil_id)%p
224-
ma = ib_airfoil(airfoil_id)%m
225221
Np_local = ib_airfoil_grids(airfoil_id)%Np
226-
inverse_rotation(:,:) = patch_ib(patch_id)%rotation_matrix_inverse(:,:)
227222
offset(:) = patch_ib(patch_id)%centroid_offset(:)
228223
229224
! encode the periodicity information into the patch_id
@@ -238,24 +233,15 @@ contains
238233
call get_bounding_indices(center(1) - ca_in, center(1) + ca_in, x_cc, il, ir)
239234
call get_bounding_indices(center(2) - ca_in, center(2) + ca_in, y_cc, jl, jr)
240235
241-
$:GPU_PARALLEL_LOOP(private='[i, j, xy_local, k, f, xa, yc, dycdxc]', copyin='[encoded_patch_id, center, &
242-
& inverse_rotation, offset, ma, pa, ca_in, airfoil_id, Np_local, ib_airfoil_grids(airfoil_id)%upper, &
243-
& ib_airfoil_grids(airfoil_id)%lower]', collapse=2)
236+
$:GPU_PARALLEL_LOOP(private='[i, j, xy_local, k, f]', copyin='[encoded_patch_id, center, offset, ca_in, airfoil_id, &
237+
& Np_local, ib_airfoil_grids(airfoil_id)%upper, ib_airfoil_grids(airfoil_id)%lower]', collapse=2)
244238
do j = jl, jr
245239
do i = il, ir
246240
xy_local = [x_cc(i) - center(1), y_cc(j) - center(2), 0._wp] ! get coordinate frame centered on IB
247-
xy_local = matmul(inverse_rotation, xy_local) ! rotate the frame into the IB's coordinates
241+
xy_local = matmul(patch_ib(patch_id)%rotation_matrix_inverse, xy_local) ! rotate the frame into the IB's coordinates
248242
xy_local = xy_local - offset ! airfoils are a patch that require a centroid offset
249243

250244
if (xy_local(1) >= 0._wp .and. xy_local(1) <= ca_in) then
251-
xa = xy_local(1)/ca_in
252-
if (xa <= pa) then
253-
yc = (ma/pa**2)*(2*pa*xa - xa**2)
254-
dycdxc = (2*ma/pa**2)*(pa - xa)
255-
else
256-
yc = (ma/(1 - pa)**2)*(1 - 2*pa + 2*pa*xa - xa**2)
257-
dycdxc = (2*ma/(1 - pa)**2)*(pa - xa)
258-
end if
259245
if (xy_local(2) >= 0._wp) then
260246
k = 1
261247
do while (ib_airfoil_grids(airfoil_id)%upper(k)%x < xy_local(1) .and. k <= Np_local)
@@ -304,23 +290,18 @@ contains
304290
integer, intent(in) :: patch_id
305291
type(integer_field), intent(inout) :: ib_markers
306292
integer, intent(in) :: xp, yp, zp !< integers containing the periodicity projection information
307-
real(wp) :: lz, z_max, z_min, f, ca_in, pa, ma
293+
real(wp) :: lz, z_max, z_min, f, ca_in
308294
integer :: i, j, k, l, il, ir, jl, jr, ll, lr
309-
integer :: Np_local, airfoil_id
295+
integer :: airfoil_id
310296
integer :: encoded_patch_id
311297
real(wp), dimension(1:3) :: xyz_local, center, offset !< x, y, z coordinates in local IB frame
312-
real(wp), dimension(1:3,1:3) :: inverse_rotation
313298

314299
airfoil_id = patch_ib(patch_id)%airfoil_id
315300
center(1) = patch_ib(patch_id)%x_centroid + real(xp, wp)*(x_domain%end - x_domain%beg)
316301
center(2) = patch_ib(patch_id)%y_centroid + real(yp, wp)*(y_domain%end - y_domain%beg)
317302
center(3) = patch_ib(patch_id)%z_centroid + real(zp, wp)*(z_domain%end - z_domain%beg)
318303
lz = patch_ib(patch_id)%length_z
319304
ca_in = ib_airfoil(airfoil_id)%c
320-
pa = ib_airfoil(airfoil_id)%p
321-
ma = ib_airfoil(airfoil_id)%m
322-
Np_local = ib_airfoil_grids(airfoil_id)%Np
323-
inverse_rotation(:,:) = patch_ib(patch_id)%rotation_matrix_inverse(:,:)
324305
offset(:) = patch_ib(patch_id)%centroid_offset(:)
325306

326307
z_max = lz/2
@@ -341,15 +322,15 @@ contains
341322
call get_bounding_indices(center(2) - ca_in, center(2) + ca_in, y_cc, jl, jr)
342323
call get_bounding_indices(center(3) - ca_in, center(3) + ca_in, z_cc, ll, lr)
343324

344-
$:GPU_PARALLEL_LOOP(private='[i, j, l, xyz_local, k, f]', copyin='[encoded_patch_id, center, inverse_rotation, offset, &
345-
& ma, pa, ca_in, airfoil_id, Np_local, ib_airfoil_grids(airfoil_id)%upper, &
346-
& ib_airfoil_grids(airfoil_id)%lower, z_min, z_max]', collapse=3)
325+
$:GPU_PARALLEL_LOOP(private='[i, j, l, xyz_local, k, f]', copyin='[encoded_patch_id, center, offset, ca_in, airfoil_id, &
326+
& ib_airfoil_grids(airfoil_id)%upper, ib_airfoil_grids(airfoil_id)%lower, z_min, z_max]', collapse=3)
347327
do l = ll, lr
348328
do j = jl, jr
349329
do i = il, ir
350330
! get coordinate frame centered on IB
351331
xyz_local = [x_cc(i) - center(1), y_cc(j) - center(2), z_cc(l) - center(3)]
352-
xyz_local = matmul(inverse_rotation, xyz_local) ! rotate the frame into the IB's coordinates
332+
! rotate the frame into the IB's coordinates
333+
xyz_local = matmul(patch_ib(patch_id)%rotation_matrix_inverse, xyz_local)
353334
xyz_local = xyz_local - offset ! airfoils are a patch that require a centroid offset
354335
355336
if (xyz_local(3) >= z_min .and. xyz_local(3) <= z_max) then

src/simulation/m_ibm.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ contains
8787
call s_update_ib_rotation_matrix(i)
8888
end do
8989
$:END_GPU_PARALLEL_LOOP()
90+
$:GPU_UPDATE(host='[patch_ib(1:num_ibs)]')
9091

9192
! allocate some arrays for MPI communication, if required by this simulation
9293
#ifdef MFC_MPI

0 commit comments

Comments
 (0)