Skip to content
Merged
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
28 changes: 24 additions & 4 deletions src/simulation/m_ibm.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -2693,6 +2693,26 @@ contains

end function f_ib_face_mass

!> Momentum density of component i in cell (j, k, l). The momentum halos of q_cons_vf are not exchanged between ranks, so a halo
!! cell (rank seam, periodic edge) takes rho*u from q_prim_vf, whose halos are.
function f_ib_cell_momentum(q_cons_vf, q_prim_vf, i, j, k, l) result(mom)

$:GPU_ROUTINE(function_name='f_ib_cell_momentum', parallelism='[seq]', cray_inline=True)
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf, q_prim_vf
integer, intent(in) :: i, j, k, l
real(wp) :: mom, rho
integer :: c

mom = q_cons_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)
if (igr .or. (j >= 0 .and. j <= m .and. k >= 0 .and. k <= n .and. l >= 0 .and. l <= p)) return
rho = 0._wp
do c = eqn_idx%cont%beg, eqn_idx%cont%end
rho = rho + q_prim_vf(c)%sf(j, k, l)
end do
mom = rho*q_prim_vf(eqn_idx%mom%beg + i - 1)%sf(j, k, l)

end function f_ib_cell_momentum

!> Area of the face (j, k, l) normal to direction idir
pure real(wp) function f_ib_face_area(idir, j, k, l)
$:GPU_ROUTINE(parallelism='[seq]')
Expand Down Expand Up @@ -2784,10 +2804,10 @@ contains
!! moving with its wall (face momentum times the wall's normal velocity is removed). With ib_exchange: energy in and mass out of
!! each lumped body (every body with ib_heat_wrt) into ib_heat(2:3), weighted so a step's stages sum to its exchange (SSP-RK: 1;
!! 1/2, 1/2; 1/6, 1/6, 2/3).
subroutine s_accumulate_ib_face_fluxes(idir, stage, q_cons_vf, markers)
subroutine s_accumulate_ib_face_fluxes(idir, stage, q_cons_vf, q_prim_vf, markers)

integer, intent(in) :: idir, stage
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf, q_prim_vf
type(integer_field), intent(in) :: markers !< ib_markers, or ib_markers_fine on an AMR fine frame
real(wp), dimension(3) :: f, r, tq, vb
real(wp) :: area, w, f_E, f_m, f_mom
Expand Down Expand Up @@ -2917,8 +2937,8 @@ contains
! + p n_i: the lab flux carries rho u_i u_n, so remove the face momentum (mean of the fluid
! and body cell) times the wall's normal velocity V_n
if (patch_ib(ib_id)%moving_ibm > 0) then
f(i) = f(i) - 0.5_wp*vb(idir)*(q_cons_vf(eqn_idx%mom%beg + i - 1)%sf(fj, fk, &
& fl) + q_cons_vf(eqn_idx%mom%beg + i - 1)%sf(ci, cj, ck))
f(i) = f(i) - 0.5_wp*vb(idir)*(f_ib_cell_momentum(q_cons_vf, q_prim_vf, i, fj, fk, &
& fl) + f_ib_cell_momentum(q_cons_vf, q_prim_vf, i, ci, cj, ck))
end if
f(i) = real(side, wp)*area*f(i)
end do
Expand Down
8 changes: 4 additions & 4 deletions src/simulation/m_rhs.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,9 @@ contains
! Momentum (IB forces) and energy/mass (thermal_bc = 3, ib_heat_wrt) the fluid exchanges with each IB through
! this direction's faces, on every AMR level with that level's markers.
if (amr_in_fine_advance) then
call s_accumulate_ib_face_fluxes(id, stage, q_cons_vf, ib_markers_fine)
call s_accumulate_ib_face_fluxes(id, stage, q_cons_vf, q_prim_qp%vf, ib_markers_fine)
else
call s_accumulate_ib_face_fluxes(id, stage, q_cons_vf, ib_markers)
call s_accumulate_ib_face_fluxes(id, stage, q_cons_vf, q_prim_qp%vf, ib_markers)
end if

! Bubble dynamics source terms
Expand Down Expand Up @@ -865,9 +865,9 @@ contains
call nvtxEndRange
! flux_rsx_vf holds the hat_L set and flux_hatR_rsx_vf the hat_R set, each the RHS's at its own faces
if (amr_in_fine_advance) then
call s_accumulate_ib_face_fluxes(id, stage, q_cons_vf, ib_markers_fine)
call s_accumulate_ib_face_fluxes(id, stage, q_cons_vf, q_prim_qp%vf, ib_markers_fine)
else
call s_accumulate_ib_face_fluxes(id, stage, q_cons_vf, ib_markers)
call s_accumulate_ib_face_fluxes(id, stage, q_cons_vf, q_prim_qp%vf, ib_markers)
end if
end do

Expand Down
162 changes: 162 additions & 0 deletions tests/9C0CAF25/golden-metadata.txt

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

Loading
Loading