Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/simulation/m_amr_advance.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,17 @@ contains
integer :: ibm, nb

! the coarse stage's post-RK hooks (q_cons_ts(1), m_time_steppers) run here per member in its own frame and in the
! coarse order: 6-equation pressure relaxation, body force, moving-body rebuild, body/ghost-cell correction,
! coarse order: body force, 6-equation pressure relaxation, moving-body rebuild, body/ghost-cell correction,
! continuum-damage clamp, species cleanup. Each reads only the member's cells, so member order is free. Unsupported
! hooks are rejected with amr in case_validator. amr_bat_n = 1 while visiting members: s_amr_swap_to_fine would
! otherwise extend the grid into the slab, and the hooks need the member's extents.

nb = amr_bat_n; amr_bat_n = 1
do ibm = 1, nb
call s_amr_select_slot(amr_bat_blk(ibm))
if (model_eqns == model_eqns_6eq .and. (.not. relax)) call s_amr_pressure_relax_fine()
! same ldt as the coarse stage: rk_coef(s, 3)*dt/rk_coef(s, 4)
if (bodyForces) call s_amr_bodyforces_fine(coefs(3)*dt/coefs(4))
if (model_eqns == model_eqns_6eq .and. (.not. relax)) call s_amr_pressure_relax_fine()
if (ib) then
if (moving_immersed_boundary_flag) call s_amr_update_mib_fine()
call s_amr_bat_member_prim(ibm, amr_scr_prim, amr_scr_prim_blk)
Expand Down
25 changes: 17 additions & 8 deletions src/simulation/m_ibm.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,22 @@ contains

!> Resets the current indexes of immersed boundaries and replaces them after updating
!> the position of each moving immersed boundary
!> Recalculate the moving bodies' rotation matrices from their current angles (device).
subroutine s_update_ib_rotation_matrices(num_ibs)

integer, intent(in) :: num_ibs
integer :: i

$:GPU_PARALLEL_LOOP(private='[i]')
do i = 1, num_ibs
if (patch_ib(i)%moving_ibm /= 0) then
call s_update_ib_rotation_matrix(i)
end if
end do
$:END_GPU_PARALLEL_LOOP()

end subroutine s_update_ib_rotation_matrices

impure subroutine s_update_mib(num_ibs)

integer, intent(in) :: num_ibs
Expand All @@ -2019,14 +2035,7 @@ contains
end do; end do; end do
$:END_GPU_PARALLEL_LOOP()

! recalulcate the rotation matrix based upon the new angles
$:GPU_PARALLEL_LOOP(private='[i]')
do i = 1, num_ibs
if (patch_ib(i)%moving_ibm /= 0) then
call s_update_ib_rotation_matrix(i)
end if
end do
$:END_GPU_PARALLEL_LOOP()
call s_update_ib_rotation_matrices(num_ibs)

! recompute the new ib_patch locations and broadcast them.
call nvtxStartRange("APPLY-IB-PATCHES")
Expand Down
18 changes: 12 additions & 6 deletions src/simulation/m_time_steppers.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,13 @@ contains

if (s == 1 .and. bodyForces) call s_update_mean_sources(q_cons_ts(1)%vf, q_T_sf, t_step)

! AMR: move the bodies before the fine stage, so its IB rebuild and correction use this stage's pose, as the coarse
! ones do; the fine containment check reads the pose and rotation on the host
if (amr .and. moving_immersed_boundary_flag) then
call s_advance_ib_pose(s, t_step)
call s_update_ib_rotation_matrices(num_ibs)
$:GPU_UPDATE(host='[patch_ib(1:num_ibs)]')
end if
! subcycled: level 0 steps alone; the fine levels follow after its step (s_amr_subcycle_fine)
if (.not. amr_sub_on) call s_amr_stage_fine(s, t_step, rk_coef(s,:), q_cons_ts(1)%vf, q_T_sf, bc_type, rhs_vf, &
& pb_ts(1)%sf, rhs_pb, mv_ts(1)%sf, rhs_mv)
Expand Down Expand Up @@ -592,7 +599,8 @@ contains
if (ib) then
! check if any IBMS are moving, and if so, update the markers, ghost points, levelsets, and levelset norms
if (moving_immersed_boundary_flag) then
call s_propagate_immersed_boundaries(s, t_step)
if (.not. amr) call s_advance_ib_pose(s, t_step)
call s_update_mib(num_ibs)
end if

! update the ghost fluid properties point values based on IB state
Expand Down Expand Up @@ -887,8 +895,8 @@ contains

end subroutine s_apply_synthetic_turbulence_force

!> Update immersed boundary positions and velocities at the current Runge-Kutta stage
subroutine s_propagate_immersed_boundaries(s, t_step)
!> Advance the immersed boundary positions and velocities to the current Runge-Kutta stage (forces from this stage's RHS)
subroutine s_advance_ib_pose(s, t_step)

integer, intent(in) :: s, t_step
integer :: i
Expand Down Expand Up @@ -962,11 +970,9 @@ contains
end do
$:END_GPU_PARALLEL_LOOP()

call s_update_mib(num_ibs)

call nvtxEndRange

end subroutine s_propagate_immersed_boundaries
end subroutine s_advance_ib_pose

!> Save the temporary q_prim_vf vector into q_prim_ts for use in p_main
subroutine s_time_step_cycling(t_step)
Expand Down
34 changes: 17 additions & 17 deletions tests/13945217/golden-metadata.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/13945217/golden.txt

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions tests/43AF9F25/golden-metadata.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions tests/43AF9F25/golden.txt

Large diffs are not rendered by default.

Loading
Loading