Skip to content

Commit 10201f3

Browse files
authored
Fill ptil so probe output stops writing undefined ptilde and ptot (#1742)
1 parent b0323a6 commit 10201f3

3 files changed

Lines changed: 71 additions & 0 deletions

File tree

‎src/simulation/m_bubbles_EE.fpp‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,65 @@ contains
325325

326326
end subroutine s_compute_bubble_EE_source
327327

328+
!> Evaluate the Euler-Euler pressure correction at cell centers and store it in ptil. This mirrors the modified mixture pressure
329+
!! that the HLLC solver applies to the reconstructed face states in m_riemann_solver_hllc.fpp, following Ando (2010), Eq. (2.5).
330+
!! It is a diagnostic: ptil is read only by the probe output path and never feeds back into the solution.
331+
impure subroutine s_compute_ptilde(q_cons_vf, q_prim_vf)
332+
333+
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf, q_prim_vf
334+
real(wp) :: R3bar, R3V2bar, PbwR3bar
335+
real(wp) :: myRho, myP, alf, myR, myV, myPb
336+
integer :: j, k, l, q, ii
337+
338+
$:GPU_PARALLEL_LOOP(private='[j, k, l, q, ii, R3bar, R3V2bar, PbwR3bar, myRho, myP, alf, myR, myV, myPb]', collapse=3)
339+
do l = 0, p
340+
do k = 0, n
341+
do j = 0, m
342+
alf = q_prim_vf(eqn_idx%alf)%sf(j, k, l)
343+
myP = q_prim_vf(eqn_idx%E)%sf(j, k, l)
344+
345+
myRho = 0._wp
346+
$:GPU_LOOP(parallelism='[seq]')
347+
do ii = 1, num_fluids
348+
myRho = myRho + q_cons_vf(ii)%sf(j, k, l)
349+
end do
350+
351+
if (qbmm) then
352+
R3bar = mom_sp(1)%sf(j, k, l)
353+
R3V2bar = mom_sp(3)%sf(j, k, l)
354+
PbwR3bar = mom_sp(4)%sf(j, k, l)
355+
else
356+
R3bar = 0._wp
357+
R3V2bar = 0._wp
358+
PbwR3bar = 0._wp
359+
360+
$:GPU_LOOP(parallelism='[seq]')
361+
do q = 1, nb
362+
myR = q_prim_vf(rs(q))%sf(j, k, l)
363+
myV = q_prim_vf(vs(q))%sf(j, k, l)
364+
if (polytropic) then
365+
myPb = 0._wp
366+
else
367+
myPb = q_prim_vf(ps(q))%sf(j, k, l)
368+
end if
369+
370+
R3bar = R3bar + weight(q)*(myR**3._wp)
371+
R3V2bar = R3V2bar + weight(q)*(myR**3._wp)*(myV**2._wp)
372+
PbwR3bar = PbwR3bar + weight(q)*f_cpbw_KM(R0(q), myR, myV, myPb)*(myR**3._wp)
373+
end do
374+
end if
375+
376+
! Same degenerate-state guard the HLLC solver uses
377+
if (alf < small_alf .or. R3bar < small_alf) then
378+
ptil(j, k, l) = alf*myP
379+
else
380+
ptil(j, k, l) = alf*(myP - PbwR3bar/R3bar - myRho*R3V2bar/R3bar)
381+
end if
382+
end do
383+
end do
384+
end do
385+
$:END_GPU_PARALLEL_LOOP()
386+
387+
end subroutine s_compute_ptilde
388+
328389
end module m_bubbles_EE

‎src/simulation/m_rhs.fpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,13 @@ contains
842842
call nvtxEndRange
843843
end if
844844
845+
! ptil is a probe-output diagnostic only, so evaluate it only when probes are on.
846+
! This sits outside the source-term branch above so that the qbmm and adap_dt
847+
! paths, which skip that branch, still get a filled ptil.
848+
if (bubbles_euler .and. probe_wrt) then
849+
call s_compute_ptilde(q_cons_qp%vf(1:sys_size), q_prim_qp%vf(1:sys_size))
850+
end if
851+
845852
if (bubbles_lagrange) then
846853
if (.not. adap_dt) then
847854
call nvtxStartRange("RHS-EL-BUBBLES-DYN")

‎src/simulation/m_start_up.fpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,9 @@ contains
621621
do i = 1, sys_size
622622
$:GPU_UPDATE(host='[q_cons_ts(1)%vf(i)%sf]')
623623
end do
624+
if (bubbles_euler) then
625+
$:GPU_UPDATE(host='[ptil]')
626+
end if
624627
end if
625628

626629
! Total-variation-diminishing (TVD) Runge-Kutta (RK) time-steppers

0 commit comments

Comments
 (0)