Skip to content

Commit c04cfae

Browse files
Ready to test with a rotated square
1 parent 50799ab commit c04cfae

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

src/simulation/m_ibm.fpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,11 @@ contains
962962
! Clears the existing immersed boundary indices
963963
ib_markers%sf = 0
964964

965+
! recalulcate the rotation matrix based upon the new angles
966+
do i = 1, num_ibs
967+
if patch_ib(i)%moving_ibm call s_update_ib_rotation_matrix(i)
968+
end if
969+
965970
! recompute the new ib_patch locations and broadcast them.
966971
call s_apply_ib_patches(ib_markers%sf(0:m, 0:n, 0:p), levelset, levelset_norm)
967972
call s_populate_ib_buffers() ! transmits the new IB markers via MPI

src/simulation/m_time_steppers.fpp

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,14 @@ contains
550550
! start by using euler's method naiively, but eventually incorporate more sophistocation
551551
if (patch_ib(i)%moving_ibm == 1) then
552552
do j = 1, 3
553-
patch_ib(i)%vel(j) = patch_ib(i)%vel(j) + 0.0*dt ! TODO :: ADD EXTERNAL FORCES HERE
553+
patch_ib(i)%vel(j) = patch_ib(i)%vel(j) + 0.0*dt
554+
patch_ib(i)%angular_vel(j) = patch_ib(i)%angular_vel(j) + 0.0*dt
555+
556+
! Update the angle of the IB
557+
patch_ib(i)%angles(j) = patch_ib(i)%angles(j) + patch_ib(i)%angular_vel(j)*dt
554558
end do
555559
560+
! Update the position of the IB
556561
patch_ib(i)%x_centroid = patch_ib(i)%x_centroid + patch_ib(i)%vel(1)*dt
557562
patch_ib(i)%y_centroid = patch_ib(i)%y_centroid + patch_ib(i)%vel(2)*dt
558563
patch_ib(i)%z_centroid = patch_ib(i)%z_centroid + patch_ib(i)%vel(3)*dt
@@ -709,8 +714,15 @@ contains
709714
! start by using euler's method naiively, but eventually incorporate more sophistocation
710715
if (patch_ib(i)%moving_ibm == 1) then
711716
patch_ib(i)%step_vel = patch_ib(i)%vel
717+
patch_ib(i)%step_angular_vel = patch_ib(i)%angular_vel
718+
patch_ib(i)%step_angles = patch_ib(i)%angles
719+
712720
do j = 1, 3
713-
patch_ib(i)%vel(j) = patch_ib(i)%step_vel(j) + 0.0*dt ! TODO :: ADD EXTERNAL FORCES HERE
721+
patch_ib(i)%vel(j) = patch_ib(i)%step_vel(j) + 0.0*dt
722+
patch_ib(i)%angular_vel(j) = patch_ib(i)%step_angular_vel(j) + 0.0*dt
723+
724+
! Update the angle of the IB
725+
patch_ib(i)%angles(j) = patch_ib(i)%step_angles(j) + patch_ib(i)%angular_vel(j)*dt
714726
end do
715727

716728
patch_ib(i)%step_x_centroid = patch_ib(i)%x_centroid
@@ -824,6 +836,9 @@ contains
824836
if (patch_ib(i)%moving_ibm == 1) then
825837
do j = 1, 3
826838
patch_ib(i)%vel(j) = (patch_ib(i)%vel(j) + patch_ib(i)%step_vel(j) + 0.0*dt)/2._wp
839+
patch_ib(i)%angular_vel(j) = (patch_ib(i)%angular_vel(j) + patch_ib(i)%angular_step_vel(j) + 0.0*dt)/2._wp
840+
841+
patch_ib(i)%angles(j) = (patch_ib(i)%angles(j) + patch_ib(i)%step_angles(j) + patch_ib(i)%step_angular_vel(j)*dt)/2._wp
827842
end do
828843
829844
patch_ib(i)%x_centroid = (patch_ib(i)%x_centroid + patch_ib(i)%step_x_centroid + patch_ib(i)%step_vel(1)*dt)/2._wp
@@ -981,8 +996,15 @@ contains
981996
do i = 1, num_ibs
982997
if (patch_ib(i)%moving_ibm == 1) then
983998
patch_ib(i)%step_vel = patch_ib(i)%vel
999+
patch_ib(i)%step_angular_vel = patch_ib(i)%angular_vel
1000+
patch_ib(i)%step_angles = patch_ib(i)%angles
1001+
9841002
do j = 1, 3
9851003
patch_ib(i)%vel(j) = patch_ib(i)%step_vel(j) + 0.0*dt
1004+
patch_ib(i)%angular_vel(j) = patch_ib(i)%step_angular_vel(j) + 0.0*dt
1005+
1006+
! Update the angle of the IB
1007+
patch_ib(i)%angles(j) = patch_ib(i)%step_angles(j) + patch_ib(i)%angular_vel(j)*dt
9861008
end do
9871009
9881010
patch_ib(i)%step_x_centroid = patch_ib(i)%x_centroid
@@ -1095,6 +1117,10 @@ contains
10951117
if (patch_ib(i)%moving_ibm == 1) then
10961118
do j = 1, 3
10971119
patch_ib(i)%vel(j) = (patch_ib(i)%vel(j) + 3._wp*patch_ib(i)%step_vel(j) + 0.0*dt)/4._wp
1120+
patch_ib(i)%angular_vel(j) = (patch_ib(i)%angular_vel(j) + 3._wp*patch_ib(i)%step_angular_vel(j) + 0.0*dt)/4._wp
1121+
1122+
patch_ib(i)%angles(j) = (patch_ib(i)%angles(j) + 3._wp*patch_ib(i)%step_angles(j) + patch_ib(i)%angular_vel(j)*dt)/4._wp
1123+
10981124
end do
10991125
11001126
patch_ib(i)%x_centroid = (patch_ib(i)%x_centroid + 3._wp*patch_ib(i)%step_x_centroid + patch_ib(i)%vel(1)*dt)/4._wp
@@ -1207,6 +1233,9 @@ contains
12071233
if (patch_ib(i)%moving_ibm == 1) then
12081234
do j = 1, 3
12091235
patch_ib(i)%vel(j) = (2._wp*patch_ib(i)%vel(j) + patch_ib(i)%step_vel(j) + 0.0*dt)/3._wp
1236+
patch_ib(i)%angular_vel(j) = (2._wp*patch_ib(i)%angular_vel(j) + patch_ib(i)%step_angular_vel(j) + 0.0*dt)/3._wp
1237+
1238+
patch_ib(i)%angles(j) = (2._wp*patch_ib(i)%angles(j) + patch_ib(i)%step_angles(j) + patch_ib(i)%angular_vel(j)*dt)/3._wp
12101239
end do
12111240
12121241
patch_ib(i)%x_centroid = (2._wp*patch_ib(i)%x_centroid + patch_ib(i)%step_x_centroid + 2._wp*patch_ib(i)%vel(1)*dt)/3._wp

0 commit comments

Comments
 (0)