Skip to content

Commit 1e101a5

Browse files
authored
Merge pull request #151 from lee-hyeoksu/master
2 parents 33f8547 + 01486cf commit 1e101a5

File tree

52 files changed

+1225
-650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1225
-650
lines changed

examples/3D_turb_mixing/case.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
Lz = 59.0
2323

2424
# Number of grid cells
25-
Nx = 255
26-
Ny = 255
27-
Nz = 255
25+
Nx = 191
26+
Ny = 191
27+
Nz = 191
2828

2929
# Grid spacing
3030
dx = Lx/float(Nx)
@@ -75,7 +75,6 @@
7575
'num_fluids' : 1,
7676
'adv_alphan' : 'T',
7777
'time_stepper' : 3,
78-
'weno_vars' : 2,
7978
'weno_order' : 5,
8079
'weno_eps' : 1.E-16,
8180
'weno_Re_flux' : 'T',

src/common/include/inline_conversions.fpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232

3333
if (mpp_lim .and. (num_fluids > 1)) then
3434
c = (1d0/gamma + 1d0)* &
35-
(pres + pi_inf)/rho
35+
(pres + pi_inf/(gamma+1d0))/rho
3636
else
3737
c = &
3838
(1d0/gamma + 1d0)* &
39-
(pres + pi_inf)/ &
39+
(pres + pi_inf/(gamma+1d0))/ &
4040
(rho*(1d0 - adv(num_fluids)))
4141
end if
4242
else
@@ -48,6 +48,7 @@
4848
else
4949
c = sqrt(c)
5050
end if
51+
5152
end subroutine s_compute_speed_of_sound
5253
#:enddef
5354

src/common/m_variables_conversion.fpp

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

