Skip to content

Commit 9d283e5

Browse files
hyeoksu-leeHyeoksu Lee
andauthored
removing duplicated codes in mixture rules for EE bubbles (#1071)
Co-authored-by: Hyeoksu Lee <[email protected]>
1 parent ba8a820 commit 9d283e5

File tree

8 files changed

+106
-371
lines changed

8 files changed

+106
-371
lines changed

src/common/m_variables_conversion.fpp

Lines changed: 89 additions & 311 deletions
Large diffs are not rendered by default.

src/simulation/m_bubbles_EE.fpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -242,34 +242,26 @@ contains
242242
myalpha(ii) = q_cons_vf(advxb + ii - 1)%sf(j, k, l)
243243
end do
244244

245-
myRho = 0._wp
246-
n_tait = 0._wp
247-
B_tait = 0._wp
245+
if (num_fluids == 1) then
246+
myRho = myalpha_rho(1)
247+
n_tait = gammas(1)
248+
B_tait = pi_infs(1)/pi_fac
249+
else
250+
myRho = 0._wp
251+
n_tait = 0._wp
252+
B_tait = 0._wp
248253

249-
if (mpp_lim .and. (num_fluids > 2)) then
250254
$:GPU_LOOP(parallelism='[seq]')
251255
do ii = 1, num_fluids
252256
myRho = myRho + myalpha_rho(ii)
253257
n_tait = n_tait + myalpha(ii)*gammas(ii)
254-
B_tait = B_tait + myalpha(ii)*pi_infs(ii)
255-
end do
256-
else if (num_fluids > 2) then
257-
$:GPU_LOOP(parallelism='[seq]')
258-
do ii = 1, num_fluids - 1
259-
myRho = myRho + myalpha_rho(ii)
260-
n_tait = n_tait + myalpha(ii)*gammas(ii)
261-
B_tait = B_tait + myalpha(ii)*pi_infs(ii)
258+
B_tait = B_tait + myalpha(ii)*pi_infs(ii)/pi_fac
262259
end do
263-
else
264-
myRho = myalpha_rho(1)
265-
n_tait = gammas(1)
266-
B_tait = pi_infs(1)/pi_fac
267260
end if
268261

269262
n_tait = 1._wp/n_tait + 1._wp !make this the usual little 'gamma'
270263
B_tait = B_tait*(n_tait - 1)/n_tait ! make this the usual pi_inf
271264

272-
myRho = q_prim_vf(1)%sf(j, k, l)
273265
myP = q_prim_vf(E_idx)%sf(j, k, l)
274266
alf = q_prim_vf(alf_idx)%sf(j, k, l)
275267
myR = q_prim_vf(rs(q))%sf(j, k, l)

src/simulation/m_bubbles_EL.fpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -642,11 +642,7 @@ contains
642642
call s_get_pinf(k, q_prim_vf, 1, myPinf, cell, aux1, aux2)
643643

644644
! Obtain liquid density and computing speed of sound from pinf
645-
$:GPU_LOOP(parallelism='[seq]')
646-
do i = 1, num_fluids
647-
myalpha_rho(i) = q_prim_vf(i)%sf(cell(1), cell(2), cell(3))
648-
myalpha(i) = q_prim_vf(E_idx + i)%sf(cell(1), cell(2), cell(3))
649-
end do
645+
call s_compute_species_fraction(q_prim_vf, cell(1), cell(2), cell(3), myalpha_rho, myalpha)
650646
call s_convert_species_to_mixture_variables_acc(myRho, gamma, pi_inf, qv, myalpha, &
651647
myalpha_rho, Re)
652648
call s_compute_cson_from_pinf(q_prim_vf, myPinf, cell, myRho, gamma, pi_inf, myCson)

src/simulation/m_cbc.fpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -813,11 +813,7 @@ contains
813813
adv_local(i) = q_prim_rs${XYZ}$_vf(0, k, r, E_idx + i)
814814
end do
815815
816-
if (bubbles_euler) then
817-
call s_convert_species_to_mixture_variables_bubbles_acc(rho, gamma, pi_inf, qv, adv_local, alpha_rho, Re_cbc)
818-
else
819-
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv, adv_local, alpha_rho, Re_cbc)
820-
end if
816+
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv, adv_local, alpha_rho, Re_cbc)
821817
822818
$:GPU_LOOP(parallelism='[seq]')
823819
do i = 1, contxe

