@@ -233,19 +233,33 @@ contains
233233 real (kind (0d0 )), intent (OUT ), target :: gamma
234234 real (kind (0d0 )), intent (OUT ), target :: pi_inf
235235
236+ real (kind (0d0 )), dimension (num_fluids) :: alpha_rho_K, alpha_K
236237 real (kind (0d0 )), optional, dimension (2 ), intent (OUT ) :: Re_K
237238
238239 real (kind (0d0 )), optional, intent (OUT ) :: G_K
239240 real (kind (0d0 )), optional, dimension (num_fluids), intent (IN ) :: G
240241
241- integer :: i
242+ integer :: i, q
242243
243244 ! Constraining the partial densities and the volume fractions within
244245 ! their physical bounds to make sure that any mixture variables that
245246 ! are derived from them result within the limits that are set by the
246247 ! fluids physical parameters that make up the mixture
247- ! alpha_rho_K(1 ) = qK_vf(i)%sf(i,j,k)
248- ! alpha_K(1 ) = qK_vf(E_idx+ i)%sf(i,j,k)
248+ do i = 1 , num_fluids
249+ alpha_rho_K(i) = q_vf(i)%sf(j, k, l)
250+ alpha_K(i) = q_vf(advxb + i - 1 )%sf(j, k, l)
251+ end do
252+
253+ if (mpp_lim) then
254+
255+ do i = 1 , num_fluids
256+ alpha_rho_K(i) = max (0d0 , alpha_rho_K(i))
257+ alpha_K(i) = min (max (0d0 , alpha_K(i)), 1d0 )
258+ end do
259+
260+ alpha_K = alpha_K/ max (sum (alpha_K), 1d-16 )
261+
262+ end if
249263
250264 ! Performing the transfer of the density, the specific heat ratio
251265 ! function as well as the liquid stiffness function, respectively
@@ -284,6 +298,26 @@ contains
284298 end if
285299 end if
286300
301+ #ifdef MFC_SIMULATION
302+ ! Computing the shear and bulk Reynolds numbers from species analogs
303+ if (any (Re_size > 0 )) then
304+ if (num_fluids == 1 ) then ! need to consider case with num_fluids >= 2
305+ do i = 1 , 2
306+
307+ Re_K(i) = dflt_real; if (Re_size(i) > 0 ) Re_K(i) = 0d0
308+
309+ do q = 1 , Re_size(i)
310+ Re_K(i) = (1 - alpha_K(Re_idx(i, q)))/ fluid_pp(Re_idx(i, q))%Re(i) &
311+ + Re_K(i)
312+ end do
313+
314+ Re_K(i) = 1d0 / max (Re_K(i), sgm_eps)
315+
316+ end do
317+ end if
318+ end if
319+ #endif
320+
287321 ! Post process requires rho_sf/ gamma_sf/ pi_inf_sf to also be updated
288322#ifdef MFC_POST_PROCESS
289323 rho_sf (j, k, l) = rho
@@ -467,13 +501,16 @@ contains
467501
468502 subroutine s_convert_species_to_mixture_variables_bubbles_acc (rho_K , &
469503 gamma_K , pi_inf_K , &
470- alpha_K , alpha_rho_K , k , l , r )
504+ alpha_K , alpha_rho_K , Re_K , k , l , r )
471505!$acc routine seq
472506
473507 real (kind (0d0 )), intent (INOUT ) :: rho_K, gamma_K, pi_inf_K
474508
475509 real (kind (0d0 )), dimension (num_fluids), intent (IN ) :: alpha_rho_K, alpha_K !<
476510 !! Partial densities and volume fractions
511+
512+ real (kind (0d0 )), dimension (2 ), intent (OUT ) :: Re_K
513+
477514 integer , intent (IN ) :: k, l, r
478515 integer :: i, j !< Generic loop iterators
479516
@@ -499,6 +536,25 @@ contains
499536 gamma_K = gammas(1 )
500537 pi_inf_K = pi_infs(1 )
501538 end if
539+
540+ if (any (Re_size > 0 )) then
541+ if (num_fluids == 1 ) then ! need to consider case with num_fluids >= 2
542+
543+ do i = 1 , 2
544+ Re_K(i) = dflt_real
545+
546+ if (Re_size(i) > 0 ) Re_K(i) = 0d0
547+
548+ do j = 1 , Re_size(i)
549+ Re_K(i) = (1d0 - alpha_K(Re_idx(i, j)))/ Res(i, j) &
550+ + Re_K(i)
551+ end do
552+
553+ Re_K(i) = 1d0 / max (Re_K(i), sgm_eps)
554+
555+ end do
556+ end if
557+ end if
502558#endif
503559
504560 end subroutine s_convert_species_to_mixture_variables_bubbles_acc
@@ -706,7 +762,7 @@ contains
706762 alpha_rho_K, Re_K, j, k, l, G_K, Gs)
707763 else if (bubbles) then
708764 call s_convert_species_to_mixture_variables_bubbles_acc(rho_K, gamma_K, pi_inf_K, &
709- alpha_K, alpha_rho_K, j, k, l)
765+ alpha_K, alpha_rho_K, Re_K, j, k, l)
710766 else
711767 call s_convert_species_to_mixture_variables_acc(rho_K, gamma_K, pi_inf_K, &
712768 alpha_K, alpha_rho_K, Re_K, j, k, l)
@@ -1004,9 +1060,9 @@ contains
10041060 call s_convert_species_to_mixture_variables_acc(rho_K, gamma_K, pi_inf_K, &
10051061 alpha_K, alpha_rho_K, Re_K, &
10061062 j, k, l, G_K, Gs)
1007- ! else if (bubbles) then
1008- ! call s_convert_species_to_mixture_variables_bubbles_acc(rho_K, gamma_K, &
1009- ! pi_inf_K, alpha_K, alpha_rho_K, j, k, l)
1063+ else if (bubbles) then
1064+ call s_convert_species_to_mixture_variables_bubbles_acc(rho_K, gamma_K, &
1065+ pi_inf_K, alpha_K, alpha_rho_K, Re_K , j, k, l)
10101066 else
10111067 call s_convert_species_to_mixture_variables_acc(rho_K, gamma_K, pi_inf_K, &
10121068 alpha_K, alpha_rho_K, Re_K, j, k, l)
0 commit comments