src/pre_process/m_assign_variables.f90

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ subroutine s_assign_patch_species_primitive_variables_bubbles(patch_id, j, k, l,
271271
end if
272272

273273
! Computing Mixture Variables from Original Primitive Variables
274-
call s_convert_species_to_mixture_variables( &
274+
! call s_convert_species_to_mixture_variables( &
275+
call s_convert_to_mixture_variables( &
275276
q_prim_vf, j, k, l, &
276277
orig_rho, &
277278
orig_gamma, &
@@ -346,9 +347,10 @@ subroutine s_assign_patch_species_primitive_variables_bubbles(patch_id, j, k, l,
346347
end if
347348
end do
348349
end if
349-
350+
350351
! Density and the specific heat ratio and liquid stiffness functions
351-
call s_convert_species_to_mixture_variables( &
352+
! call s_convert_species_to_mixture_variables( &
353+
call s_convert_to_mixture_variables( &
352354
q_prim_vf, j, k, l, &
353355
patch_icpp(patch_id)%rho, &
354356
patch_icpp(patch_id)%gamma, &
@@ -417,7 +419,8 @@ subroutine s_assign_patch_species_primitive_variables_bubbles(patch_id, j, k, l,
417419
end if
418420

419421
! Density and the specific heat ratio and liquid stiffness functions
420-
call s_convert_species_to_mixture_variables( &
422+
! call s_convert_species_to_mixture_variables( &
423+
call s_convert_to_mixture_variables( &
421424
q_prim_vf, j, k, l, &
422425
patch_icpp(smooth_patch_id)%rho, &
423426
patch_icpp(smooth_patch_id)%gamma, &
@@ -480,7 +483,8 @@ subroutine s_assign_patch_species_primitive_variables_bubbles(patch_id, j, k, l,
480483
end if
481484

482485
! Density and the specific heat ratio and liquid stiffness functions
483-
call s_convert_species_to_mixture_variables(q_prim_vf, j, k, l, &
486+
! call s_convert_species_to_mixture_variables(q_prim_vf, j, k, l, &
487+
call s_convert_to_mixture_variables(q_prim_vf, j, k, l, &
484488
rho, gamma, pi_inf)
485489

486490
! Velocity

src/pre_process/m_initial_condition.fpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,14 @@ contains
381381
! Set fluid flow properties
382382
gam = 1.+1./fluid_pp(1)%gamma
383383
pi_inf = fluid_pp(1)%pi_inf*(gam-1.)/gam
384-
rho1 = patch_icpp(1)%alpha_rho(1)/patch_icpp(1)%alpha(1)
384+
if (bubbles .and. num_fluids == 1) then
385+
rho1 = patch_icpp(1)%alpha_rho(1)/(1d0-patch_icpp(1)%alpha(1))
386+
else
387+
rho1 = patch_icpp(1)%alpha_rho(1)/patch_icpp(1)%alpha(1)
388+
end if
385389
c1 = sqrt((gam*(patch_icpp(1)%pres+pi_inf))/rho1)
386390
mach = 1./c1
387-
391+
388392
! Assign mean profiles
389393
do j=0,n
390394
u_mean(j)=tanh(y_cc(j))

src/pre_process/m_patches.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ subroutine s_rectangle(patch_id, patch_id_fp, q_prim_vf) ! ---------------------
506506
real(kind(0d0)) :: pi_inf, gamma, lit_gamma !< Equation of state parameters
507507

508508
integer :: i, j !< generic loop iterators
509-
509+
510510
pi_inf = fluid_pp(1)%pi_inf
511511
gamma = fluid_pp(1)%gamma
512512
lit_gamma = (1d0 + gamma)/gamma

src/simulation/m_bubbles.fpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ contains
195195
n_tait = gammas(1)
196196
B_tait = pi_infs(1)
197197
end if
198-
198+
199199
n_tait = 1.d0/n_tait + 1.d0 !make this the usual little 'gamma'
200+
B_tait = B_tait*(n_tait-1)/n_tait ! make this the usual pi_inf
200201

201202
myRho = q_prim_vf(1)%sf(j, k, l)
202203
myP = q_prim_vf(E_idx)%sf(j, k, l)

src/simulation/m_cbc.fpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ contains
752752
end do
753753

754754
if (bubbles) then
755-
call s_convert_species_to_mixture_variables_bubbles_acc(rho, gamma, pi_inf, adv, alpha_rho, 0, k, r)
755+
call s_convert_species_to_mixture_variables_bubbles_acc(rho, gamma, pi_inf, adv, alpha_rho, Re_cbc, 0, k, r)
756756

757757
else
758758
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, adv, alpha_rho, Re_cbc, 0, k, r)
@@ -769,7 +769,6 @@ contains
769769

770770
! Compute mixture sound speed
771771
call s_compute_speed_of_sound(pres, rho, gamma, pi_inf, H, adv, vel_K_sum, c)
772-
773772
! ============================================================
774773

775774
! First-Order Spatial Derivatives of Primitive Variables =====

src/simulation/m_data_output.fpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ contains
255255
end do
256256

257257
if (bubbles) then
258-
call s_convert_species_to_mixture_variables_bubbles_acc(rho, gamma, pi_inf, alpha, alpha_rho, j, k, l)
258+
call s_convert_species_to_mixture_variables_bubbles_acc(rho, gamma, pi_inf, alpha, alpha_rho, Re, j, k, l)
259259
else
260260
call s_convert_species_to_mixture_variables_acc(rho, gamma, pi_inf, alpha, alpha_rho, Re, j, k, l)
261261
end if
@@ -270,7 +270,7 @@ contains
270270
end do
271271

272272
pres = q_prim_vf(E_idx)%sf(j, k, l)
273-
273+
274274
E = gamma*pres + pi_inf + 5d-1*rho*vel_sum
275275

276276
H = (E + pres)/rho
@@ -302,7 +302,6 @@ contains
302302
end if
303303

304304
if (any(Re_size > 0)) then
305-
306305
if (grid_geometry == 3) then
307306
vcfl_sf(j, k, l) = maxval(dt/Re) &
308307
/min(dx(j), dy(k), fltr_dtheta)**2d0

src/simulation/m_qbmm.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ contains
247247
n_tait = gammas(1)
248248
n_tait = 1.d0/n_tait + 1.d0 !make this the usual little 'gamma'
249249
B_tait = pi_infs(1)
250+
B_tait = B_tait*(n_tait-1)/n_tait ! make this the usual pi_inf
250251
c = n_tait*(pres + B_tait)/(rho*(1.d0 - alf))
251252
if (c > 0.d0) then
252253
c = DSQRT(c)

0 commit comments

Comments
 (0)