Skip to content

Commit 3208814

Browse files
Resolved memory not being reset for rectangles and cuboids. Also fixed MPI not showing rotations
1 parent 6b1ee94 commit 3208814

File tree

3 files changed

+18
-23
lines changed

3 files changed

+18
-23
lines changed

src/common/m_compute_levelset.fpp

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ contains
302302
end do
303303

304304
levelset%sf(i, j, 0, ib_patch_id) = side_dists(idx)
305+
levelset_norm%sf(i, j, 0, ib_patch_id, :) = 0._wp
305306
if (.not. f_approx_equal(side_dists(idx), 0._wp)) then
306307
if (idx == 1 .or. idx == 2) then
307308
! vector points along the x axis
@@ -387,56 +388,45 @@ contains
387388
! leading to undesired behavior. This should be resolved
388389
! and this code should be cleaned up. I verified this behavior
389390
! with tests.
391+
levelset_norm%sf(i, j, k, ib_patch_id, :) = 0._wp
390392
if (f_approx_equal(min_dist, abs(side_dists(1)))) then
391393
levelset%sf(i, j, k, ib_patch_id) = side_dists(1)
392-
if (f_approx_equal(side_dists(1), 0._wp)) then
393-
levelset_norm%sf(i, j, k, ib_patch_id, 1) = 0._wp
394-
else
394+
if (.not. f_approx_equal(side_dists(1), 0._wp)) then
395395
levelset_norm%sf(i, j, k, ib_patch_id, 1) = side_dists(1)/ &
396396
abs(side_dists(1))
397397
end if
398398
399399
else if (f_approx_equal(min_dist, abs(side_dists(2)))) then
400400
levelset%sf(i, j, k, ib_patch_id) = side_dists(2)
401-
if (f_approx_equal(side_dists(2), 0._wp)) then
402-
levelset_norm%sf(i, j, k, ib_patch_id, 1) = 0._wp
403-
else
401+
if (.not. f_approx_equal(side_dists(2), 0._wp)) then
404402
levelset_norm%sf(i, j, k, ib_patch_id, 1) = -side_dists(2)/ &
405403
abs(side_dists(2))
406404
end if
407405
408406
else if (f_approx_equal(min_dist, abs(side_dists(3)))) then
409407
levelset%sf(i, j, k, ib_patch_id) = side_dists(3)
410-
if (f_approx_equal(side_dists(3), 0._wp)) then
411-
levelset_norm%sf(i, j, k, ib_patch_id, 2) = 0._wp
412-
else
408+
if (.not. f_approx_equal(side_dists(3), 0._wp)) then
413409
levelset_norm%sf(i, j, k, ib_patch_id, 2) = side_dists(3)/ &
414410
abs(side_dists(3))
415411
end if
416412
417413
else if (f_approx_equal(min_dist, abs(side_dists(4)))) then
418414
levelset%sf(i, j, k, ib_patch_id) = side_dists(4)
419-
if (f_approx_equal(side_dists(4), 0._wp)) then
420-
levelset_norm%sf(i, j, k, ib_patch_id, 2) = 0._wp
421-
else
415+
if (.not. f_approx_equal(side_dists(4), 0._wp)) then
422416
levelset_norm%sf(i, j, k, ib_patch_id, 2) = -side_dists(4)/ &
423417
abs(side_dists(4))
424418
end if
425419
426420
else if (f_approx_equal(min_dist, abs(side_dists(5)))) then
427421
levelset%sf(i, j, k, ib_patch_id) = side_dists(5)
428-
if (f_approx_equal(side_dists(5), 0._wp)) then
429-
levelset_norm%sf(i, j, k, ib_patch_id, 3) = 0._wp
430-
else
422+
if (.not. f_approx_equal(side_dists(5), 0._wp)) then
431423
levelset_norm%sf(i, j, k, ib_patch_id, 3) = side_dists(5)/ &
432424
abs(side_dists(5))
433425
end if
434426
435427
else if (f_approx_equal(min_dist, abs(side_dists(6)))) then
436428
levelset%sf(i, j, k, ib_patch_id) = side_dists(6)
437-
if (f_approx_equal(side_dists(6), 0._wp)) then
438-
levelset_norm%sf(i, j, k, ib_patch_id, 3) = 0._wp
439-
else
429+
if (.not. f_approx_equal(side_dists(6), 0._wp)) then
440430
levelset_norm%sf(i, j, k, ib_patch_id, 3) = -side_dists(6)/ &
441431
abs(side_dists(6))
442432
end if

src/simulation/m_ibm.fpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ contains
390390
type(ghost_point) :: gp
391391

392392
integer :: q, dim !< Iterator variables
393-
integer :: i, j, k !< Location indexes
393+
integer :: i, j, k, l !< Location indexes
394394
integer :: patch_id !< IB Patch ID
395395
integer :: dir
396396
integer :: index
@@ -912,14 +912,16 @@ contains
912912
type(levelset_field), intent(inout) :: levelset
913913
type(levelset_norm_field), intent(inout) :: levelset_norm
914914

915-
integer :: i
915+
integer :: i, ierr
916916

917917
! Clears the existing immersed boundary indices
918918
ib_markers%sf = 0
919919

920920
! recalulcate the rotation matrix based upon the new angles
921921
do i = 1, num_ibs
922-
if (patch_ib(i)%moving_ibm /= 0) call s_update_ib_rotation_matrix(i)
922+
if (patch_ib(i)%moving_ibm /= 0) then
923+
call s_update_ib_rotation_matrix(i)
924+
end if
923925
end do
924926

925927
! recompute the new ib_patch locations and broadcast them.

src/simulation/m_mpi_proxy.fpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,14 @@ contains
203203
204204
do i = 1, num_ibs
205205
#:for VAR in [ 'radius', 'length_x', 'length_y', &
206-
& 'x_centroid', 'y_centroid', 'c', 'm', 'p', 't', 'theta', 'slip', &
207-
'moving_ibm', 'vel',]
206+
& 'x_centroid', 'y_centroid', 'c', 'm', 'p', 't', 'theta', 'slip']
208207
call MPI_BCAST(patch_ib(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
209208
#:endfor
209+
#:for VAR in ['vel', 'angular_vel', 'angles']
210+
call MPI_BCAST(patch_ib(i)%${VAR}$, 3, mpi_p, 0, MPI_COMM_WORLD, ierr)
211+
#:endfor
210212
call MPI_BCAST(patch_ib(i)%geometry, 2, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
213+
call MPI_BCAST(patch_ib(i)%moving_ibm, 2, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
211214
end do
212215
213216
do j = 1, num_probes_max

0 commit comments

Comments
 (0)