src/simulation/m_hyperelastic.fpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,9 @@ contains
110110
do l = 0, p
111111
do k = 0, n
112112
do j = 0, m
113-
$:GPU_LOOP(parallelism='[seq]')
114-
do i = 1, num_fluids
115-
alpha_rho_k(i) = q_cons_vf(i)%sf(j, k, l)
116-
alpha_k(i) = q_cons_vf(advxb + i - 1)%sf(j, k, l)
117-
end do
113+
114+
call s_compute_species_fraction(q_cons_vf, j, k, l, alpha_rho_k, alpha_k)
115+
118116
! If in simulation, use acc mixture subroutines
119117
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv, alpha_k, &
120118
alpha_rho_k, Re, G_local, Gs_hyper)

src/simulation/m_ibm.fpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ contains
249249
if (elasticity) then
250250
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv_K, alpha_IP, &
251251
alpha_rho_IP, Re_K, G_K, Gs)
252-
else if (bubbles_euler) then
253-
call s_convert_species_to_mixture_variables_bubbles_acc(rho, gamma, pi_inf, qv_K, alpha_IP, &
254-
alpha_rho_IP, Re_K)
255252
else
256253
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv_K, alpha_IP, &
257254
alpha_rho_IP, Re_K)

src/simulation/m_sim_helpers.fpp

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -109,33 +109,11 @@ contains
109109

110110
integer :: i
111111

112-
if (igr) then
113-
if (num_fluids == 1) then
114-
alpha_rho(1) = q_prim_vf(contxb)%sf(j, k, l)
115-
alpha(1) = 1._wp
116-
else
117-
$:GPU_LOOP(parallelism='[seq]')
118-
do i = 1, num_fluids - 1
119-
alpha_rho(i) = q_prim_vf(i)%sf(j, k, l)
120-
alpha(i) = q_prim_vf(advxb + i - 1)%sf(j, k, l)
121-
end do
122-
123-
alpha_rho(num_fluids) = q_prim_vf(num_fluids)%sf(j, k, l)
124-
alpha(num_fluids) = 1._wp - sum(alpha(1:num_fluids - 1))
125-
end if
126-
else
127-
$:GPU_LOOP(parallelism='[seq]')
128-
do i = 1, num_fluids
129-
alpha_rho(i) = q_prim_vf(i)%sf(j, k, l)
130-
alpha(i) = q_prim_vf(advxb + i - 1)%sf(j, k, l)
131-
end do
132-
end if
112+
call s_compute_species_fraction(q_prim_vf, j, k, l, alpha_rho, alpha)
133113

134114
if (elasticity) then
135115
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv, alpha, &
136116
alpha_rho, Re, G_local, Gs)
137-
elseif (bubbles_euler) then
138-
call s_convert_species_to_mixture_variables_bubbles_acc(rho, gamma, pi_inf, qv, alpha, alpha_rho, Re)
139117
else
140118
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, qv, alpha, alpha_rho, Re)
141119
end if

toolchain/mfc/case_validator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ def check_stiffened_eos(self):
369369
if num_fluids is None:
370370
return
371371

372-
# Allow one extra fluid property slot when using bubbles_euler with single-component flows
373-
bub_fac = 1 if (bubbles_euler and num_fluids == 1) else 0
372+
# Allow one extra fluid property slot when using bubbles_euler
373+
bub_fac = 1 if (bubbles_euler) else 0
374374

375375
for i in range(1, num_fluids + 1 + bub_fac):
376376
gamma = self.get(f'fluid_pp({i})%gamma')

0 commit comments

Comments
 (0)